|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.replication.server.ReplicationServerDomain
public class ReplicationServerDomain
This class define an in-memory cache that will be used to store the messages that have been received from an LDAP server or from another replication server and that should be forwarded to other servers. The size of the cache is set by configuration. If the cache becomes bigger than the configured size, the older messages are removed and should they be needed again must be read from the backing file it runs a thread that is responsible for saving the messages received to the disk and for trimming them Decision to trim can be based on disk space or age of the message
Constructor Summary | |
---|---|
ReplicationServerDomain(DN baseDn,
ReplicationServer replicationServer)
Creates a new ReplicationServerDomain associated to the DN baseDn. |
Method Summary | |
---|---|
void |
ack(AckMessage message,
short fromServerId)
Add an ack to the list of ack received for a given change. |
void |
checkAllSaturation()
Check if some server Handler should be removed from flow control state. |
void |
clearDbs()
Clears the Db associated with that cache. |
DN |
getBaseDn()
Get the baseDn. |
ReplicationIterator |
getChangelogIterator(short serverId,
ChangeNumber changeNumber)
Creates and returns an iterator. |
java.util.Set<java.lang.String> |
getChangelogs()
Return a Set of String containing the lists of Replication servers connected to this server. |
long |
getChangesCount()
Returns the change count for that ReplicationServerDomain. |
java.util.List<java.lang.String> |
getConnectedLDAPservers()
Returns as a set of String the list of LDAP servers connected to us. |
ServerState |
getDbServerState()
Returns the ServerState describing the last change from this replica. |
protected java.util.List<ServerHandler> |
getDestinationServers(RoutableMessage msg,
ServerHandler senderHandler)
Retrieves the destination handlers for a routable message. |
long |
getGenerationId()
Get the generationId associated to this domain. |
boolean |
getGenerationIdSavedStatus()
Get the generationId saved status. |
protected MonitorData |
getMonitorData()
Retrieves the global monitor data. |
ReplicationServer |
getReplicationServer()
Return the associated replication server. |
java.util.Set<java.lang.Short> |
getServers()
Return a Set containing the servers known by this replicationServer. |
boolean |
isDegradedDueToGenerationId(short serverId)
Returns whether the provided server is in degraded state due to the fact that the peer server has an invalid generationId for this domain. |
protected void |
mayResetGenerationId()
Resets the generationId for this domain if there is no LDAP server currently connected and if the generationId has never been saved. |
void |
process(RoutableMessage msg,
ServerHandler senderHandler)
Processes a message coming from one server in the topology and potentially forwards it to one or all other servers. |
void |
put(UpdateMessage update,
ServerHandler sourceHandler)
Add an update that has been received to the list of updates that must be forwarded to all other servers. |
void |
receiveReplServerInfo(ReplServerInfoMessage infoMsg,
ServerHandler handler)
Process reception of a ReplServerInfoMessage. |
void |
receivesMonitorDataResponse(MonitorMessage msg)
Processes a Monitor message receives from a remote Replication Server and stores the data received. |
void |
resetGenerationId(ServerHandler senderHandler,
ResetGenerationId genIdMsg)
Resets the generationID. |
boolean |
restartAfterSaturation(ServerHandler sourceHandler)
Check if a server that was in flow control can now restart sending updates. |
void |
sendAck(ChangeNumber changeNumber,
boolean isLDAPserver)
Send back an ack to the server that sent the change. |
void |
sendAck(ChangeNumber changeNumber,
boolean isLDAPserver,
short serverId)
Send back an ack to a server that sent the change. |
protected short |
sendMonitorDataRequest()
Sends a MonitorRequest message to all connected RS. |
void |
setDbHandler(short serverId,
DbHandler dbHandler)
Sets the provided DbHandler associated to the provided serverId. |
void |
setGenerationId(long generationId,
boolean savedStatus)
Sets the provided value as the new in memory generationId. |
void |
shutdown()
Shutdown this ReplicationServerDomain. |
boolean |
startReplicationServer(ServerHandler handler)
Create initialize context necessary for finding the changes that must be sent to a given replication server. |
boolean |
startServer(ServerHandler handler)
Create initialize context necessary for finding the changes that must be sent to a given LDAP or replication server. |
void |
stopServer(ServerHandler handler)
Stop operations with a given server. |
UpdateMessage |
take(ServerHandler handler)
Get the next update that need to be sent to a given LDAP server. |
java.lang.String |
toString()
|
void |
waitDisconnection(short serverId)
Wait a short while for ServerId disconnection. |
protected void |
waitMonitorDataResponses(int expectedResponses)
Wait for the expected count of received MonitorMessage. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ReplicationServerDomain(DN baseDn, ReplicationServer replicationServer)
baseDn
- The baseDn associated to the ReplicationServerDomain.replicationServer
- the ReplicationServer that created this
replicationServer cache.Method Detail |
---|
public void put(UpdateMessage update, ServerHandler sourceHandler) throws java.io.IOException
update
- The update that has been received.sourceHandler
- The ServerHandler for the server from which the
update was received
java.io.IOException
- When an IO exception happens during the update
processing.public void waitDisconnection(short serverId)
serverId
- the serverId to be checked.public boolean startServer(ServerHandler handler) throws java.lang.Exception
handler
- handler for the server that must be started
java.lang.Exception
- when method has failedpublic void stopServer(ServerHandler handler)
handler
- the server for which we want to stop operationsprotected void mayResetGenerationId()
public boolean startReplicationServer(ServerHandler handler) throws java.lang.Exception
handler
- the server ID to which we want to forward changes
java.lang.Exception
- in case of errorspublic UpdateMessage take(ServerHandler handler)
handler
- The server handler for the target directory server.
public java.util.Set<java.lang.String> getChangelogs()
public java.util.Set<java.lang.Short> getServers()
public java.util.List<java.lang.String> getConnectedLDAPservers()
public ReplicationIterator getChangelogIterator(short serverId, ChangeNumber changeNumber)
serverId
- Identifier of the server for which the iterator is created.changeNumber
- Starting point for the iterator.
public long getChangesCount()
public DN getBaseDn()
public void setDbHandler(short serverId, DbHandler dbHandler) throws com.sleepycat.je.DatabaseException
serverId
- the serverId for the server to which is
associated the Dbhandler.dbHandler
- the dbHandler associated to the serverId.
com.sleepycat.je.DatabaseException
- If a database error happened.public void ack(AckMessage message, short fromServerId)
message
- The ack message received.fromServerId
- The identifier of the server that sent the ack.protected java.util.List<ServerHandler> getDestinationServers(RoutableMessage msg, ServerHandler senderHandler)
msg
- The message to route.senderHandler
- The handler of the server that published this message.
public void process(RoutableMessage msg, ServerHandler senderHandler)
msg
- The message received and to be processed.senderHandler
- The server handler of the server that emitted
the message.public void sendAck(ChangeNumber changeNumber, boolean isLDAPserver)
changeNumber
- The ChangeNumber of the change that must be acked.isLDAPserver
- This boolean indicates if the server that sent the
change was an LDAP server or a ReplicationServer.public void sendAck(ChangeNumber changeNumber, boolean isLDAPserver, short serverId)
changeNumber
- The ChangeNumber of the change that must be acked.isLDAPserver
- This boolean indicates if the server that sent the
change was an LDAP server or a ReplicationServer.serverId
- The identifier of the server from which we
received the change..public void shutdown()
public ServerState getDbServerState()
public java.lang.String toString()
toString
in class java.lang.Object
public void checkAllSaturation() throws java.io.IOException
java.io.IOException
- If an error happened.public boolean restartAfterSaturation(ServerHandler sourceHandler)
sourceHandler
- The server that must be checked.
public long getGenerationId()
public boolean getGenerationIdSavedStatus()
public void setGenerationId(long generationId, boolean savedStatus)
generationId
- The new value of generationId.savedStatus
- The saved status of the generationId.public void resetGenerationId(ServerHandler senderHandler, ResetGenerationId genIdMsg)
senderHandler
- The handler associated to the server
that requested to reset the generationId.genIdMsg
- The reset generation ID msg received.public void clearDbs()
public boolean isDegradedDueToGenerationId(short serverId)
serverId
- The serverId for which we want to know the
the state.
public ReplicationServer getReplicationServer()
public void receiveReplServerInfo(ReplServerInfoMessage infoMsg, ServerHandler handler) throws java.io.IOException
infoMsg
- The received message.handler
- The handler that received the message.
java.io.IOException
- when raised by the underlying session.protected MonitorData getMonitorData() throws DirectoryException
DirectoryException
- When an error occurs.protected short sendMonitorDataRequest() throws DirectoryException
DirectoryException
- when a problem occurs.protected void waitMonitorDataResponses(int expectedResponses) throws DirectoryException
expectedResponses
- The number of expected answers.
DirectoryException
- When an error occurs.public void receivesMonitorDataResponse(MonitorMessage msg)
msg
- The message to be processed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |