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

Valery Kharseko
yesterday 0885d16ac22a0ecd2267bf3c8818a3a8a5a9dadb
opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java
@@ -43,7 +43,7 @@
  private String name;
  private AtomicBoolean stopRequested;
  private WriterThread writerThread;
  private final WriterThread writerThread;
  private boolean autoFlush;
@@ -65,16 +65,28 @@
    this.queue = new LinkedBlockingQueue<>(capacity);
    this.capacity = capacity;
    this.writerThread = null;
    this.stopRequested = new AtomicBoolean(false);
    writerThread = new WriterThread();
    writerThread.start();
    DirectoryServer.registerShutdownListener(this);
  }
  /**
   * Starts the background thread which publishes the queued log records.
   * <p>
   * The thread is not started by the constructor so that {@code this} is not published to it before
   * construction has completed.
   *
   * @return this writer
   */
  AsynchronousTextWriter start()
  {
    writerThread.start();
    return this;
  }
  /**
   * The publisher thread is responsible for emptying the queue of log records
   * waiting to published.
   */
@@ -216,7 +228,7 @@
    stopRequested.set(true);
    // Wait for publisher thread to terminate
    while (writerThread != null && writerThread.isAlive()) {
    while (writerThread.isAlive()) {
      try {
        // Interrupt the thread if its blocking
        writerThread.interrupt();