List of usage examples for java.util.concurrent DelayQueue remove
public boolean remove(Object o)
From source file:org.apache.hawq.pxf.service.UGICache.java
/** * Decrement reference count for the given session's UGI. Resets the time at which the UGI will * expire to UGI_CACHE_EXPIRY milliseconds in the future. * * @param session the session for which we want to release the UGI. * @param cleanImmediatelyIfNoRefs if true, destroys the UGI for the given session (only if it * is now unreferenced). *//*from ww w . j a v a 2 s. com*/ public void release(SessionId session, boolean cleanImmediatelyIfNoRefs) { Entry entry = cache.get(session); if (entry == null) { throw new IllegalStateException("Cannot release UGI for this session; it is not cached: " + session); } DelayQueue<Entry> expirationQueue = getExpirationQueue(session.getSegmentId()); synchronized (expirationQueue) { entry.decrementRefCount(); expirationQueue.remove(entry); if (cleanImmediatelyIfNoRefs && entry.isNotInUse()) { closeUGI(entry); } else { // Reset expiration time and put it back in the queue // only when we don't close the UGI entry.resetTime(); expirationQueue.offer(entry); } } }