@Test public void testEncode() throws Exception { when(delegate.encode(OBJECT)).thenReturn(DATA); final byte[] res = objectObjectSizeMonitoringTranscoder.encode(OBJECT); assertEquals("encoded object", DATA, res); verify(histogram).update(OBJECT_SIZE); verify(counter).inc(OBJECT_SIZE); }
@Override public byte[] encode(final T t) { final byte[] encoded = delegate.encode(t); if (shouldSampleNow()) { final int size = encoded.length; setHisto.update(size); setBytes.inc(size); } return encoded; }
ObjectSizeMonitoringTranscoder implements Transcoder<T> { @Override public byte[] encode(final T t) { final byte[] encoded = delegate.encode(t); if (shouldSampleNow()) { final int size = encoded.length; setHisto.update(size); setBytes.inc(size); } return encoded; } }
ObjectSizeMonitoringTranscoder implements Transcoder<T> { @Override public byte[] encode(final T t) { final byte[] encoded = delegate.encode(t); if (shouldSampleNow()) { final int size = encoded.length; setHisto.update(size); setBytes.inc(size); } return encoded; } ObjectSizeMonitoringTranscoder(final Transcoder<T> transcoderDelegate, final MetricFactory metricFactory, final String cacheName, long sampleRate); }
ObjectSizeMonitoringTranscoder implements Transcoder<T> { @Override public byte[] encode(final T t) { final byte[] encoded = delegate.encode(t); if (shouldSampleNow()) { final int size = encoded.length; setHisto.update(size); setBytes.inc(size); } return encoded; } ObjectSizeMonitoringTranscoder(final Transcoder<T> transcoderDelegate, final MetricFactory metricFactory, final String cacheName, long sampleRate); @Override T decode(final byte[] b); @Override byte[] encode(final T t); }
ObjectSizeMonitoringTranscoder implements Transcoder<T> { @Override public byte[] encode(final T t) { final byte[] encoded = delegate.encode(t); if (shouldSampleNow()) { final int size = encoded.length; setHisto.update(size); setBytes.inc(size); } return encoded; } ObjectSizeMonitoringTranscoder(final Transcoder<T> transcoderDelegate, final MetricFactory metricFactory, final String cacheName, long sampleRate); @Override T decode(final byte[] b); @Override byte[] encode(final T t);  }