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

Valery Kharseko
15 hours ago ebb19c5816399b83c42b8f9194dbf3d9296975a3
opendj-server-legacy/src/main/java/org/opends/quicksetup/Application.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2008-2010 Sun Microsystems, Inc.
 * Portions Copyright 2012-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.opends.quicksetup;
@@ -799,9 +800,12 @@
  /** Class used to add points periodically to the end of the logs. */
  protected class PointAdder implements Runnable
  {
    private Thread t;
    private boolean stopPointAdder;
    private boolean pointAdderStopped;
    /** Written by start() and read by stop(), hence volatile. */
    private volatile Thread t;
    /** Written by stop() and read by the point adder thread, hence volatile. */
    private volatile boolean stopPointAdder;
    /** Written by the point adder thread and read by stop(), hence volatile. */
    private volatile boolean pointAdderStopped;
    /** Default constructor. */
    public PointAdder()
@@ -825,21 +829,31 @@
      t.start();
    }
    /** Stops the PointAdder: points are no longer added at the end of the logs periodically. */
    public synchronized void stop()
    /**
     * Stops the PointAdder: points are no longer added at the end of the logs periodically.
     * <p>
     * Calling this method on a PointAdder that was never started is a no-op.
     */
    public void stop()
    {
      stopPointAdder = true;
      final Thread thread = t;
      if (thread == null)
      {
        return;
      }
      while (!pointAdderStopped)
      {
        thread.interrupt();
        try
        {
          t.interrupt();
          // To allow the thread to set the boolean.
          Thread.sleep(100);
        }
        catch (Throwable t)
        catch (InterruptedException e)
        {
          // do nothing
          Thread.currentThread().interrupt();
          break;
        }
      }
    }