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

Jean-Noël Rouvignac
20.42.2016 61b9eb1be03fc03a9f4bb0013a08ff44a1059503
opendj-server-legacy/src/main/java/org/opends/server/extensions/ParallelWorkQueue.java
@@ -51,24 +51,16 @@
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /**
   * The maximum number of times to retry getting the next operation from the
   * queue if an unexpected failure occurs.
   */
  private static final int MAX_RETRY_COUNT = 5;
  /** The set of worker threads that will be used to process this work queue. */
  private ArrayList<ParallelWorkerThread> workerThreads;
  /**
   * The number of operations that have been submitted to the work queue for
   * processing.
   */
  /** The number of operations that have been submitted to the work queue for processing. */
  private AtomicLong opsSubmitted;
  /**
@@ -95,10 +87,8 @@
  /** The lock used to provide threadsafe access for the queue. */
  private final Object queueLock = new Object();
  private final Semaphore queueSemaphore = new Semaphore(0, false);
  /**
   * Creates a new instance of this work queue.  All initialization should be
   * performed in the <CODE>initializeWorkQueue</CODE> method.
@@ -108,9 +98,6 @@
    // No implementation should be performed here.
  }
  /** {@inheritDoc} */
  @Override
  public void initializeWorkQueue(ParallelWorkQueueCfg configuration)
         throws ConfigException, InitializationException
@@ -140,7 +127,6 @@
      workerThreads.add(t);
    }
    // Create and register a monitor provider for the work queue.
    try
    {
@@ -156,15 +142,11 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void finalizeWorkQueue(LocalizableMessage reason)
  {
    shutdownRequested = true;
    // Send responses to any operations in the pending queue to indicate that
    // they won't be processed because the server is shutting down.
    CancelRequest cancelRequest = new CancelRequest(true, reason);
@@ -188,7 +170,6 @@
      }
    }
    // Notify all the worker threads of the shutdown.
    for (ParallelWorkerThread t : workerThreads)
    {
@@ -204,8 +185,6 @@
    }
  }
  /**
   * Indicates whether this work queue has received a request to shut down.
   *
@@ -217,8 +196,6 @@
    return shutdownRequested;
  }
  /**
   * Submits an operation to be processed by one of the worker threads
   * associated with this work queue.
@@ -245,7 +222,6 @@
    opsSubmitted.incrementAndGet();
  }
  /** {@inheritDoc} */
  @Override
  public boolean trySubmitOperation(Operation operation)
      throws DirectoryException
@@ -254,7 +230,6 @@
    return true;
  }
  /**
   * Retrieves the next operation that should be processed by one of the worker
   * threads, blocking if necessary until a new request arrives.  This method
@@ -271,8 +246,6 @@
    return retryNextOperation(workerThread, 0);
  }
  /**
   * Retrieves the next operation that should be processed by one of the worker
   * threads following a previous failure attempt.  A maximum of five
@@ -400,8 +373,6 @@
    }
  }
  /**
   * Attempts to remove the specified operation from this queue if it has not
   * yet been picked up for processing by one of the worker threads.
@@ -416,8 +387,6 @@
    return opQueue.remove(operation);
  }
  /**
   * Retrieves the total number of operations that have been successfully
   * submitted to this work queue for processing since server startup.  This
@@ -432,8 +401,6 @@
    return opsSubmitted.longValue();
  }
  /**
   * Retrieves the number of pending operations in the queue that have not yet
   * been picked up for processing.  Note that this method is not a
@@ -448,9 +415,6 @@
    return opQueue.size();
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationChangeAcceptable(
                      ParallelWorkQueueCfg configuration,
@@ -459,9 +423,6 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationChange(
                                 ParallelWorkQueueCfg configuration)
@@ -506,9 +467,6 @@
    return new ConfigChangeResult();
  }
  /** {@inheritDoc} */
  @Override
  public boolean isIdle()
  {