private class HashedTimeoutPriorityQueueImpl.InternalPriorityQueue
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object |
lock
The lock object
|
private HashedTimeoutPriorityQueueImpl.TimeoutExtImpl[] |
queue
The timeouts
|
private int |
size
The size of the timeout queue.
|
| Constructor and Description |
|---|
InternalPriorityQueue()
Create a new InternalPriorityQueue.
|
| Modifier and Type | Method and 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 index
index. |
(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.
|
private java.lang.Object lock
private int size
private HashedTimeoutPriorityQueueImpl.TimeoutExtImpl[] queue
InternalPriorityQueue()
TimeoutExt offer(HashedTimeoutPriorityQueueImpl.TimeoutExtImpl timeout)
boolean compareAndSwapWithTop(boolean notify)
boolean remove(TimeoutExt timeout)
public void clear()
public void cancel()
public int size()
private boolean normalizeUp(int index)
index.
Normalize the tree by moving the new node up the tree.void normalizeDown(int index)
private void swap(int a,
int b)
a - the first indexb - the second indexprivate HashedTimeoutPriorityQueueImpl.TimeoutExtImpl removeNode(int index)
index - the index in the queuevoid checkTree()