mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Maxim Thomas
03.30.2025 61dac86bceb9d727e1bd707982c41ab9467c6d5a
opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2008-2010 Sun Microsystems, Inc.
 * Portions Copyright 2011-2016 ForgeRock AS.
 * Portions Copyright 2025 3A Systems LLC.
 */
package org.opends.server.replication.service;
@@ -39,6 +40,9 @@
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -373,6 +377,11 @@
  protected volatile long generationId;
  /**
   * Thread pool for export thread tasks
   */
  private final ExecutorService exportThreadPool = Executors.newCachedThreadPool();
  /**
   * Returns the {@link CSNGenerator} that will be used to
   * generate {@link CSN} for this domain.
   *
@@ -879,7 +888,10 @@
        // Do this work in a thread to allow replay thread continue working
        ExportThread exportThread = new ExportThread(
            initReqMsg.getSenderID(), initReqMsg.getInitWindow());
        exportThread.start();
        exportThreadPool.execute(() -> {
          Thread.currentThread().setName(exportThread.getName());
          exportThread.run();
        });
      }
    }
@@ -1075,6 +1087,9 @@
        This server is not the initiator of the export so there is
        nothing more to do locally.
        */
        if (logger.isTraceEnabled()) {
          logger.trace(LocalizableMessage.raw("[IE] got exception" + getName()), de);
        }
      }
      if (logger.isTraceEnabled())
@@ -3016,6 +3031,13 @@
      {
        broker.stop();
      }
      try {
        exportThreadPool.shutdown();
        boolean timedOut = exportThreadPool.awaitTermination(100, TimeUnit.SECONDS);
        logger.info(LocalizableMessage.raw("export pool termination timed out: " + timedOut));
      } catch (InterruptedException e) {
        // Give up waiting.
      }
      // Stop the listener thread
      if (listenerThread != null)