Add PacketCollector.getCollectedCount()

This commit is contained in:
Florian Schmaus 2015-01-10 18:00:18 +01:00
parent e4bc6c2f37
commit 64242ace72
1 changed files with 11 additions and 0 deletions

View File

@ -166,6 +166,7 @@ public class PacketCollector {
* until a packet is available or the <tt>timeout</tt> has elapsed. If the * until a packet is available or the <tt>timeout</tt> has elapsed. If the
* timeout elapses without a result, <tt>null</tt> will be returned. * timeout elapses without a result, <tt>null</tt> will be returned.
* *
* @param timeout the timeout in milliseconds.
* @return the next available packet. * @return the next available packet.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -218,6 +219,16 @@ public class PacketCollector {
return result; return result;
} }
/**
* Get the number of collected stanzas this packet collector has collected so far.
*
* @return the count of collected stanzas.
* @since 4.1
*/
public int getCollectedCount() {
return resultQueue.size();
}
/** /**
* Processes a packet to see if it meets the criteria for this packet collector. * Processes a packet to see if it meets the criteria for this packet collector.
* If so, the packet is added to the result queue. * If so, the packet is added to the result queue.