Class ExpiryQueue<E>
java.lang.Object
org.apache.zookeeper.server.ExpiryQueue<E>
ExpiryQueue tracks elements in time sorted fixed duration buckets.
It's used by SessionTrackerImpl to expire sessions and NIOServerCnxnFactory
to expire connections.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddump(PrintWriter pwriter) Returns an unmodifiable view of the expiration time -> elements mapping.longpoll()Remove the next expired set of elements from expireMap.Removes element from the queue.Adds or updates expiration time for element in queue, rounding the timeout to the expiry interval bucketed used by this queue.
-
Constructor Details
-
ExpiryQueue
public ExpiryQueue(int expirationInterval)
-
-
Method Details
-
remove
-
update
Adds or updates expiration time for element in queue, rounding the timeout to the expiry interval bucketed used by this queue.- Parameters:
elem- element to add/updatetimeout- timout in milliseconds- Returns:
- time at which the element is now set to expire if changed, or null if unchanged
-
getWaitTime
public long getWaitTime()- Returns:
- milliseconds until next expiration time, or 0 if has already past
-
poll
-
dump
-
getExpiryMap
-