code: private static void updateMaximum(AtomicLong counter, long currentValue) {
  		boolean unset = true;
  		long counterValue = counter.get();
  		while ((currentValue > counterValue) && unset) {
  			unset = !counter.compareAndSet(counterValue, currentValue);
  			counterValue = counter.get();
  		}
  	}
docs: Compares the current value against the value of the counter and updates
  the counter if the current value is greater. This is done in a way to
  ensure that no updates are lost.
  
  @param counter
  AtomicLong counter to update
  @param currentValue
  current value of the counter