use of org.davidmoten.rx.pool.NonBlockingMember in project rxjava2-jdbc by davidmoten.
the class PoolTest method testSimplePool.
@Test
public void testSimplePool() throws InterruptedException {
AtomicInteger count = new AtomicInteger();
MemberFactory<Integer, NonBlockingPool<Integer>> memberFactory = pool -> new NonBlockingMember<Integer>(pool, null);
Pool<Integer> pool = //
NonBlockingPool.factory(() -> count.incrementAndGet()).healthy(//
n -> true).disposer(n -> {
}).maxSize(//
3).returnToPoolDelayAfterHealthCheckFailureMs(//
1000).memberFactory(//
memberFactory).scheduler(//
Schedulers.computation()).build();
//
pool.members().doOnNext(//
m -> m.checkin()).doOnNext(//
System.out::println).test(4).assertValueCount(4);
}
Aggregations