| | |
| | | private boolean solveConflictFlag = true; |
| | | |
| | | private final InternalClientConnection conn = getRootConnection(); |
| | | private volatile boolean shutdown = false; |
| | | private final AtomicBoolean shutdown = new AtomicBoolean(); |
| | | private volatile boolean disabled = false; |
| | | private volatile boolean stateSavingDisabled = false; |
| | | |
| | |
| | | */ |
| | | |
| | | /** Holds the fractional configuration for this domain, if any. */ |
| | | private FractionalConfig fractionalConfig; |
| | | private final FractionalConfig fractionalConfig; |
| | | |
| | | /** |
| | | * The list of attributes that cannot be used in fractional replication |
| | |
| | | private class RSUpdater extends DirectoryThread |
| | | { |
| | | private final CSN startCSN; |
| | | /** |
| | | * Used to communicate that the current thread computation needs to |
| | | * shutdown. |
| | | */ |
| | | private AtomicBoolean shutdown = new AtomicBoolean(false); |
| | | |
| | | protected RSUpdater(CSN replServerMaxCSN) |
| | | { |
| | |
| | | @Override |
| | | public void run() |
| | | { |
| | | // Replication server is missing some of our changes: let's |
| | | // send them to him. |
| | | // Replication server is missing some of our changes: |
| | | // let's send them to him. |
| | | logger.trace(DEBUG_GOING_TO_SEARCH_FOR_CHANGES); |
| | | |
| | | /* |
| | |
| | | */ |
| | | try |
| | | { |
| | | if (buildAndPublishMissingChanges(startCSN, broker, shutdown)) |
| | | if (buildAndPublishMissingChanges(startCSN, broker)) |
| | | { |
| | | logger.trace(DEBUG_CHANGES_SENT); |
| | | synchronized(replayOperations) |
| | |
| | | */ |
| | | logger.error(ERR_CANNOT_RECOVER_CHANGES, getBaseDNString()); |
| | | } |
| | | } catch (Exception e) |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | /* |
| | | * An error happened trying to search for the updates |
| | |
| | | rsUpdater.compareAndSet(this, null); |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initiateShutdown() |
| | | { |
| | | this.shutdown.set(true); |
| | | super.initiateShutdown(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Creates a new ReplicationDomain using configuration from configEntry. |
| | | * |
| | |
| | | */ |
| | | static class AttributeValueStringIterator implements Iterator<String> |
| | | { |
| | | private Iterator<ByteString> attrValIt; |
| | | private final Iterator<ByteString> attrValIt; |
| | | |
| | | /** |
| | | * Creates a new AttributeValueStringIterator object. |
| | |
| | | */ |
| | | public void shutdown() |
| | | { |
| | | if (!shutdown) |
| | | if (shutdown.compareAndSet(false, true)) |
| | | { |
| | | shutdown = true; |
| | | final RSUpdater rsUpdater = this.rsUpdater.get(); |
| | | if (rsUpdater != null) |
| | | { |
| | |
| | | disableService(); |
| | | } |
| | | |
| | | // wait for completion of the persistentServerState thread. |
| | | // wait for completion of the ServerStateFlush thread. |
| | | try |
| | | { |
| | | while (!done) |
| | |
| | | * The CSN where we need to start the search |
| | | * @param session |
| | | * The session to use to publish the changes |
| | | * @param shutdown |
| | | * whether the current run must be stopped |
| | | * @return A boolean indicating he success of the operation. |
| | | * @throws Exception |
| | | * if an Exception happens during the search. |
| | | */ |
| | | boolean buildAndPublishMissingChanges(CSN startCSN, |
| | | ReplicationBroker session, AtomicBoolean shutdown) throws Exception |
| | | boolean buildAndPublishMissingChanges(CSN startCSN, ReplicationBroker session) |
| | | throws Exception |
| | | { |
| | | // Trim the changes in replayOperations that are older than the startCSN. |
| | | synchronized (replayOperations) |
| | |
| | | /** |
| | | * Base DN the fractional configuration is for. |
| | | */ |
| | | private DN baseDN; |
| | | private final DN baseDN; |
| | | |
| | | /** |
| | | * Constructs a new fractional configuration object. |