asyncudp
Class QueueManager

java.lang.Object
  extended by asyncudp.QueueManager

public class QueueManager
extends java.lang.Object

A class allowing management of message queues for an ASyncUDP instance.

Author:
Michael Parker

Method Summary
 ASyncUDPMessageHandle enqueue(Message msg, AddressPortPair app)
          Enqueues the Message argument for delivery to the given destination app.
 java.util.Set<ASyncUDPMessageQueue> getAllMessageQueues()
          Returns all MessageQueue objects that are either sending or have data enqueued to their respective destination addresses.
 ASyncUDPListener getListener()
          Retrieves the listener for this ASyncUDP instance.
 ASyncUDPMessageQueue getMessageQueue(AddressPortPair app)
          Returns the MessageQueue object associated with the given destination.
 int getPortNumber()
          Returns the port number on which this ASyncUDP instance is listening for new incoming datagrams.
 ASyncUDPListener setListener(ASyncUDPListener audpl)
          Sets audpl as the listener on this ASyncUDP instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

enqueue

public ASyncUDPMessageHandle enqueue(Message msg,
                                     AddressPortPair app)
Enqueues the Message argument for delivery to the given destination app.

Parameters:
msg - the Message to enqueue for delivery
app - the address to which the message should be delivered
Returns:
a handle to the enqueued message

getMessageQueue

public ASyncUDPMessageQueue getMessageQueue(AddressPortPair app)
Returns the MessageQueue object associated with the given destination.

Parameters:
app - the destination address to retrieve the message queue for
Returns:
the associated message queue

getAllMessageQueues

public java.util.Set<ASyncUDPMessageQueue> getAllMessageQueues()
Returns all MessageQueue objects that are either sending or have data enqueued to their respective destination addresses.

Returns:
all message queues that are sending or have enqueued messages

getListener

public ASyncUDPListener getListener()
Retrieves the listener for this ASyncUDP instance.

Returns:
the current listener for this ASyncUDP instance, or null if there is no listener

setListener

public ASyncUDPListener setListener(ASyncUDPListener audpl)
Sets audpl as the listener on this ASyncUDP instance. The listener can later be retrieved via the getListener method. Only one listener may be set at a time; invoking this method causes any previous listener to be discarded. The current listener may be discarded by passing in null.

Parameters:
audpl - the new listener for this ASyncUDP instance
Returns:
the previous listener

getPortNumber

public int getPortNumber()
Returns the port number on which this ASyncUDP instance is listening for new incoming datagrams. If this method returns -1, then this instance is not listening on any port, and only sends outgoing datagrams.

Returns:
the port number on which this ASyncUDP instance listens for incoming datagrams