| | |
| | | import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.IsolationPolicy; |
| | | import org.opends.server.admin.std.server.ExternalChangelogDomainCfg; |
| | | import org.opends.server.admin.std.server.ReplicationDomainCfg; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.SynchronizationProvider; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.SynchronizationProvider; |
| | | import org.opends.server.api.BackendInitializationListener; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.backends.task.Task; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | */ |
| | | public final class LDAPReplicationDomain extends ReplicationDomain |
| | | implements ConfigurationChangeListener<ReplicationDomainCfg>, |
| | | AlertGenerator |
| | | AlertGenerator, BackendInitializationListener, ServerShutdownListener |
| | | { |
| | | /** |
| | | * Set of attributes that will return all the user attributes and the |
| | |
| | | newHashSet(HISTORICAL_ATTRIBUTE_NAME, ENTRYUUID_ATTRIBUTE_NAME, "*"); |
| | | |
| | | /** |
| | | * Initializing replication for the domain initiates backend finalization/initialization |
| | | * This flag prevents the Replication Domain to disable/enable itself when |
| | | * it is the event initiator |
| | | */ |
| | | private boolean ignoreBackendInitializationEvent; |
| | | |
| | | private volatile boolean serverShutdownRequested; |
| | | |
| | | @Override |
| | | public String getShutdownListenerName() { |
| | | return "LDAPReplicationDomain " + getBaseDN(); |
| | | } |
| | | |
| | | @Override |
| | | public void processServerShutdown(LocalizableMessage reason) { |
| | | serverShutdownRequested = true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This class is used in the session establishment phase |
| | | * when no Replication Server with all the local changes has been found |
| | | * and we therefore need to recover them. |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreInitializationProcessing(Backend<?> backend) { |
| | | // Nothing to do |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostFinalizationProcessing(Backend<?> backend) { |
| | | // Nothing to do |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPostInitializationProcessing(Backend<?> backend) { |
| | | if (!ignoreBackendInitializationEvent |
| | | && getBackend().getBackendID().equals(backend.getBackendID())) { |
| | | enable(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void performBackendPreFinalizationProcessing(Backend<?> backend) { |
| | | // Do not disable itself during a shutdown |
| | | // And ignore the event if this replica is the event trigger (e.g. importing). |
| | | if (!ignoreBackendInitializationEvent |
| | | && !serverShutdownRequested |
| | | && getBackend().getBackendID().equals(backend.getBackendID())) { |
| | | disable(); |
| | | } |
| | | } |
| | | |
| | | /** The fully-qualified name of this class. */ |
| | | private static final String CLASS_NAME = LDAPReplicationDomain.class.getName(); |
| | | |
| | |
| | | // register as an AlertGenerator |
| | | DirectoryServer.registerAlertGenerator(this); |
| | | |
| | | DirectoryServer.registerBackendInitializationListener(this); |
| | | DirectoryServer.registerShutdownListener(this); |
| | | |
| | | startPublishService(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | DirectoryServer.deregisterAlertGenerator(this); |
| | | DirectoryServer.deregisterBackendInitializationListener(this); |
| | | DirectoryServer.deregisterShutdownListener(this); |
| | | |
| | | // stop the ReplicationDomain |
| | | disableService(); |
| | |
| | | // Stop saving state |
| | | stateSavingDisabled = true; |
| | | |
| | | // Prevent the processing of the backend finalisation event as the import will disable the attached backend |
| | | ignoreBackendInitializationEvent = true; |
| | | |
| | | // FIXME setBackendEnabled should be part of TaskUtils ? |
| | | TaskUtils.disableBackend(backend.getBackendID()); |
| | | |
| | |
| | | } |
| | | |
| | | TaskUtils.enableBackend(backend.getBackendID()); |
| | | |
| | | // Restore the processing of backend finalization events. |
| | | ignoreBackendInitializationEvent = false; |
| | | |
| | | } |
| | | |
| | | /** |