|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object asynctcp.ASyncTCPMessageQueue
public class ASyncTCPMessageQueue
A queue of messages ready to be delivered over a given connection.
Method Summary | |
---|---|
ASyncTCPMessageHandle |
enqueue(Message msg)
Enqueues the Message argument for delivery to the
destination. |
int |
getCapacity()
Returns the capacity of the queue; attempting to enqueue a message in a queue whose length meets or exceeds its capacity will fail. |
Connection |
getConnection()
Returns the Connection object with which this queue is
associated. |
java.util.List<ASyncTCPMessageHandle> |
getEnqueued()
Returns handles to the enqueued messages. |
int |
getLength()
Returns the number of messages enqueued to the destination. |
ASyncTCPMessageHandle |
getSending()
Returns the handle to the message currently being sent. |
boolean |
isEmpty()
Returns whether any messages present in this queue. |
boolean |
isFull()
Returns whether the queue is already at its capacity; if so, any attempts to enqueue new messages will fail until this is not the case. |
boolean |
setCapacity(int new_capacity)
Sets the capacity of this queue to the provided non-negative integer new_capacity . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Connection getConnection()
Connection
object with which this queue is
associated.
public int getCapacity()
-1
, no capacity is enforced.
public boolean setCapacity(int new_capacity)
new_capacity
. If new_capacity
equals
-1
, no capacity will be enforced. If this method is
invoked with a new capacity less than the current queue length, then no
messages are evicted from the queue. Instead, we wait for the queue to
reduce in length over time as messages are transmitted until it is below
the new capacity.
new_capacity
- the new capacity of the queue
true
if new_capacity
is greater
than or equal to -1
and set correctly, false
otherwisepublic boolean isFull()
true
if the queue is at full capacity,
false
otherwisepublic java.util.List<ASyncTCPMessageHandle> getEnqueued()
public ASyncTCPMessageHandle enqueue(Message msg)
MessageQueue
Message
argument for delivery to the
destination.
enqueue
in interface MessageQueue
msg
- the Message
to enqueue for delivery
public int getLength()
MessageQueue
getLength
in interface MessageQueue
public boolean isEmpty()
MessageQueue
true
if and only if method getLength
returns 0
.
isEmpty
in interface MessageQueue
true
if no messages are enqueued,
false
otherwisepublic ASyncTCPMessageHandle getSending()
MessageQueue
getSending
in interface MessageQueue
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |