org.opends.server.replication.server
Class MsgQueue

java.lang.Object
  extended by org.opends.server.replication.server.MsgQueue

public class MsgQueue
extends java.lang.Object

This class is used to build ordered lists of UpdateMessage. The order is defined by the order of the ChangeNumber of the UpdateMessage.


Constructor Summary
MsgQueue()
           
 
Method Summary
 void add(UpdateMessage update)
          Add an UpdateMessage to this MessageQueue.
 void clear()
          Removes all UpdateMessage form this queue.
 boolean contains(UpdateMessage msg)
          Returns true if this map contains an UpdateMessage with the same ChangeNumber as the given UpdateMessage.
 UpdateMessage first()
          Return the first UpdateMessage in the MsgQueue.
 boolean isEmpty()
          Returns true if this MsgQueue contains no UpdateMessage.
 UpdateMessage last()
          Return the last UpdateMessage in the MsgQueue.
 UpdateMessage removeFirst()
          Get and remove the first UpdateMessage in this MessageQueue.
 int size()
          Returns the number of elements in this MsgQueue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MsgQueue

public MsgQueue()
Method Detail

first

public UpdateMessage first()
Return the first UpdateMessage in the MsgQueue.

Returns:
The first UpdateMessage in the MsgQueue.

last

public UpdateMessage last()
Return the last UpdateMessage in the MsgQueue.

Returns:
The last UpdateMessage in the MsgQueue.

size

public int size()
Returns the number of elements in this MsgQueue.

Returns:
The number of elements in this MsgQueue.

isEmpty

public boolean isEmpty()
Returns true if this MsgQueue contains no UpdateMessage.

Returns:
true if this MsgQueue contains no UpdateMessage.

add

public void add(UpdateMessage update)
Add an UpdateMessage to this MessageQueue.

Parameters:
update - The UpdateMessage to add to this MessageQueue.

removeFirst

public UpdateMessage removeFirst()
Get and remove the first UpdateMessage in this MessageQueue.

Returns:
The first UpdateMessage in this MessageQueue.

contains

public boolean contains(UpdateMessage msg)
Returns true if this map contains an UpdateMessage with the same ChangeNumber as the given UpdateMessage.

Parameters:
msg - UpdateMessage whose presence in this queue is to be tested.
Returns:
true if this map contains an UpdateMessage with the same ChangeNumber as the given UpdateMessage.

clear

public void clear()
Removes all UpdateMessage form this queue.