Code example for AtomicReference

Methods: getAndSet

0
  { 
    if (_isClose)
      return false; 
     
    _taskLoader = loader;
    if (_taskRef.getAndSet(task) != null) {
      System.out.println("BAD: getandset");
    } 
    LockSupport.unpark(this);
 
    return true; 
  } 
 
  /** 
   * Wake the thread.  Called outside of _idleLock 
   */ 
  final void close() 
  { 
    _isClose = true;
    LockSupport.unpark(this);