Class ReplicationServer

java.lang.Object
org.opends.server.replication.server.ReplicationServer
All Implemented Interfaces:
ConfigurationChangeListener<ReplicationServerCfg>, ChangelogContext

public final class ReplicationServer extends Object implements ConfigurationChangeListener<ReplicationServerCfg>, ChangelogContext
ReplicationServer Listener. This singleton is the main object of the replication server. It waits for the incoming connections and create listener and publisher objects for connection with LDAP servers and with replication servers It is responsible for creating the replication server replicationServerDomain and managing it
  • Constructor Details

    • ReplicationServer

      public ReplicationServer(ServerContext serverContext, ReplicationServerCfg cfg, ShutdownSynchronizer shutdownSync) throws ConfigException
      Creates a new Replication server using the provided configuration entry and shutdown synchronization object.
      Parameters:
      serverContext - The directory server context
      cfg - The configuration of this replication server.
      shutdownSync - Synchronization object for shutdown of combined DS/RS instances.
      Throws:
      ConfigException - When Configuration is invalid.
  • Method Details

    • getAllInstances

      public static List<ReplicationServer> getAllInstances()
      Returns the list of every replication servers instantiated in the current VM.
      Returns:
      the list of every replication servers instantiated in the current VM
    • initialize

      public void initialize() throws ConfigException
      Initialization function for the replicationServer.
      Throws:
      ConfigException - if initialization fails
    • getHealthStatus

      public HealthStatus getHealthStatus()
      Returns the health status for the replication server listeners.
      Returns:
      the health status for the replication server listeners
    • getReplicationServerDomain

      public ReplicationServerDomain getReplicationServerDomain(Dn baseDN)
      Get the ReplicationServerDomain associated to the base DN given in parameter.
      Parameters:
      baseDN - The base DN for which the ReplicationServerDomain must be returned
      Returns:
      The ReplicationServerDomain associated to the base DN given in parameter, or null if there is no ReplicationServerDomain associated to this baseDn
    • getOrCreateReplicationServerDomain

      public ReplicationServerDomain getOrCreateReplicationServerDomain(Dn baseDN)
      Get the ReplicationServerDomain associated to the base DN given in parameter.
      Parameters:
      baseDN - The base DN for which the ReplicationServerDomain must be returned.
      Returns:
      The ReplicationServerDomain associated to the base DN given in parameter, or null if there is no ReplicationServerDomain associated to this baseDn and the create parameter was false.
    • shutdown

      public void shutdown()
      Shutdown the Replication Server service and all its connections.
      Specified by:
      shutdown in interface ChangelogContext
    • getPurgeDelay

      public Duration getPurgeDelay()
      Returns the time interval after which changes must be deleted from the persistent storage.
      Specified by:
      getPurgeDelay in interface ChangelogContext
      Returns:
      the time interval after which changes must be deleted from the persistent storage
    • isConfigurationAcceptable

      public static boolean isConfigurationAcceptable(ReplicationServerCfg configuration, List<LocalizableMessage> unacceptableReasons)
      Check if the provided configuration is acceptable for add.
      Parameters:
      configuration - The configuration to check.
      unacceptableReasons - When the configuration is not acceptable, this table is use to return the reasons why this configuration is not acceptable.
      Returns:
      true if the configuration is acceptable, false other wise.
    • applyConfigurationChange

      public ConfigChangeResult applyConfigurationChange(ReplicationServerCfg configuration)
      Description copied from interface: ConfigurationChangeListener
      Applies the configuration changes to this change listener.
      Specified by:
      applyConfigurationChange in interface ConfigurationChangeListener<ReplicationServerCfg>
      Parameters:
      configuration - The new configuration containing the changes.
      Returns:
      Returns information about the result of changing the configuration.
    • isConfigurationChangeAcceptable

      public boolean isConfigurationChangeAcceptable(ReplicationServerCfg configuration, List<LocalizableMessage> unacceptableReasons)
      Description copied from interface: ConfigurationChangeListener
      Indicates whether the proposed change to the configuration is acceptable to this change listener.
      Specified by:
      isConfigurationChangeAcceptable in interface ConfigurationChangeListener<ReplicationServerCfg>
      Parameters:
      configuration - The new configuration containing the changes.
      unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
      Returns:
      Returns true if the proposed change is acceptable, or false if it is not.
    • getReplicationServerId

      public ReplicationServerId getReplicationServerId()
      Returns the replication server id.
      Specified by:
      getReplicationServerId in interface ChangelogContext
      Returns:
      the replication server id
    • remove

      public void remove()
      Do what needed when the config object related to this replication server is deleted from the server configuration.
    • getGroupId

      public GroupId getGroupId()
      Returns The replication server group id. Can be GroupId.DEFAULT_GROUP_ID if not defined, but never null.
      Returns:
      The replication server group id
    • getReplicationPort

      public int getReplicationPort()
      Returns the port used by this ReplicationServer.
      Returns:
      the port used by this ReplicationServer
    • getChangelogEndpoint

      public com.forgerock.opendj.util.HostPort getChangelogEndpoint()
      Get the HostPort of the changelog endpoint.
      Returns:
      the server host port of the changelog endpoint.
    • diskFullThresholdReached

      public void diskFullThresholdReached()
      Description copied from interface: ChangelogContext
      Notify the disk is full.
      Specified by:
      diskFullThresholdReached in interface ChangelogContext
    • failedToRestartAfterDiskFullRecovers

      public boolean failedToRestartAfterDiskFullRecovers()
      Description copied from interface: ChangelogContext
      Returns whether after disk space recovers, we should consider the disk still full for internal management..
      Specified by:
      failedToRestartAfterDiskFullRecovers in interface ChangelogContext
      Returns:
      whether after disk space recovers, we should consider the disk still full for internal management.
    • getWeight

      public int getWeight()
      Gets the weight affected to the replication server.

      Each replication server of the topology has a weight. When combined together, the weights of the replication servers of a same group can be translated to a percentage that determines the quantity of directory servers of the topology that should be connected to a replication server.

      For instance imagine a topology with 3 replication servers (with the same group id) with the following weights: RS1=1, RS2=1, RS3=2. This means that RS1 should have 25% of the directory servers connected in the topology, RS2 25%, and RS3 50%. This may be useful if the replication servers of the topology have a different power and one wants to spread the load between the replication servers according to their power.

      Returns:
      the weight
    • getReplicationServerDomains

      public Collection<ReplicationServerDomain> getReplicationServerDomains()
      Returns the replication server domains managed by this replication server.
      Returns:
      the replication server domains managed by this replication server
    • getChangelogDB

      public FileChangelogDB getChangelogDB()
      Returns the changelogDB.
      Returns:
      the changelogDB
    • isEncrypted

      public boolean isEncrypted()
      Return whether change-log records should be encrypted.
      Returns:
      true if change-log records should be encrypted
    • getName

      public String getName()
      Returns a name that can be printed to logs for this Replication Server instance.
      Returns:
      a name that can be printed to logs for this Replication Server instance
    • getServerContext

      public ServerContext getServerContext()
      Returns the server context.
      Returns:
      the server context
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getGenerationId

      public GenerationId getGenerationId(Dn baseDn)
      Description copied from interface: ChangelogContext
      Returns the generation id of the replica.
      Specified by:
      getGenerationId in interface ChangelogContext
      Parameters:
      baseDn - the base dn of the replication domain
      Returns:
      the generation id of the replica
    • setGenerationId

      public void setGenerationId(Dn baseDn, GenerationId generationId)
      Description copied from interface: ChangelogContext
      Set the generation id of the provided replication domain.
      Specified by:
      setGenerationId in interface ChangelogContext
      Parameters:
      baseDn - the base dn of the replication domain
      generationId - the generation id to set