public class ReplicationServer extends Object implements ConfigurationChangeListener<ReplicationServerCfg>, DiskSpaceMonitorHandler
Constructor and Description |
---|
ReplicationServer(ReplicationServerCfg cfg)
Creates a new Replication server using the provided configuration entry.
|
ReplicationServer(ReplicationServerCfg cfg,
DSRSShutdownSync dsrsShutdownSync)
Creates a new Replication server using the provided configuration entry and shutdown synchronization object.
|
ReplicationServer(ReplicationServerCfg cfg,
DSRSShutdownSync dsrsShutdownSync,
ECLEnabledDomainPredicate predicate)
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.
|
long |
getAssuredTimeout()
Get the assured mode timeout.
|
ChangelogDB |
getChangelogDB()
Returns the changelogDB.
|
int |
getDegradedStatusThreshold()
Get the degraded status threshold value for status analyzer.
|
Iterator<ReplicationServerDomain> |
getDomainIterator()
Returns an iterator on the list of replicationServerDomain.
|
long |
getGenerationId(Dn baseDN)
Get the value of generationId for the replication replicationServerDomain associated with the provided baseDN.
|
byte |
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.
|
long |
getPurgeDelay()
Retrieves the time after which changes must be deleted from the persistent storage (in milliseconds).
|
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.
|
int |
getServerId()
Get the serverId for this replication server.
|
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 |
isECLEnabled()
Returns whether the external change-log contains data from at least a domain.
|
boolean |
isEncrypted()
Return whether change-log records should be encrypted.
|
static boolean |
isLocalReplicationServerPort(int port)
Returns
true if the provided port is one of the ports that this replication server is listening on. |
static void |
onlyForTestsAddlocalReplicationServer(HostPort server)
WARNING : only use this methods for tests purpose.
|
static void |
onlyForTestsClearLocalReplicationServerList()
WARNING : only use this methods for tests purpose.
|
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(ReplicationServerCfg cfg) throws ConfigException
cfg
- The configuration of this replication server.ConfigException
- When Configuration is invalid.public ReplicationServer(ReplicationServerCfg cfg, DSRSShutdownSync dsrsShutdownSync) throws ConfigException
cfg
- The configuration of this replication server.dsrsShutdownSync
- Synchronization object for shutdown of combined DS/RS instances.ConfigException
- When Configuration is invalid.public ReplicationServer(ReplicationServerCfg cfg, DSRSShutdownSync dsrsShutdownSync, ECLEnabledDomainPredicate predicate) throws ConfigException
cfg
- The configuration of this replication server.dsrsShutdownSync
- Synchronization object for shutdown of combined DS/RS instances.predicate
- 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 returned.public 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.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 int getServerId()
public void remove()
public Iterator<ReplicationServerDomain> getDomainIterator()
public long getAssuredTimeout()
It is the Timeout (in milliseconds) when waiting for acknowledgments.
public byte getGroupId()
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 static void onlyForTestsAddlocalReplicationServer(HostPort server)
server
- The server to be added.public static void onlyForTestsClearLocalReplicationServerList()
public static boolean isLocalReplicationServerPort(int port)
true
if the provided port is one of the ports that this replication server is listening on.port
- The port to be checked.true
if the provided port is one of the ports that this replication server is listening on.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 ChangelogDB getChangelogDB()
public boolean isChangeNumberEnabled()
public boolean isECLEnabled()
public boolean isEncrypted()
public String getName()
Copyright 2010-2018 ForgeRock AS.