public synchronized void addMeasurement(long value){
  Validate.isTrue(value >= 0,Long.toString(value));
  if (Long.MAX_VALUE - totalMs < value) {
    reset();
  }
  ++hits;
  totalMs+=value;
  if (value > ceilingMs) {
    effectiveCeilingMs=ceilingMs;
    ceilingMs=value;
  }
 else   if (value > effectiveCeilingMs) {
    effectiveCeilingMs=value;
  }
  if (value < floorMs) {
    floorMs=value;
  }
}

public synchronized void addMeasurement ( long value ) { Validate . isTrue ( value >= 0 , Long . toString ( value ) ) ; if ( Long . MAX_VALUE - totalMs < value ) { reset ( ) ; } ++ hits ; totalMs += value ; if ( value > ceilingMs ) { effectiveCeilingMs = ceilingMs ; ceilingMs = value ; } else if ( value > effectiveCeilingMs ) { effectiveCeilingMs = value ; } if ( value < floorMs ) { floorMs = value ; } }
add measurement to the metrics . thread safe .
