org.opends.server.replication.server
Class LightweightServerHandler

java.lang.Object
  extended by java.lang.Thread
      extended by org.opends.server.api.DirectoryThread
          extended by org.opends.server.api.MonitorProvider<MonitorProviderCfg>
              extended by org.opends.server.replication.server.LightweightServerHandler
All Implemented Interfaces:
java.lang.Runnable

public class LightweightServerHandler
extends MonitorProvider<MonitorProviderCfg>

This class defines a server handler dedicated to the remote LDAP servers connected to a remote Replication Server. This class is necessary because we want to provide monitor entries for them and because the monitor API only allows one entry by MonitorProvider instance so that no other class can provide the monitor entry for these objects. One instance of this class is created for each instance of remote LDAP server connected to a remote 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
LightweightServerHandler(java.lang.String serverId, ServerHandler replServerHandler)
          Creates a new LighweightServerHandler with the provided serverid, connected to the remote Replication Server represented by replServerHandler.
 
Method Summary
 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.
 short getServerId()
          Get the serverID associated with this LDAP server.
 long getUpdateInterval()
          Retrieves the length of time in milliseconds that should elapse between calls to the updateMonitorData() method.
 void initializeMonitorProvider(MonitorProviderCfg configuration)
          Initializes this monitor provider based on the information in the provided configuration entry.
 void startHandler()
          Stop this server handler processing.
 void stopHandler()
          Stop this server handler processing.
 void updateMonitorData()
          Performs any processing periodic processing that may be desired to update the information associated with this monitor.
 
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, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LightweightServerHandler

public LightweightServerHandler(java.lang.String serverId,
                                ServerHandler replServerHandler)
Creates a new LighweightServerHandler with the provided serverid, connected to the remote Replication Server represented by replServerHandler.

Parameters:
serverId - The serverId of this remote LDAP server.
replServerHandler - The server handler of the Replication Server to which this LDAP server is remotely connected.
Method Detail

getServerId

public short getServerId()
Get the serverID associated with this LDAP server.

Returns:
The serverId.

startHandler

public void startHandler()
Stop this server handler processing.


stopHandler

public void stopHandler()
Stop this server handler processing.


initializeMonitorProvider

public void initializeMonitorProvider(MonitorProviderCfg configuration)
                               throws ConfigException,
                                      InitializationException
Initializes this monitor provider based on the information in the provided configuration entry.

Specified by:
initializeMonitorProvider in class MonitorProvider<MonitorProviderCfg>
Parameters:
configuration - The configuration to use to initialize this monitor provider.
Throws:
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.

getMonitorInstanceName

public java.lang.String getMonitorInstanceName()
Retrieves the name of this monitor provider. It should be unique among all monitor providers, including all instances of the same monitor provider.

Specified by:
getMonitorInstanceName in class MonitorProvider<MonitorProviderCfg>
Returns:
The name of this monitor provider.

getUpdateInterval

public long getUpdateInterval()
Retrieves the length of time in milliseconds that should elapse between calls to the updateMonitorData() method. A negative or zero return value indicates that the updateMonitorData() method should not be periodically invoked.

Specified by:
getUpdateInterval in class MonitorProvider<MonitorProviderCfg>
Returns:
The length of time in milliseconds that should elapse between calls to the updateMonitorData() method.

updateMonitorData

public void updateMonitorData()
Performs any processing periodic processing that may be desired to update the information associated with this monitor. Note that best-effort attempts will be made to ensure that calls to this method come getUpdateInterval() milliseconds apart, but no guarantees will be made.

Specified by:
updateMonitorData in class MonitorProvider<MonitorProviderCfg>

getMonitorData

public 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.

Specified by:
getMonitorData in class MonitorProvider<MonitorProviderCfg>
Returns:
A set of attributes containing monitor data that should be returned to the client if the corresponding monitor entry is requested.