public class ReplicationServerDomain extends MonitorProvider<org.forgerock.opendj.server.config.server.MonitorProviderCfg>
Constructor and Description |
---|
ReplicationServerDomain(org.forgerock.opendj.ldap.Dn baseDN,
ReplicationServer localReplicationServer)
Creates a new ReplicationServerDomain associated to the baseDN.
|
Modifier and Type | Method and Description |
---|---|
long |
changeGenerationId(long generationId)
Sets the provided value as the new in memory generationId.
|
MonitorMsg |
createGlobalTopologyMonitorMsg(int sender,
int destination)
Creates a new monitor message including monitoring information for the
whole topology.
|
TopologyMsg |
createTopologyMsgForDS(int destDsId)
Creates a TopologyMsg filled with information to be sent to a DS.
|
TopologyMsg |
createTopologyMsgForRS()
Creates a TopologyMsg filled with information to be sent to a remote RS.
|
org.forgerock.opendj.ldap.Dn |
getBaseDN()
Get the baseDN.
|
Map<Integer,DataServerHandler> |
getConnectedDSs()
Get the map of connected DSs.
|
Map<Integer,ReplicationServerHandler> |
getConnectedRSs()
Get the map of connected RSs.
|
DBCursor<UpdateMsg> |
getCursorFrom(ServerState startAfterServerState)
Creates and returns a cursor across this replication domain.
|
long |
getGenerationId()
Get the generationId associated to this domain.
|
ServerState |
getLatestServerState()
Returns the latest most current ServerState describing the newest CSNs for
each server in this domain.
|
MonitorData |
getMonitorData()
Retrieves a set of attributes containing monitor data that should
be returned to the client if the corresponding monitor entry is
requested.
|
String |
getMonitorInstanceName()
Retrieves the name of this monitor provider.
|
ServerState |
getOldestState()
Returns the oldest known state for the domain, made of the oldest CSN
stored for each serverId.
|
boolean |
hasLock()
Tests if the current thread has the lock on this domain.
|
void |
initGenerationID(long generationId)
Initialize the value of the generationID for this ReplicationServerDomain.
|
void |
initializeMonitorProvider(org.forgerock.opendj.server.config.server.MonitorProviderCfg configuraiton)
Initializes this monitor provider based on the information in the provided configuration entry.
|
boolean |
isAlreadyConnectedToDS(DataServerHandler dsHandler)
Checks whether it is already connected to a DS with same id.
|
boolean |
isAlreadyConnectedToRS(ReplicationServerHandler rsHandler)
Checks whether a remote RS is already connected to this hosting RS.
|
boolean |
isDegradedDueToGenerationId(int 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.
|
void |
lock()
Takes the lock on this domain (blocking until lock can be acquired) or
calling thread is interrupted.
|
void |
processNewStatus(DataServerHandler senderHandler,
ChangeStatusMsg csMsg)
Process message of a remote server changing his status.
|
void |
put(UpdateMsg updateMsg,
ServerHandler sourceHandler)
Add an update that has been received to the list of
updates that must be forwarded to all other servers.
|
void |
receiveTopoInfoFromRS(TopologyMsg topoMsg,
ReplicationServerHandler rsHandler,
boolean allowResetGenId)
Process topology information received from a peer RS.
|
void |
register(DataServerHandler dsHandler)
Registers a DS handler into this domain and notifies the domain about the
new DS.
|
void |
register(ReplicationServerHandler rsHandler)
Registers the RS handler into this domain and notifies the domain.
|
void |
release()
Releases the lock on this domain.
|
void |
resetGenerationId(ServerHandler senderHandler,
ResetGenerationIdMsg genIdMsg)
Resets the generationID.
|
void |
sendTopoInfoToAll()
Update every peers (RS/DS) with topology changes.
|
void |
shutdown()
Shutdown this ReplicationServerDomain.
|
void |
stopAllServers(boolean shutdown)
Stop operations with all servers this domain is connected with (RS and DS).
|
void |
stopReplicationServers(Collection<HostPort> serversToDisconnect)
Stop operations with a list of replication servers.
|
void |
stopServer(ServerHandler sHandler,
boolean shutdown)
Stop operations with a given server.
|
String |
toString() |
boolean |
tryLock(long timeout)
Tries to acquire the lock on the domain within a given amount of time.
|
finalizeMonitorProvider, getMonitorObjectClass, isConfigurationAcceptable, scheduleUpdate
public ReplicationServerDomain(org.forgerock.opendj.ldap.Dn baseDN, ReplicationServer localReplicationServer)
baseDN
- The baseDN associated to the ReplicationServerDomain.localReplicationServer
- the ReplicationServer that created this instance.public void put(UpdateMsg updateMsg, ServerHandler sourceHandler) throws IOException
updateMsg
- The update that has been received.sourceHandler
- The ServerHandler for the server from which the
update was receivedIOException
- When an IO exception happens during the update
processing.public void stopReplicationServers(Collection<HostPort> serversToDisconnect)
serversToDisconnect
- the replication servers addresses for which we want to stop
operationspublic void stopAllServers(boolean shutdown)
shutdown
- A boolean indicating if the stop is due to a
shutdown condition.public boolean isAlreadyConnectedToDS(DataServerHandler dsHandler)
dsHandler
- the DS we want to checkpublic void stopServer(ServerHandler sHandler, boolean shutdown)
sHandler
- the server for which we want to stop operations.shutdown
- A boolean indicating if the stop is due to a
shutdown condition.public boolean isAlreadyConnectedToRS(ReplicationServerHandler rsHandler) throws DirectoryException
rsHandler
- The handler for the remote RS.DirectoryException
- when a problem occurs.public DBCursor<UpdateMsg> getCursorFrom(ServerState startAfterServerState) throws ChangelogException
Client code must call DBCursor.next()
to advance the cursor to the
next available record.
When the cursor is not used anymore, client code MUST call the
DBCursor.close()
method to free the resources and locks used by the
cursor.
startAfterServerState
- Starting point for the replicaDB cursors. If null, start from the
oldest CSNDBCursor
going from oldest to newest CSNChangelogException
- If a database problem happenedReplicationDomainDB#getCursorFrom(Dn, ServerState, CursorOptions)
public org.forgerock.opendj.ldap.Dn getBaseDN()
public MonitorMsg createGlobalTopologyMonitorMsg(int sender, int destination) throws InterruptedException
sender
- The sender of this message.destination
- The destination of this message.InterruptedException
- if this thread is interrupted while waiting for a responsepublic void shutdown()
public ServerState getLatestServerState()
public TopologyMsg createTopologyMsgForRS()
public TopologyMsg createTopologyMsgForDS(int destDsId)
destDsId
- The id of the DS the TopologyMsg PDU is to be sent to and
that we must not include in the DS list.public long getGenerationId()
public void initGenerationID(long generationId)
generationId
- The new value of generationId.public long changeGenerationId(long generationId)
generationId
- The new value of generationId.public void resetGenerationId(ServerHandler senderHandler, ResetGenerationIdMsg genIdMsg)
senderHandler
- The handler associated to the server
that requested to reset the generationId.genIdMsg
- The reset generation ID msg received.public void processNewStatus(DataServerHandler senderHandler, ChangeStatusMsg csMsg)
senderHandler
- The handler associated to the server
that changed his status.csMsg
- The message containing the new statuspublic void sendTopoInfoToAll()
public boolean isDegradedDueToGenerationId(int serverId)
serverId
- The serverId for which we want to know the
the state.public void receiveTopoInfoFromRS(TopologyMsg topoMsg, ReplicationServerHandler rsHandler, boolean allowResetGenId) throws IOException, DirectoryException
topoMsg
- The just received topo message from remote RSrsHandler
- The handler that received the message.allowResetGenId
- True for allowing to reset the generation id (
when called after initial handshake)IOException
- If an error occurred.DirectoryException
- If an error occurred.public Map<Integer,DataServerHandler> getConnectedDSs()
public Map<Integer,ReplicationServerHandler> getConnectedRSs()
public boolean hasLock()
public void lock() throws InterruptedException
InterruptedException
- If interrupted.public void release()
public boolean tryLock(long timeout) throws InterruptedException
timeout
- The amount of milliseconds to wait for acquiring the lock.InterruptedException
- When call was interrupted.public void initializeMonitorProvider(org.forgerock.opendj.server.config.server.MonitorProviderCfg configuraiton)
MonitorProvider
initializeMonitorProvider
in class MonitorProvider<org.forgerock.opendj.server.config.server.MonitorProviderCfg>
configuraiton
- The configuration to use to initialize this monitor provider.public String getMonitorInstanceName()
MonitorProvider
getMonitorInstanceName
in class MonitorProvider<org.forgerock.opendj.server.config.server.MonitorProviderCfg>
public MonitorData getMonitorData()
MonitorProvider
getMonitorData
in class MonitorProvider<org.forgerock.opendj.server.config.server.MonitorProviderCfg>
public ServerState getOldestState()
Note: Because the replication changelogDB trimming always keep one change whatever its date, the CSN contained in the returned state can be very old.
public void register(DataServerHandler dsHandler)
dsHandler
- The Directory Server Handler to registerpublic void register(ReplicationServerHandler rsHandler)
rsHandler
- The Replication Server Handler to registerCopyright © 2010-2017 ForgeRock AS. All Rights Reserved.