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.Object
Internal priority queue
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
lock
The lock objectprivate HashedTimeoutPriorityQueueImpl.TimeoutExtImpl[]
queue
The timeoutsprivate int
size
The 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 void
cancel()
(package private) void
checkTree()
Check invariants of the queue.void
clear()
(package private) boolean
compareAndSwapWithTop(boolean notify)
(package private) void
normalizeDown(int index)
private boolean
normalizeUp(int index)
A new node has been added at indexindex
.(package private) TimeoutExt
offer(HashedTimeoutPriorityQueueImpl.TimeoutExtImpl timeout)
(package private) boolean
remove(TimeoutExt timeout)
private HashedTimeoutPriorityQueueImpl.TimeoutExtImpl
removeNode(int index)
Remove a node from the tree and normalize.int
size()
private void
swap(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.
-
-