public void addSample ( final T item , final long hash , final int value ) { if ( enabled ) { final Object lock = this ; samplerExecutor . execute ( new Runnable ( ) { public void run ( ) { // samplerExecutor is single threaded but still need // synchronization against jmx calls to finishSampling synchronized ( lock ) { if ( enabled ) { try { summary . offer ( item , value ) ; hll . offerHashed ( hash ) ; } catch ( Exception e ) { logger . debug ( "Failure to offer sample" , e ) ; } } } } } ) ; } }
Adds a sample to statistics collection . This method is non - blocking and will use the Sampler thread pool to record results if the sampler is enabled . If not sampling this is a NOOP