public boolean getAndSet ( boolean newValue ) { boolean oldValue = value . getAndSet ( newValue ) ; // did the state change? if ( oldValue != newValue ) valueTime = System . currentTimeMillis ( ) ; return oldValue ; }
Sets to the given value and returns the previous value . If the previous value is different than the new value the internal valueTime will be updated .