jcifs.util
Class PacketEventQueue

java.lang.Object
  |
  +--jcifs.util.PacketEventQueue

public class PacketEventQueue
extends Object

This class is a container for PacketEvents and is obtained from MultiDatagramSocket.

Since:
jcifs-0.1
Author:
Michael B. Allen
See Also:
MultiDatagramSocket, PacketEvent

Method Summary
 void clear()
          Clear all PacketEvents in the PacketEventQueue
 PacketEvent getNextPacketEvent()
          Retreive or wait for the next PacketEvent.
 PacketEvent getNextPacketEvent(long timeout)
          Retreive or wait for the next PacketEvent for at most timeout milliseconds.
 int getSize()
          Return the number of packets in the queue
 boolean isEmpty()
          Determine if the queue is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNextPacketEvent

public PacketEvent getNextPacketEvent()
                               throws InterruptedException
Retreive or wait for the next PacketEvent. This will block if there are no packets in the queue.
Throws:
InterruptedException - if the MultiDatagramSocket is closed or MultiDatagramSocket.interruptPacketEventQueues() is called

getNextPacketEvent

public PacketEvent getNextPacketEvent(long timeout)
                               throws InterruptedException
Retreive or wait for the next PacketEvent for at most timeout milliseconds.
Parameters:
timeout - the amount of time to wait blocked
Throws:
InterruptedException - if the socket is closed or the timeout period is reached

isEmpty

public boolean isEmpty()
Determine if the queue is empty.

getSize

public int getSize()
Return the number of packets in the queue

clear

public void clear()
Clear all PacketEvents in the PacketEventQueue