Class ReplicationServiceDiscoveryMechanism
- java.lang.Object
-
- org.forgerock.opendj.discovery.ReplicationServiceDiscoveryMechanism
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ServiceDiscoveryMechanism
public final class ReplicationServiceDiscoveryMechanism extends Object
Service Discovery Mechanism retrieving information from a replication topology.The partitions returned by this class contain the directory servers that are part of the same topology as the configured replication servers.
It will periodically query the topology to discover any new or removed servers and notify listeners of any changes.
-
-
Field Summary
Fields Modifier and Type Field Description static Option<BindRequest>
BIND_REQUEST
The bind request to use to perform service discovery when connecting to servers.static Option<Set<com.forgerock.opendj.util.HostPort>>
BOOTSTRAP_REPLICATION_SERVERS
The addresses of one or more replication servers within the topology which this server should connect to in order to discover the rest of the topology.static Option<Duration>
DISCOVERY_INTERVAL
Interval between two replication server configuration discovery queries.static Option<Supplier<ScheduledExecutorService>>
EXECUTOR_SERVICE
The scheduled executor service where service discovery is scheduled.static Option<String>
PRIMARY_GROUP_ID
Replication domain group ID of preferred directory server replicas.
-
Constructor Summary
Constructors Constructor Description ReplicationServiceDiscoveryMechanism(Options options)
Initializes the mechanism with the provided options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Frees any resources in use, mechanism will not be used anymore afterwards.void
deregisterChangeListener(ServiceDiscoveryChangeListener listener)
De-registers a listener from notifications on service changes.Partition
getPartition(Collection<Dn> baseDNs)
Returns the partition.void
registerChangeListener(ServiceDiscoveryChangeListener listener)
Registers a listener to be notified when changes in the service occur.String
toString()
-
-
-
Field Detail
-
BIND_REQUEST
public static final Option<BindRequest> BIND_REQUEST
The bind request to use to perform service discovery when connecting to servers.- Prerequisite for using
external SASL
: all replication servers must be able to map the certificate to an admin user. - Prerequisite for using
simple bind
: all replication servers must have the same admin DN and bindPassword.
- Prerequisite for using
-
BOOTSTRAP_REPLICATION_SERVERS
public static final Option<Set<com.forgerock.opendj.util.HostPort>> BOOTSTRAP_REPLICATION_SERVERS
The addresses of one or more replication servers within the topology which this server should connect to in order to discover the rest of the topology.Addresses must be specified using the administration port of the remote replication servers using the syntax "hostname:admin-port". When using an IPv6 address as the hostname, put brackets around the address as in "[IPv6Address]:admin-port".
-
PRIMARY_GROUP_ID
public static final Option<String> PRIMARY_GROUP_ID
Replication domain group ID of preferred directory server replicas.Directory server replicas with this replication domain group ID will be preferred over other directory server replicas. Secondary server replicas will only be used when all primary server replicas become unavailable.
-
DISCOVERY_INTERVAL
public static final Option<Duration> DISCOVERY_INTERVAL
Interval between two replication server configuration discovery queries.Specifies how frequently to query a replication server configuration in order to discover information about available directory server replicas.
Default value:
1m
-
EXECUTOR_SERVICE
public static final Option<Supplier<ScheduledExecutorService>> EXECUTOR_SERVICE
The scheduled executor service where service discovery is scheduled.
-
-
Constructor Detail
-
ReplicationServiceDiscoveryMechanism
public ReplicationServiceDiscoveryMechanism(Options options)
Initializes the mechanism with the provided options.- Parameters:
options
- the options for initialization
-
-
Method Detail
-
getPartition
public Partition getPartition(Collection<Dn> baseDNs)
Description copied from interface:ServiceDiscoveryMechanism
Returns the partition.The
Partition
will only contain servers that are known to expose the provided list of base DNs. An empty list of base DNs will result in all partitions and all servers being returned. In other words, an empty list of base DNs implies that all servers contain exactly the same base DNs.- Parameters:
baseDNs
- the baseDNs for which to retrieve the partitions- Returns:
- the partition that can serve the provided base DNs
-
close
public final void close()
Description copied from interface:ServiceDiscoveryMechanism
Frees any resources in use, mechanism will not be used anymore afterwards.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceServiceDiscoveryMechanism
-
registerChangeListener
public final void registerChangeListener(ServiceDiscoveryChangeListener listener)
Description copied from interface:ServiceDiscoveryMechanism
Registers a listener to be notified when changes in the service occur.- Specified by:
registerChangeListener
in interfaceServiceDiscoveryMechanism
- Parameters:
listener
- the listener to register for notifications
-
deregisterChangeListener
public final void deregisterChangeListener(ServiceDiscoveryChangeListener listener)
Description copied from interface:ServiceDiscoveryMechanism
De-registers a listener from notifications on service changes.- Specified by:
deregisterChangeListener
in interfaceServiceDiscoveryMechanism
- Parameters:
listener
- the listener to de-register
-
-