org.xnap.plugin.overnet.net
Class MessageQueue

java.lang.Object
  extended by org.xnap.plugin.overnet.net.MessageQueue

public class MessageQueue
extends java.lang.Object

Queues client messages and removes them from its list only if all bytes are written out. Addition and removal of messages is synchronized.


Constructor Summary
MessageQueue()
           
 
Method Summary
 void add(OvernetClientMessage msg)
          Adds a new message to the queue.
 void clear()
           
 OvernetClientMessage getNextMessage()
          Returns next message which has still some bytes to be written out.
 boolean hasRemaining()
          Returns true if there is still a message available which must be written out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageQueue

public MessageQueue()
Method Detail

getNextMessage

public OvernetClientMessage getNextMessage()
Returns next message which has still some bytes to be written out. The message is removed from the list only after it's been totally written out. Hence a call to getNextMessage() which doesn't write it out, doesn't remove the message from the queue.

Returns:
null if there are no messages to be written.

add

public void add(OvernetClientMessage msg)
Adds a new message to the queue.


hasRemaining

public boolean hasRemaining()
Returns true if there is still a message available which must be written out.


clear

public void clear()


Copyright © 2001-2005 XNap Team. All Rights Reserved.