asyncudp
Class ASyncUDPMessageQueue

java.lang.Object
  extended by asyncudp.ASyncUDPMessageQueue
All Implemented Interfaces:
MessageQueue

public class ASyncUDPMessageQueue
extends java.lang.Object
implements MessageQueue

The queue of messages to be delivered to remote nodes.

Author:
Michael Parker

Method Summary
 ASyncUDPMessageHandle enqueue(Message msg)
          Enqueues the Message argument for delivery to the provided IP address and port.
 boolean equals(java.lang.Object obj)
           
 AddressPortPair getDestination()
          Returns the address and port to which this message will be delivered.
 java.util.List<ASyncUDPMessageHandle> getEnqueued()
          Returns handles to the enqueued messages.
 int getLength()
          Returns the number of messages enqueued to the destination.
 ASyncUDPMessageHandle getSending()
          Returns the handle to the message currently being sent.
 int hashCode()
           
 boolean isEmpty()
          Returns whether any messages present in this queue.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getDestination

public AddressPortPair getDestination()
Returns the address and port to which this message will be delivered.

Returns:
the destination AddressPortPair

enqueue

public ASyncUDPMessageHandle enqueue(Message msg)
Enqueues the Message argument for delivery to the provided IP address and port.

Specified by:
enqueue in interface MessageQueue
Parameters:
msg - the Message to enqueue for delivery
Returns:
a handle to the enqueued message

getLength

public int getLength()
Returns the number of messages enqueued to the destination.

Specified by:
getLength in interface MessageQueue
Returns:
the number of enqueued messages

isEmpty

public boolean isEmpty()
Returns whether any messages present in this queue. This message returns true if and only if method getLength returns 0.

Specified by:
isEmpty in interface MessageQueue
Returns:
true if no messages are enqueued, false otherwise

getSending

public ASyncUDPMessageHandle getSending()
Returns the handle to the message currently being sent.

Specified by:
getSending in interface MessageQueue
Returns:
handle to the message being sent

getEnqueued

public java.util.List<ASyncUDPMessageHandle> getEnqueued()
Returns handles to the enqueued messages. Note that the returned list is backed by the queue for this connection, but cannot be modified. The elements in the list are returned in the order in which they are enqueued, so that the first element is the next message to be sent.

Returns:
a list of handles to the enqueued messages