public class ReplicationServer extends Object implements ConfigurationChangeListener<ReplicationServerCfg>, DiskSpaceMonitorHandler
Constructor and Description |
---|
ReplicationServer(ReplicationContext replicationContext,
ReplicationServerCfg cfg)
Creates a new Replication server using the provided configuration entry.
|
ReplicationServer(ReplicationContext context,
ReplicationServerCfg cfg,
DSRSShutdownSync dsrsShutdownSync)
Creates a new Replication server using the provided configuration entry and shutdown synchronization object.
|
ReplicationServer(ReplicationContext replicationContext,
ReplicationServerCfg cfg,
DSRSShutdownSync dsrsShutdownSync,
Predicate<Dn> isEclEnabledDomain)
Creates a new Replication server using the provided configuration entry, shutdown synchronization object and
domain predicate.
|
Modifier and Type | Method and Description |
---|---|
ConfigChangeResult |
applyConfigurationChange(ReplicationServerCfg configuration)
Applies the configuration changes to this change listener.
|
void |
diskFullThresholdReached(File directory,
long thresholdInBytes)
Notifies that the registered "full" threshold have been reached.
|
void |
diskLowThresholdReached(File directory,
long thresholdInBytes)
Notifies that the registered "low" threshold have been reached.
|
void |
diskSpaceRestored(File directory,
long lowThresholdInBytes,
long fullThresholdInBytes)
Notifies that the free disk space is now above both "low" and "full" thresholds.
|
static List<ReplicationServer> |
getAllInstances()
Get the list of every replication servers instantiated in the current VM.
|
ChangelogDB |
getChangelogDB()
Returns the changelogDB.
|
int |
getDegradedStatusThreshold()
Get the degraded status threshold value for status analyzer.
|
long |
getGenerationId(Dn baseDN)
Get the value of generationId for the replication replicationServerDomain associated with the provided baseDN.
|
GroupId |
getGroupId()
Get The replication server group id.
|
HostPort |
getHostPort()
Getter on the server host port.
|
long |
getMonitoringPublisherPeriod()
Get the monitoring publisher period value.
|
String |
getName()
Returns a name that can be printed to logs for this Replication Server instance.
|
long |
getNewestChangeNumber()
Returns the newest change number in the change number index DB.
|
MultiDomainServerState |
getNewestECLCookie(Set<Dn> excludedBaseDNs)
Returns the newest cookie value.
|
long |
getOldestChangeNumber()
Returns the oldest change number in the change number index DB.
|
ProcessId |
getProcessId()
Get this replication server process id.
|
long |
getPurgeDelay()
Retrieves the time after which changes must be deleted from the persistent storage (in milliseconds).
|
ReplicationContext |
getReplicationContext()
Returns the replication context.
|
int |
getReplicationPort()
Retrieves the port used by this ReplicationServer.
|
ReplicationServerDomain |
getReplicationServerDomain(Dn baseDN)
Get the ReplicationServerDomain associated to the base DN given in parameter.
|
ReplicationServerDomain |
getReplicationServerDomain(Dn baseDN,
boolean create)
Get the ReplicationServerDomain associated to the base DN given in parameter.
|
Collection<ReplicationServerDomain> |
getReplicationServerDomains()
Returns the replication server domains managed by this replication server.
|
ReplicationServerId |
getServerId()
Get the replication server id.
|
int |
getWeight()
Gets the weight affected to the replication server.
|
boolean |
isChangeNumberEnabled()
Returns whether change-log indexing is enabled for this RS.
|
static boolean |
isConfigurationAcceptable(ReplicationServerCfg configuration,
List<LocalizableMessage> unacceptableReasons)
Check if the provided configuration is acceptable for add.
|
boolean |
isConfigurationChangeAcceptable(ReplicationServerCfg configuration,
List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable
to this change listener.
|
boolean |
isEncrypted()
Return whether change-log records should be encrypted.
|
void |
remove()
Do what needed when the config object related to this replication server is deleted from the server
configuration.
|
void |
shutdown()
Shutdown the Replication Server service and all its connections.
|
String |
toString() |
void |
validateCookie(MultiDomainServerState cookie,
Set<Dn> ignoredBaseDNs)
Validate that provided cookie is coherent with this replication server, when ignoring the provided set of DNs.
|
public ReplicationServer(ReplicationContext replicationContext, ReplicationServerCfg cfg) throws ConfigException
replicationContext
- The replication contextcfg
- The configuration of this replication server.ConfigException
- When Configuration is invalid.public ReplicationServer(ReplicationContext context, ReplicationServerCfg cfg, DSRSShutdownSync dsrsShutdownSync) throws ConfigException
context
- The replication context.cfg
- The configuration of this replication server.dsrsShutdownSync
- Synchronization object for shutdown of combined DS/RS instances.ConfigException
- When Configuration is invalid.public ReplicationServer(ReplicationContext replicationContext, ReplicationServerCfg cfg, DSRSShutdownSync dsrsShutdownSync, Predicate<Dn> isEclEnabledDomain) throws ConfigException
replicationContext
- The replication contextcfg
- The configuration of this replication server.dsrsShutdownSync
- Synchronization object for shutdown of combined DS/RS instances.isEclEnabledDomain
- Indicates whether a domain is enabled for the external changelog.ConfigException
- When Configuration is invalid.public static List<ReplicationServer> getAllInstances()
public ReplicationServerDomain getReplicationServerDomain(Dn baseDN)
baseDN
- The base DN for which the ReplicationServerDomain must be returnednull
if there is no ReplicationServerDomain associated to this baseDnpublic void validateCookie(MultiDomainServerState cookie, Set<Dn> ignoredBaseDNs) throws LdapException
The cookie is coherent if and only if it exactly has the set of DNs corresponding to the replication domains, and the states in the cookie are not older than oldest states in the server.
cookie
- The multi domain state (cookie) to validate.ignoredBaseDNs
- The set of DNs to ignore when validatingLdapException
- If the cookie is not validpublic ReplicationServerDomain getReplicationServerDomain(Dn baseDN, boolean create)
baseDN
- The base DN for which the ReplicationServerDomain must be returned.create
- Specifies whether to create the ReplicationServerDomain if it does not already exist.null
if there is no ReplicationServerDomain associated to this baseDn
and the create parameter was false.public void shutdown()
public long getPurgeDelay()
public static boolean isConfigurationAcceptable(ReplicationServerCfg configuration, List<LocalizableMessage> unacceptableReasons)
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.public ConfigChangeResult applyConfigurationChange(ReplicationServerCfg configuration)
ConfigurationChangeListener
applyConfigurationChange
in interface ConfigurationChangeListener<ReplicationServerCfg>
configuration
- The new configuration containing the changes.public boolean isConfigurationChangeAcceptable(ReplicationServerCfg configuration, List<LocalizableMessage> unacceptableReasons)
ConfigurationChangeListener
isConfigurationChangeAcceptable
in interface ConfigurationChangeListener<ReplicationServerCfg>
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.true
if the proposed change is acceptable,
or false
if it is not.public long getGenerationId(Dn baseDN)
baseDN
- The baseDN of the replicationServerDomain.public ReplicationServerId getServerId()
public void remove()
public GroupId getGroupId()
default
if not defined, but never null
.public ProcessId getProcessId()
public int getDegradedStatusThreshold()
The degraded status threshold is the number of pending changes for a DS, considered as threshold value to put the DS in DEGRADED_STATUS. If value is 0, status analyzer is disabled.
public long getMonitoringPublisherPeriod()
It is the number of milliseconds to wait before sending new monitoring messages. If value is 0, monitoring publisher is disabled.
public int getReplicationPort()
public HostPort getHostPort()
public long getOldestChangeNumber() throws LdapException
LdapException
- When a problem happenspublic long getNewestChangeNumber() throws LdapException
LdapException
- When a problem happenspublic MultiDomainServerState getNewestECLCookie(Set<Dn> excludedBaseDNs)
excludedBaseDNs
- The set of baseDNs excluded from ECL.public void diskLowThresholdReached(File directory, long thresholdInBytes)
DiskSpaceMonitorHandler
diskLowThresholdReached
in interface DiskSpaceMonitorHandler
directory
- the directory for which the threshold has been triggeredthresholdInBytes
- the threshold value in bytespublic void diskFullThresholdReached(File directory, long thresholdInBytes)
DiskSpaceMonitorHandler
diskFullThresholdReached
in interface DiskSpaceMonitorHandler
directory
- the directory for which the threshold has been triggeredthresholdInBytes
- the threshold value in bytespublic void diskSpaceRestored(File directory, long lowThresholdInBytes, long fullThresholdInBytes)
DiskSpaceMonitorHandler
diskSpaceRestored
in interface DiskSpaceMonitorHandler
directory
- the directory for which the threshold has been triggeredTODOlowThresholdInBytes
- the low threshold value in bytesfullThresholdInBytes
- the full threshold value in bytespublic int getWeight()
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.
public Collection<ReplicationServerDomain> getReplicationServerDomains()
public ChangelogDB getChangelogDB()
public boolean isChangeNumberEnabled()
public boolean isEncrypted()
true
if change-log records should be encryptedpublic String getName()
public ReplicationContext getReplicationContext()
Copyright 2010-2022 ForgeRock AS.