@Test public void testWithSampleRate() { monitor = monitor.withSampleRate(5); for(int i=0;i<100;i++) monitor.accept(FastFuture.completedFuture(10)); assertThat(recieved, is(20)); }
@Override public void accept(final FastFuture<T> t) { if (count++ % sampleRate == 0) consumer.accept(t); }
SamplingCollector implements LazyResultConsumer<T> { @Override public void accept(final FastFuture<T> t) { if (count++ % sampleRate == 0) consumer.accept(t); } }
SamplingCollector implements LazyResultConsumer<T> { @Override public void accept(final FastFuture<T> t) { if (count++ % sampleRate == 0) consumer.accept(t); } SamplingCollector(final int sampleRate, final LazyResultConsumer<T> consumer); }
SamplingCollector implements LazyResultConsumer<T> { @Override public void accept(final FastFuture<T> t) { if (count++ % sampleRate == 0) consumer.accept(t); } SamplingCollector(final int sampleRate, final LazyResultConsumer<T> consumer); @Override void accept(final FastFuture<T> t); @Override void block(final Function<FastFuture<T>, T> safeJoin); @Override LazyResultConsumer<T> withResults(final Collection<FastFuture<T>> t); @Override Collection<FastFuture<T>> getResults(); @Override Collection<FastFuture<T>> getAllResults(); }
SamplingCollector implements LazyResultConsumer<T> { @Override public void accept(final FastFuture<T> t) { if (count++ % sampleRate == 0) consumer.accept(t); } SamplingCollector(final int sampleRate, final LazyResultConsumer<T> consumer); @Override void accept(final FastFuture<T> t); @Override void block(final Function<FastFuture<T>, T> safeJoin); @Override LazyResultConsumer<T> withResults(final Collection<FastFuture<T>> t); @Override Collection<FastFuture<T>> getResults(); @Override Collection<FastFuture<T>> getAllResults();  }