Get and clear the slot - MUST be called while holding the lock!!
@return The data or null if no data or error exists
@throws Throwable If producer encountered an error
497673
private T getAndClearUnderLock() throws Throwable {
    if(error != null) {
      throw error;
    } else {    
      // Return and clear current
      T retValue = data;
      data = null;
      return retValue;
    }
  }
596171
public T get() {
    long expiration = whenItExpires;
    long now = System.nanoTime();

    // if uninitialized or expired update value
    if (expiration == 0 || now >= expiration) {
      synchronized (this) {
        // ensure a different thread didn't update it
        if (whenItExpires == expiration) {
          whenItExpires = now + durationNanos;
          try {
            value = getter.call();
          } catch (Exception e) {
            // shouldn't happen
            throw Throwables.propagate(e);
          }
        }
      }
    }
    return value;
  }
172587
public @CheckForNull R get() {
        Holder<R> h = holder; // capture
        return h!=null ? h.get() : null;
    }
1206596
public T remove()
    {
        if ( size == 0 ) {
            return null;
        }
        
        //remove the first element
        Entry<T> o = head.next;
        head.next   = o.next;
        o.next.prev = head;
        
        //bakup the data
        T v         = o.data;
        size--;
        index.remove(v.getValue());
        
        o = null;            //Let gc do its work
        
        return v;
    }
278379
@Override
	public synchronized T get() {
		@Nullable T checkedObject = this.object;

		if (checkedObject == null) {
			this.object = checkedObject = Objects.requireNonNull(this.initializer.get());
		}
		return checkedObject;
	}
526816
public static Throwable unwrap(@Nullable Throwable t) {
		if (t instanceof UncheckedException || t instanceof java.util.concurrent.ExecutionException
				|| t instanceof java.lang.reflect.InvocationTargetException
				|| t instanceof UndeclaredThrowableException) {
			return t.getCause();
		}

		return t;
	}
1114090
public void removeLockedObject() {
        if (this != resourceLocks.root && !this.getPath().equals("/")) {

            int size = parent.children.length;
            for (int i = 0; i < size; i++) {
                if (parent.children[i].equals(this)) {
                    LockedObject[] newChildren = new LockedObject[size - 1];
                    for (int i2 = 0; i2 < (size - 1); i2++) {
                        if (i2 < i) {
                            newChildren[i2] = parent.children[i2];
                        } else {
                            newChildren[i2] = parent.children[i2 + 1];
                        }
                    }
                    if (newChildren.length != 0) {
                        parent.children = newChildren;
                    } else {
                        parent.children = null;
                    }
                    break;
                }
            }

            // removing from hashtable
            resourceLocks.locksByID.remove(getID());
            resourceLocks.locks.remove(getPath());

            // now the garbage collector has some work to do
        }
    }
750456
public synchronized V loadAndGet() throws ExecutionException {
    try {
      value = Optional.ofNullable(valueFetcher.call());
    } catch (final Exception e) {
      throw new ExecutionException(e);
    } finally {
      writeTime = Optional.of(currentTime.now());
      this.notifyAll();
    }
    if (!value.isPresent()) {
      throw new ExecutionException(new NullPointerException("valueFetcher returned null"));
    } else {
      return value.get();
    }
  }
692001
@Nonnull
  public EChange clearCache ()
  {
    return m_aRWLock.writeLocked ( () -> {
      if (m_aImageData.isEmpty () && m_aNonExistingResources.isEmpty ())
        return EChange.UNCHANGED;

      m_aImageData.clear ();
      m_aNonExistingResources.clear ();

      if (LOGGER.isDebugEnabled ())
        LOGGER.debug ("Cache was cleared: " + ImageDataManager.class.getName ());
      return EChange.CHANGED;
    });
  }
179219
public void removeLockedObject() {
        if (this != _resourceLocks._root && !this.getPath().equals("/")) {

            int size = _parent._children.length;
            for (int i = 0; i < size; i++) {
                if (_parent._children[i].equals(this)) {
                    LockedObject[] newChildren = new LockedObject[size - 1];
                    for (int i2 = 0; i2 < (size - 1); i2++) {
                        if (i2 < i) {
                            newChildren[i2] = _parent._children[i2];
                        } else {
                            newChildren[i2] = _parent._children[i2 + 1];
                        }
                    }
                    if (newChildren.length != 0) {
                        _parent._children = newChildren;
                    } else {
                        _parent._children = null;
                    }
                    break;
                }
            }

            // removing from hashtable
            _resourceLocks._locksByID.remove(getID());
            _resourceLocks._locks.remove(getPath());

            // now the garbage collector has some work to do
        }
    }
1092478
@Override
    public final T get() {
        if (obj == null) {
            synchronized (lock) {
                if (obj == null) {
                    obj = create();
                }
            }
        }
        return obj;
    }
876706
protected synchronized List<LockData> getLockList()
   {
      try
      {
         return getLockList.run();
      }
      catch (LockException e)
      {
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }
      return null;
   }
1357962
public synchronized Object get() {
        Object o = null;

        while ((o = tryGet()) == null) {
            try {
                this.wait();
            } catch (final InterruptedException e) {
            }
        }
        return o;
    }
837925
public static Buffer getQueue() {

        return BufferUtils.synchronizedBuffer(TypedBuffer.decorate(new UnboundedFifoBuffer() {

            /** The serialization version id constant. */
            private static final long serialVersionUID = 606444342980861724L;

            /**
             * Called when the queue is full to remove the oldest element.<p>
             *
             * @see org.apache.commons.collections.buffer.BoundedFifoBuffer#remove()
             */
            @Override
            public Object remove() {

                CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)super.remove();
                return publishJob;
            }
        }, CmsPublishJobInfoBean.class));
    }
516456
protected LockData getLockDataById(String nodeId)
   {
      try
      {
         return getLockDataById.run(nodeId);
      }
      catch (LockException e)
      {
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }
      return null;
   }
1056186
public Object pop()
  {
    Object val = m_map[--m_firstFree];
    m_map[m_firstFree] = null;
    
    return val;
  }
1296498
public final T clear()
  {
    T hold;
    _lock.lock();
    try
    {
      hold = _val;
      _val = null;
    } finally {
      _lock.unlock();
    }
    return hold;
  }