Add some size methods.

This commit is contained in:
Kristian S. Stangeland 2012-10-02 04:02:54 +02:00
parent e4e4581717
commit 48cedd20d4
2 changed files with 17 additions and 1 deletions

View File

@ -69,7 +69,7 @@ class PacketProcessingQueue extends AbstractConcurrentListenerMultimap<AsyncList
public boolean enqueue(PacketEvent packet, boolean onMainThread) {
try {
processingQueue.add(new PacketEventHolder(packet));
// Begin processing packets
signalBeginProcessing(onMainThread);
return true;
@ -78,6 +78,14 @@ class PacketProcessingQueue extends AbstractConcurrentListenerMultimap<AsyncList
}
}
/**
* Number of packet events in the queue.
* @return The number of packet events in the queue.
*/
public int size() {
return processingQueue.size();
}
/**
* Called by the current method and each thread to signal that a packet might be ready for processing.
* @param onMainThread - whether or not this is occuring on the main thread.

View File

@ -22,6 +22,14 @@ class PacketSendingQueue {
// Whether or not packet transmission can only occur on the main thread
private final boolean synchronizeMain;
/**
* Number of packet events in the queue.
* @return The number of packet events in the queue.
*/
public int size() {
return sendingQueue.size();
}
/**
* Create a packet sending queue.
* @param synchronizeMain - whether or not to synchronize with the main thread.