|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.opends.server.api.DirectoryThread
org.opends.server.api.MonitorProvider<MonitorProviderCfg>
org.opends.server.replication.server.ServerHandler
public class ServerHandler
This class defines a server handler, which handles all interaction with a replication server.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ServerHandler(ProtocolSession session,
int queueSize)
Creates a new server handler instance with the provided socket. |
Method Summary | |
---|---|
void |
ack(AckMessage message,
short ackingServerId)
Do the work when an ack message has been received from another server. |
static void |
ackChangelog(AckMessage message,
short ackingServerId)
Process reception of an for an update that was received from a ReplicationServer. |
void |
add(UpdateMessage update,
ServerHandler sourceHandler)
Add an update the list of updates that must be sent to the server managed by this ServerHandler. |
void |
addWaitingAck(UpdateMessage update,
int nbWaitedAck)
Add an update to the list of update waiting for acks. |
static void |
addWaitingAck(UpdateMessage update,
short ChangelogServerId,
ReplicationServerDomain replicationServerDomain,
int nbWaitedAck)
Add an update to the list of update received from a replicationServer and waiting for acks. |
void |
checkWindow()
Check the protocol window and send WindowMessage if necessary. |
void |
decAndCheckWindow()
Decrement the protocol window, then check if it is necessary to send a WindowMessage and send it. |
void |
forwardGenerationIdToRS(ResetGenerationId msg)
Sends a message containing a generationId to a peer server. |
long |
getApproxDelay()
Get an approximation of the delay by looking at the age of the oldest message that has not been sent to this server. |
java.lang.Long |
getApproxFirstMissingDate()
Get the age of the older change that has not yet been replicated to the server handled by this ServerHandler. |
java.util.Set<java.lang.Short> |
getConnectedServerIds()
Return a Set containing the servers known by this replicationServer. |
ReplicationServerDomain |
getDomain()
Returns the Replication Server Domain to which belongs this server handler. |
long |
getGenerationId()
Returns the value of generationId for that handler. |
long |
getHeartbeatInterval()
Get our heartbeat interval. |
int |
getInAckCount()
Get the number of Ack received from the server managed by this handler. |
int |
getInCount()
Get the count of updates received from the server. |
java.util.ArrayList<Attribute> |
getMonitorData()
Retrieves a set of attributes containing monitor data that should be returned to the client if the corresponding monitor entry is requested. |
java.lang.String |
getMonitorInstanceName()
Retrieves the name of this monitor provider. |
ChangeNumber |
getOlderUpdateCN()
Get the older Change Number for that server. |
long |
getOlderUpdateTime()
Get the older update time for that server. |
int |
getOutAckCount()
Get the number of Ack sent to the server managed by this handler. |
int |
getOutCount()
Get the count of updates sent to this server. |
int |
getRcvMsgQueueSize()
Get the number of message in the receive message queue. |
java.lang.String |
getServerAddressURL()
Retrieves the Address URL for this server handler. |
short |
getServerId()
get the Server Id. |
ServerState |
getServerState()
Get the state of this server. |
java.lang.String |
getServerURL()
Retrieves the URL for this server handler. |
long |
getUpdateInterval()
Retrieves the length of time in milliseconds that should elapse between calls to the updateMonitorData() method. |
int |
getWaitingAckSize()
Get the size of the list of update waiting for acks. |
boolean |
hasRemoteLDAPServers()
When the handler is connected to a replication server, specifies the replication server has remote LDAP servers connected to it. |
void |
incrementInAckCount()
Increment the count of Acks received from this server. |
void |
incrementInCount()
Increase the counter of update received from the server. |
void |
incrementOutCount()
Increase the counter of updates sent to the server. |
void |
initializeMonitorProvider(MonitorProviderCfg configuration)
Initializes this monitor provider based on the information in the provided configuration entry. |
boolean |
isFollowing()
Check if the LDAP server can follow the speed of the other servers. |
boolean |
isLDAPserver()
Check type of server handled. |
boolean |
isRemoteLDAPServer(short wantedServer)
When this handler is connected to a replication server, specifies if a wanted server is connected to this replication server. |
boolean |
isReplicationServer()
Check if the server associated to this ServerHandler is a replication server. |
boolean |
isSaturated(ChangeNumber changeNumber,
ServerHandler sourceHandler)
Check is this server is saturated (this server has already been sent a bunch of updates and has not processed them so they are staying in the message queue for this server an the size of the queue for this server is above the configured limit. |
void |
process(RoutableMessage msg)
Processes a routable message. |
void |
process(WindowProbe windowProbeMsg)
Process the reception of a WindowProbe message. |
void |
receiveReplServerInfo(ReplServerInfoMessage infoMsg)
Sets the replication server from the message provided. |
boolean |
restartAfterSaturation(ServerHandler source)
Check that the size of the Server Handler messages Queue has lowered below the limit and therefore allowing the reception of messages from other servers to restart. |
void |
send(RoutableMessage msg)
Send an InitializeRequestMessage to the server connected through this handler. |
void |
sendAck(ChangeNumber changeNumber)
Send the ack to the server that did the original modification. |
void |
sendError(ErrorMessage errorMsg)
Send an ErrorMessage to the peer. |
void |
sendInfo(ReplServerInfoMessage info)
Sends the provided ReplServerInfoMessage. |
void |
setFollowing(boolean following)
Set the following flag of this server. |
void |
setGenerationId(long generationId)
Set a new generation ID. |
void |
shutdown()
Shutdown This ServerHandler. |
void |
start(DN baseDn,
short replicationServerId,
java.lang.String replicationServerURL,
int windowSize,
boolean sslEncryption,
ReplicationServer replicationServer)
Do the exchange of start messages to know if the remote server is an LDAP or replication server and to exchange serverID. |
void |
stopHandler()
Stop this server handler processing. |
UpdateMessage |
take()
Select the next update that must be sent to the server managed by this ServerHandler. |
java.lang.String |
toString()
|
void |
updateMonitorData()
Performs any processing periodic processing that may be desired to update the information associated with this monitor. |
boolean |
updateServerState(UpdateMessage msg)
Update the serverState with the last message sent. |
void |
updateWindow(WindowMessage windowMsg)
Update the send window size based on the credit specified in the given window message. |
void |
warnBadGenerationId()
Resets the generationId for this domain. |
Methods inherited from class org.opends.server.api.MonitorProvider |
---|
finalizeMonitorProvider, getMonitorObjectClass, isConfigurationAcceptable, run |
Methods inherited from class org.opends.server.api.DirectoryThread |
---|
getAssociatedTask, getCreationStackTrace, getDebugProperties, getParentThread, setAssociatedTask |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ServerHandler(ProtocolSession session, int queueSize)
session
- The ProtocolSession used by the ServerHandler to
communicate with the remote entity.queueSize
- The maximum number of update that will be kept
in memory by this ServerHandler.Method Detail |
---|
public void start(DN baseDn, short replicationServerId, java.lang.String replicationServerURL, int windowSize, boolean sslEncryption, ReplicationServer replicationServer)
baseDn
- baseDn of the ServerHandler when this is an outgoing conn.
null if this is an incoming connection (listen).replicationServerId
- The identifier of the replicationServer that
creates this server handler.replicationServerURL
- The URL of the replicationServer that creates
this server handler.windowSize
- the window size that this server handler must use.sslEncryption
- For outgoing connections indicates whether encryption
should be used after the exchange of start messages.
Ignored for incoming connections.replicationServer
- the ReplicationServer that created this server
handler.public short getServerId()
public java.lang.String getServerAddressURL()
public java.lang.String getServerURL()
public void incrementOutCount()
public void incrementInCount()
public int getInCount()
public int getOutCount()
public int getInAckCount()
public int getOutAckCount()
public boolean isSaturated(ChangeNumber changeNumber, ServerHandler sourceHandler)
changeNumber
- The changenumber to use to make the delay calculations.sourceHandler
- The ServerHandler which is sending the update.
public boolean restartAfterSaturation(ServerHandler source)
source
- The ServerHandler which was sending the update.
can be null.
public boolean isReplicationServer()
public int getRcvMsgQueueSize()
public long getApproxDelay()
public java.lang.Long getApproxFirstMissingDate()
public long getOlderUpdateTime()
public ChangeNumber getOlderUpdateCN()
public boolean isFollowing()
public void setFollowing(boolean following)
following
- the value that should be set.public void add(UpdateMessage update, ServerHandler sourceHandler)
update
- The update that must be added to the list of updates.sourceHandler
- The server that sent the update.public UpdateMessage take()
public boolean updateServerState(UpdateMessage msg)
msg
- the last update sent.
public ServerState getServerState()
public void stopHandler()
public void sendAck(ChangeNumber changeNumber) throws java.io.IOException
changeNumber
- The ChangeNumber of the update that is acked.
java.io.IOException
- In case of Exception thrown sending the ack.public void ack(AckMessage message, short ackingServerId)
message
- The ack message that was received.ackingServerId
- The id of the server that acked the change.public static void ackChangelog(AckMessage message, short ackingServerId)
message
- the ack message that was received.ackingServerId
- The id of the server that acked the change.public void addWaitingAck(UpdateMessage update, int nbWaitedAck)
update
- the update that must be added to the listnbWaitedAck
- The number of ack that must be received before
the update is fully acked.public static void addWaitingAck(UpdateMessage update, short ChangelogServerId, ReplicationServerDomain replicationServerDomain, int nbWaitedAck)
update
- The update that must be added to the list.ChangelogServerId
- The identifier of the replicationServer that sent
the update.replicationServerDomain
- The ReplicationServerDomain from which the
change was processed and to which the ack
must later be sent.nbWaitedAck
- The number of ack that must be received before
the update is fully acked.public int getWaitingAckSize()
public void incrementInAckCount()
public boolean isLDAPserver()
public void initializeMonitorProvider(MonitorProviderCfg configuration) throws ConfigException, InitializationException
initializeMonitorProvider
in class MonitorProvider<MonitorProviderCfg>
configuration
- The configuration to use to initialize
this monitor provider.
ConfigException
- If an unrecoverable problem arises in
the process of performing the
initialization.
InitializationException
- If a problem occurs during
initialization that is not
related to the server
configuration.public java.lang.String getMonitorInstanceName()
getMonitorInstanceName
in class MonitorProvider<MonitorProviderCfg>
public long getUpdateInterval()
updateMonitorData()
method. A negative or zero
return value indicates that the updateMonitorData()
method
should not be periodically invoked.
getUpdateInterval
in class MonitorProvider<MonitorProviderCfg>
updateMonitorData()
method.public void updateMonitorData()
getUpdateInterval()
milliseconds apart, but no guarantees will
be made.
updateMonitorData
in class MonitorProvider<MonitorProviderCfg>
public java.util.ArrayList<Attribute> getMonitorData()
getMonitorData
in class MonitorProvider<MonitorProviderCfg>
public void shutdown()
public java.lang.String toString()
toString
in class java.lang.Thread
public void decAndCheckWindow() throws java.io.IOException
java.io.IOException
- when the session becomes unavailable.public void checkWindow() throws java.io.IOException
java.io.IOException
- when the session becomes unavailable.public void updateWindow(WindowMessage windowMsg)
windowMsg
- The Window Message containing the information
necessary for updating the window size.public long getHeartbeatInterval()
public void process(RoutableMessage msg)
msg
- The message to be processed.public void sendInfo(ReplServerInfoMessage info) throws java.io.IOException
info
- The ReplServerInfoMessage message to be sent.
java.io.IOException
- When it occurs while sending the message,public void receiveReplServerInfo(ReplServerInfoMessage infoMsg)
infoMsg
- The information message.public boolean isRemoteLDAPServer(short wantedServer)
wantedServer
- The server we want to know if it is connected
to the replication server represented by this handler.
public boolean hasRemoteLDAPServers()
public void send(RoutableMessage msg) throws java.io.IOException
msg
- The message to be processed
java.io.IOException
- when raised by the underlying sessionpublic void sendError(ErrorMessage errorMsg) throws java.io.IOException
errorMsg
- The message to be sent
java.io.IOException
- when raised by the underlying sessionpublic void process(WindowProbe windowProbeMsg) throws java.io.IOException
windowProbeMsg
- The message to process.
java.io.IOException
- When the session becomes unavailable.public long getGenerationId()
public void warnBadGenerationId()
public void forwardGenerationIdToRS(ResetGenerationId msg) throws java.io.IOException
msg
- The GenerationIdMessage message to be sent.
java.io.IOException
- When it occurs while sending the message,public void setGenerationId(long generationId)
generationId
- The new generation IDpublic ReplicationServerDomain getDomain()
public java.util.Set<java.lang.Short> getConnectedServerIds()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |