List of usage examples for java.util.concurrent DelayQueue size
public int size()
From source file:org.apache.hawq.pxf.service.UGICache.java
/** * This method is not thread-safe, and is intended to be called in tests. * * @return the sum of the sizes of the internal queues *//*ww w . j a v a2s . co m*/ int allQueuesSize() { int count = 0; for (DelayQueue queue : expirationQueueMap.values()) { count += queue.size(); } return count; }
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 w w . j ava 2 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()); } } }