@Test public void throwsIfAskForZeroTimestamps() { assertThatThrownBy(() -> timestamp.getFreshTimestamps(0)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Must not request zero or negative timestamps"); }
@Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { Preconditions.checkArgument(numTimestampsRequested > 0, "Must not request zero or negative timestamps"); ListenableFuture<TimestampRange> range = batcher.apply(numTimestampsRequested); try { return range.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (ExecutionException e) { Throwables.throwIfUncheckedException(e.getCause()); throw new RuntimeException(e); } }
RequestBatchingTimestampService implements CloseableTimestampService { @Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { Preconditions.checkArgument(numTimestampsRequested > 0, "Must not request zero or negative timestamps"); ListenableFuture<TimestampRange> range = batcher.apply(numTimestampsRequested); try { return range.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (ExecutionException e) { Throwables.throwIfUncheckedException(e.getCause()); throw new RuntimeException(e); } } }
RequestBatchingTimestampService implements CloseableTimestampService { @Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { Preconditions.checkArgument(numTimestampsRequested > 0, "Must not request zero or negative timestamps"); ListenableFuture<TimestampRange> range = batcher.apply(numTimestampsRequested); try { return range.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (ExecutionException e) { Throwables.throwIfUncheckedException(e.getCause()); throw new RuntimeException(e); } } private  RequestBatchingTimestampService(TimestampService delegate,
            DisruptorAutobatcher<Integer, TimestampRange> batcher); }
RequestBatchingTimestampService implements CloseableTimestampService { @Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { Preconditions.checkArgument(numTimestampsRequested > 0, "Must not request zero or negative timestamps"); ListenableFuture<TimestampRange> range = batcher.apply(numTimestampsRequested); try { return range.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (ExecutionException e) { Throwables.throwIfUncheckedException(e.getCause()); throw new RuntimeException(e); } } private  RequestBatchingTimestampService(TimestampService delegate,
            DisruptorAutobatcher<Integer, TimestampRange> batcher); @Override boolean isInitialized(); @Override void close(); @Override long getFreshTimestamp(); @Override TimestampRange getFreshTimestamps(int numTimestampsRequested); static RequestBatchingTimestampService create(TimestampService untimedDelegate); }
RequestBatchingTimestampService implements CloseableTimestampService { @Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { Preconditions.checkArgument(numTimestampsRequested > 0, "Must not request zero or negative timestamps"); ListenableFuture<TimestampRange> range = batcher.apply(numTimestampsRequested); try { return range.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (ExecutionException e) { Throwables.throwIfUncheckedException(e.getCause()); throw new RuntimeException(e); } } private  RequestBatchingTimestampService(TimestampService delegate,
            DisruptorAutobatcher<Integer, TimestampRange> batcher); @Override boolean isInitialized(); @Override void close(); @Override long getFreshTimestamp(); @Override TimestampRange getFreshTimestamps(int numTimestampsRequested); static RequestBatchingTimestampService create(TimestampService untimedDelegate);  }