@Test public void snapshotExposesSamplesAsArray() { SlidingWindowHistogramReservoir reservoir = reservoirWithSamples(1, 100); assertThat(reservoir.getSnapshot().getValues(), is(toArray(Range.closed(1L, 100L)))); }
@Override public synchronized Snapshot getSnapshot() { if (updated || snapshotExpired(clock.tickMillis())) { snapshot = new HistogramSnapshot(histogram); updated = false; snapshotCreationTime = clock.tickMillis(); } return snapshot; }
SlidingWindowHistogramReservoir implements Reservoir { @Override public synchronized Snapshot getSnapshot() { if (updated || snapshotExpired(clock.tickMillis())) { snapshot = new HistogramSnapshot(histogram); updated = false; snapshotCreationTime = clock.tickMillis(); } return snapshot; } }
SlidingWindowHistogramReservoir implements Reservoir { @Override public synchronized Snapshot getSnapshot() { if (updated || snapshotExpired(clock.tickMillis())) { snapshot = new HistogramSnapshot(histogram); updated = false; snapshotCreationTime = clock.tickMillis(); } return snapshot; } SlidingWindowHistogramReservoir();  SlidingWindowHistogramReservoir(SlidingWindowHistogram histogram);  SlidingWindowHistogramReservoir(SlidingWindowHistogram histogram, Clock clock); }
SlidingWindowHistogramReservoir implements Reservoir { @Override public synchronized Snapshot getSnapshot() { if (updated || snapshotExpired(clock.tickMillis())) { snapshot = new HistogramSnapshot(histogram); updated = false; snapshotCreationTime = clock.tickMillis(); } return snapshot; } SlidingWindowHistogramReservoir();  SlidingWindowHistogramReservoir(SlidingWindowHistogram histogram);  SlidingWindowHistogramReservoir(SlidingWindowHistogram histogram, Clock clock); @Override int size(); @Override synchronized void update(long value); @Override synchronized Snapshot getSnapshot(); }
SlidingWindowHistogramReservoir implements Reservoir { @Override public synchronized Snapshot getSnapshot() { if (updated || snapshotExpired(clock.tickMillis())) { snapshot = new HistogramSnapshot(histogram); updated = false; snapshotCreationTime = clock.tickMillis(); } return snapshot; } SlidingWindowHistogramReservoir();  SlidingWindowHistogramReservoir(SlidingWindowHistogram histogram);  SlidingWindowHistogramReservoir(SlidingWindowHistogram histogram, Clock clock); @Override int size(); @Override synchronized void update(long value); @Override synchronized Snapshot getSnapshot();  }