use of com.oath.cyclops.react.collectors.lazy.EmptyCollector in project cyclops by aol.
the class EmptyCollectorTest method testAcceptMock50.
@Test
public void testAcceptMock50() {
collector = new EmptyCollector<>(new MaxActive(500, 450), cf -> cf.join());
FastFuture cf = Mockito.mock(FastFuture.class);
BDDMockito.given(cf.isDone()).willReturn(true);
for (int i = 0; i < 1000; i++) {
collector.accept(cf);
}
Mockito.verify(cf, Mockito.times(501)).isDone();
}
use of com.oath.cyclops.react.collectors.lazy.EmptyCollector in project cyclops by aol.
the class EmptyCollectorTest method testAcceptMock495.
@Test
public void testAcceptMock495() {
collector = new EmptyCollector<>(new MaxActive(500, 5), cf -> cf.join());
FastFuture cf = Mockito.mock(FastFuture.class);
BDDMockito.given(cf.isDone()).willReturn(true);
for (int i = 0; i < 1000; i++) {
collector.accept(cf);
}
Mockito.verify(cf, Mockito.times(501)).isDone();
}
use of com.oath.cyclops.react.collectors.lazy.EmptyCollector in project cyclops by aol.
the class LazyStream method runThread.
default void runThread(final Runnable r) {
final Function<FastFuture, U> safeJoin = (final FastFuture cf) -> (U) BlockingStreamHelper.getSafe(cf, getErrorHandler());
new Thread(() -> new Runner(r).run(getLastActive(), new EmptyCollector(getMaxActive(), safeJoin))).start();
}
Aggregations