org.opends.server.replication.plugin
Class PendingChanges

java.lang.Object
  extended by org.opends.server.replication.plugin.PendingChanges

public class PendingChanges
extends java.lang.Object

This class is use to store the list of local operations currently in progress and not yet committed in the database. It is used to make sure that operations are sent to the Replication Server in the order defined by their ChangeNumber. It is also used to update the ServerState at the appropriate time. On object of this class is instanciated for each ReplicationDomain.


Constructor Summary
PendingChanges(ChangeNumberGenerator changeNumberGenerator, ReplicationBroker broker, ServerState state)
          Creates a new PendingChanges using the provided ChangeNumberGenerator.
 
Method Summary
 void commit(ChangeNumber changeNumber)
          Mark an update message as committed.
 void commit(ChangeNumber changeNumber, UpdateMessage msg)
          Mark an update message as committed.
 int pushCommittedChanges()
          Push all committed local changes to the replicationServer service.
 ChangeNumber putLocalOperation(PluginOperation operation)
          Add a new UpdateMessage to the pending list from the provided local operation.
 UpdateMessage remove(ChangeNumber changeNumber)
          Remove and return an update form the pending changes list.
 int size()
          Returns the number of update currently in the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PendingChanges

public PendingChanges(ChangeNumberGenerator changeNumberGenerator,
                      ReplicationBroker broker,
                      ServerState state)
Creates a new PendingChanges using the provided ChangeNumberGenerator.

Parameters:
changeNumberGenerator - The ChangeNumberGenerator to use to create new unique ChangeNumbers.
broker - The Replicationbroker that will be used to send UpdateMessage.
state - The ServerState that will be updated when UpdateMessage are committed.
Method Detail

remove

public UpdateMessage remove(ChangeNumber changeNumber)
Remove and return an update form the pending changes list.

Parameters:
changeNumber - The ChangeNumber of the update to remove.
Returns:
The UpdateMessage that was just removed.

size

public int size()
Returns the number of update currently in the list.

Returns:
The number of update currently in the list.

commit

public void commit(ChangeNumber changeNumber,
                   UpdateMessage msg)
Mark an update message as committed.

Parameters:
changeNumber - The ChangeNumber of the update message that must be set as committed.
msg - The message associated to the update.

commit

public void commit(ChangeNumber changeNumber)
Mark an update message as committed.

Parameters:
changeNumber - The ChangeNumber of the update message that must be set as committed.

putLocalOperation

public ChangeNumber putLocalOperation(PluginOperation operation)
Add a new UpdateMessage to the pending list from the provided local operation.

Parameters:
operation - The local operation for which an UpdateMessage mus be added in the pending list.
Returns:
The ChangeNumber now associated to the operation.

pushCommittedChanges

public int pushCommittedChanges()
Push all committed local changes to the replicationServer service.

Returns:
The number of pushed updates.