Archiviert
13
0

Add some size methods.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-10-02 04:02:54 +02:00
Ursprung e4e4581717
Commit 48cedd20d4
2 geänderte Dateien mit 17 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -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.

Datei anzeigen

@ -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.