List of usage examples for java.util.concurrent DelayQueue poll
public E poll()
From source file:org.apache.hawq.pxf.service.UGICache.java
/** * Iterate through all the entries in the queue and close expired {@link UserGroupInformation}, * otherwise it resets the timer for every non-expired entry. * * @param expirationQueue//from w ww . j a va2 s . c o m */ private void cleanup(DelayQueue<Entry> expirationQueue) { Entry expiredUGI; while ((expiredUGI = expirationQueue.poll()) != null) { if (expiredUGI.isNotInUse()) { closeUGI(expiredUGI); } else { // The UGI object is still being used by another thread String fsMsg = "FileSystem for proxy user = " + expiredUGI.getSession().getUser(); if (LOG.isDebugEnabled()) { LOG.debug(expiredUGI.getSession().toString() + " Skipping close of " + fsMsg); } // Place it back in the queue if still in use and was not closed expiredUGI.resetTime(); expirationQueue.offer(expiredUGI); } if (LOG.isDebugEnabled()) { LOG.debug("Delay Queue Size for segment " + expiredUGI.getSession().getSegmentId() + " = " + expirationQueue.size()); } } }