org.opends.server.replication.plugin
Class PersistentServerState

java.lang.Object
  extended by org.opends.server.replication.common.ServerState
      extended by org.opends.server.replication.plugin.PersistentServerState
All Implemented Interfaces:
java.lang.Iterable<java.lang.Short>

public class PersistentServerState
extends ServerState

This class implements a ServerState that is stored on the backends used to store the synchronized data and that is therefore persistent accross server reboot.


Field Summary
protected static java.lang.String REPLICATION_STATE
          The attribute name used to store the state in the backend.
 
Constructor Summary
PersistentServerState(DN baseDn, short serverId)
          create a new ServerState.
 
Method Summary
 void checkAndUpdateServerState()
          The ServerState is saved to the database periodically, therefore in case of crash it is possible that is does not contain the latest changes that have been processed and saved to the database.
 void clear()
          Empty the ServerState.
 void clearInMemory()
          Empty the ServerState.
 void loadState()
          Load the ServerState from the backing entry in database to memory.
 void save()
          Save this object to persistent storage.
 boolean update(ChangeNumber changeNumber)
          Update the Server State with a ChangeNumber.
 
Methods inherited from class org.opends.server.replication.common.ServerState
cover, duplicate, getBytes, getMaxChangeNumber, isEmpty, iterator, toASN1ArrayList, toString, toStringSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REPLICATION_STATE

protected static final java.lang.String REPLICATION_STATE
The attribute name used to store the state in the backend.

See Also:
Constant Field Values
Constructor Detail

PersistentServerState

public PersistentServerState(DN baseDn,
                             short serverId)
create a new ServerState.

Parameters:
baseDn - The baseDN for which the ServerState is created
serverId - The serverId
Method Detail

update

public boolean update(ChangeNumber changeNumber)
Update the Server State with a ChangeNumber. All operations with smaller CSN and the same serverID must be committed before calling this method.

Overrides:
update in class ServerState
Parameters:
changeNumber - the committed ChangeNumber.
Returns:
a boolean indicating if the update was meaningfull.

save

public void save()
Save this object to persistent storage.


loadState

public void loadState()
Load the ServerState from the backing entry in database to memory.


clearInMemory

public void clearInMemory()
Empty the ServerState. After this call the Server State will be in the same state as if it was just created.


clear

public void clear()
Empty the ServerState. After this call the Server State will be in the same state as if it was just created.

Overrides:
clear in class ServerState

checkAndUpdateServerState

public final void checkAndUpdateServerState()
The ServerState is saved to the database periodically, therefore in case of crash it is possible that is does not contain the latest changes that have been processed and saved to the database. In order to make sure that we don't loose them, search all the entries that have been updated after this entry. This is done by using the HistoricalCsnOrderingMatchingRule and an ordering index for historical attribute