Package org.forgerock.opendj.discovery
Class StaticServiceDiscoveryMechanism
- java.lang.Object
-
- org.forgerock.opendj.discovery.StaticServiceDiscoveryMechanism
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ServiceDiscoveryMechanism
public final class StaticServiceDiscoveryMechanism extends Object
This mechanism only returns the list of servers in its configuration, without checking for availability. It will periodically query the list of servers for changes in their baseDns.
-
-
Field Summary
Fields Modifier and Type Field Description 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<Set<com.forgerock.opendj.util.HostPort>>
PRIMARY_SERVERS
Specifies a list of servers that will be used in preference to secondary servers when available.static Option<Set<com.forgerock.opendj.util.HostPort>>
SECONDARY_SERVERS
Specifies a list of servers that will be used in place of primary servers when all primary servers are unavailable.
-
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
-
PRIMARY_SERVERS
public static final Option<Set<com.forgerock.opendj.util.HostPort>> PRIMARY_SERVERS
Specifies a list of servers that will be used in preference to secondary servers when available.
-
SECONDARY_SERVERS
public static final Option<Set<com.forgerock.opendj.util.HostPort>> SECONDARY_SERVERS
Specifies a list of servers that will be used in place of primary servers when all primary servers are 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.
-
-
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
-
-