public final class ProxyBackend extends Backend<ProxyBackendCfg> implements ConfigurationChangeListener<ProxyBackendCfg>
The proxy backend forwards requests to remote servers using load balancers.
Implementation detail: the proxy backend uses a hierarchy of load balancers / connections factories that are setup this way: if the proxy backend is configured for distribution (with more than one partition):
Load Balancers - reference counted (one for bind operations + another one for other operations) | +--- newFixedSizeDistributionLoadBalancer (for n partitions) | +--- n newFailoverLoadBalancer (each fails over primary and secondary servers) | +--- 2 new*RequestLoadBalancer (Affinity or LeastRequests - one for primary servers, one for secondary | servers) | +--- newCachedConnectionPool - reference counted | +--- LdapConnectionFactoryOtherwise, the proxy backend is configured for direct proxying (with only one partition):
Load Balancers - reference counted (one for bind operations + another one for other operations) | +--- newFailoverLoadBalancer (over primary and secondary servers) | +--- 2 new*RequestLoadBalancer (Affinity or LeastRequests - one for primary servers, one for secondary servers) | +--- newCachedConnectionPool - reference counted | +--- LdapConnectionFactoryNote: Some load balancers/connection factories are reference counted, in order to ease managing their lifecycle and to avoid disturbing clients. When a change affects the load balancers/connection factories, the proxy backend needs to rebuild a whole new load balancer hierarchy in order to make use of them. However, LDAP is a connected protocol, thus closing connections should be avoided when there is no need to. As a consequence some connection factories/load balancers are reference counted to ensure they are closed only when they are no longer referenced.
Constructor and Description |
---|
ProxyBackend() |
Modifier and Type | Method and Description |
---|---|
ConfigChangeResult |
applyConfigurationChange(ProxyBackendCfg newConfig)
Applies the configuration changes to this change listener.
|
void |
configureBackend(ProxyBackendCfg cfg,
ServerContext serverContext)
Configure this backend based on the information in the provided configuration.
|
void |
deregisterBackendMonitor()
Deregisters the backend monitor of this backend.
|
void |
finalizeBackend()
Performs any necessary work to finalize this backend.
|
Set<Dn> |
getBaseDNs()
Retrieves the set of base-level DNs that may be used within this backend.
|
Set<String> |
getSupportedControls()
Retrieves the OIDs of the controls that may be supported by this backend.
|
Set<String> |
getSupportedFeatures()
Retrieves the OIDs of the features that may be supported by this backend.
|
Flowable<Response> |
handle(org.forgerock.services.context.Context context,
Request request)
|
boolean |
isConfigurationAcceptable(ProxyBackendCfg config,
List<LocalizableMessage> unacceptableReasons,
ServerContext serverContext)
Indicates whether the provided configuration is acceptable for this backend.
|
boolean |
isConfigurationChangeAcceptable(ProxyBackendCfg config,
List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable
to this change listener.
|
boolean |
isPublicBackend()
Indicates whether the base DNs of this backend should be considered public or private.
|
void |
openBackend()
Opens this backend based on the information provided when the backend was configured.
|
void |
registerBackendMonitor()
Registers a backend monitor for this backend.
|
getBackendID, getHealthStatus, setBackendID, toString
public Flowable<Response> handle(org.forgerock.services.context.Context context, Request request)
RequestHandler
Flowable
representing the asynchronous Response
of the given request
.
Successful responses (@see ResultCode.isExceptional()
must be provided to the
subscriber through the Subscriber.onNext(Object)
method. All erroneous responses
(e.g: no such object) must be published to the subscriber through the
Subscriber.onError(Throwable)
method.
handle
in interface RequestHandler
context
- The request context.request
- The request.Flowable
of zero or several Response
to be returned to the caller.public void configureBackend(ProxyBackendCfg cfg, ServerContext serverContext) throws ConfigException
Backend
configureBackend
in class Backend<ProxyBackendCfg>
cfg
- The configuration of this backend.serverContext
- The server context for this instanceConfigException
- If there is an error in the configuration.public void openBackend() throws ConfigException
Backend
openBackend
in class Backend<ProxyBackendCfg>
ConfigException
- If an unrecoverable problem arises while opening the backend.Backend.configureBackend(C, org.opends.server.core.ServerContext)
public Set<Dn> getBaseDNs()
Backend
getBaseDNs
in class Backend<ProxyBackendCfg>
public Set<String> getSupportedControls()
Backend
getSupportedControls
in class Backend<ProxyBackendCfg>
public Set<String> getSupportedFeatures()
Backend
getSupportedFeatures
in class Backend<ProxyBackendCfg>
public void finalizeBackend()
Backend
configureBackend()
has been called. This may be called during the
Directory Server shutdown process or if a backend is disabled with the server online. It must not return until
the backend is closed.
This method may not throw any exceptions. If any problems are encountered, then they may be logged but the closure should progress as completely as possible.
finalizeBackend
in class Backend<ProxyBackendCfg>
public boolean isPublicBackend()
Backend
This method also controls the visibility of the associated naming contexts. i.e. if any base DN of this backend is a naming context, then it will be public or private, based on the value returned by this method.
Reminder: Public naming contexts are returned when querying the root DSE entry.
isPublicBackend
in class Backend<ProxyBackendCfg>
true
if this backend's baseDNs could be exposed as a public naming context, false
if they
must remain private naming contexts.public boolean isConfigurationAcceptable(ProxyBackendCfg config, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext)
Backend
isConfigurationAcceptable
in class Backend<ProxyBackendCfg>
config
- The backend configuration for which to make the determination.unacceptableReasons
- A list that may be used to hold the reasons that the provided configuration is not acceptable.serverContext
- this Directory Server instance's server contexttrue
if the provided configuration is acceptable for this backend, or false
if not.public boolean isConfigurationChangeAcceptable(ProxyBackendCfg config, List<LocalizableMessage> unacceptableReasons)
ConfigurationChangeListener
isConfigurationChangeAcceptable
in interface ConfigurationChangeListener<ProxyBackendCfg>
config
- 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 ConfigChangeResult applyConfigurationChange(ProxyBackendCfg newConfig)
ConfigurationChangeListener
applyConfigurationChange
in interface ConfigurationChangeListener<ProxyBackendCfg>
newConfig
- The new configuration containing the changes.public void registerBackendMonitor()
Backend
registerBackendMonitor
in class Backend<ProxyBackendCfg>
public void deregisterBackendMonitor()
Backend
deregisterBackendMonitor
in class Backend<ProxyBackendCfg>
Copyright 2010-2022 ForgeRock AS.