Package org.jboss.util.timeout
Class HashedTimeoutPriorityQueueImpl.InternalPriorityQueue
- java.lang.Object
-
- org.jboss.util.timeout.HashedTimeoutPriorityQueueImpl.InternalPriorityQueue
-
- Enclosing class:
- HashedTimeoutPriorityQueueImpl
private class HashedTimeoutPriorityQueueImpl.InternalPriorityQueue extends java.lang.ObjectInternal priority queue
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ObjectlockThe lock objectprivate HashedTimeoutPriorityQueueImpl.TimeoutExtImpl[]queueThe timeoutsprivate intsizeThe size of the timeout queue.
-
Constructor Summary
Constructors Constructor Description InternalPriorityQueue()Create a new InternalPriorityQueue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()(package private) voidcheckTree()Check invariants of the queue.voidclear()(package private) booleancompareAndSwapWithTop(boolean notify)(package private) voidnormalizeDown(int index)private booleannormalizeUp(int index)A new node has been added at indexindex.(package private) TimeoutExtoffer(HashedTimeoutPriorityQueueImpl.TimeoutExtImpl timeout)(package private) booleanremove(TimeoutExt timeout)private HashedTimeoutPriorityQueueImpl.TimeoutExtImplremoveNode(int index)Remove a node from the tree and normalize.intsize()private voidswap(int a, int b)Swap two nodes in the tree.
-
-
-
Field Detail
-
lock
private java.lang.Object lock
The lock object
-
size
private int size
The size of the timeout queue.
-
queue
private HashedTimeoutPriorityQueueImpl.TimeoutExtImpl[] queue
The timeouts
-
-
Method Detail
-
offer
TimeoutExt offer(HashedTimeoutPriorityQueueImpl.TimeoutExtImpl timeout)
-
compareAndSwapWithTop
boolean compareAndSwapWithTop(boolean notify)
-
remove
boolean remove(TimeoutExt timeout)
-
clear
public void clear()
-
cancel
public void cancel()
-
size
public int size()
-
normalizeUp
private boolean normalizeUp(int index)
A new node has been added at indexindex. Normalize the tree by moving the new node up the tree.- Returns:
- true if the tree was modified.
-
normalizeDown
void normalizeDown(int index)
-
swap
private void swap(int a, int b)Swap two nodes in the tree.- Parameters:
a- the first indexb- the second index
-
removeNode
private HashedTimeoutPriorityQueueImpl.TimeoutExtImpl removeNode(int index)
Remove a node from the tree and normalize.- Parameters:
index- the index in the queue- Returns:
- the removed node.
-
checkTree
void checkTree()
Check invariants of the queue.
-
-