code: public T getAndSetReference(final T newValue) {
          _lock.writeLock().lock();
          final T oldReference = _reference.getAndSet(newValue);
          _lock.writeLock().unlock();
          return oldReference;
      }
docs: Replaces the held reference safely.
  
  @param newValue the new reference
  @return the old reference