From 582344d280d24dfec999b862d8255eb077995b99 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 26 Mar 2013 14:49:27 +0000
Subject: [PATCH] OPENDJ-832 Leverage the work queue for processing requests received on the HTTP connection handler 

---
 opends/src/server/org/opends/server/core/DirectoryServer.java               |  454 ++++++++++++++++++++--------------
 opends/src/server/org/opends/server/api/WorkQueue.java                      |    9 
 opends/src/server/org/opends/server/extensions/ParallelWorkerThread.java    |   30 +-
 opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java    |  106 ++++---
 opends/src/server/org/opends/server/core/OperationWrapper.java              |   72 +++++
 opends/src/server/org/opends/server/extensions/ParallelWorkQueue.java       |   50 ++-
 opends/src/server/org/opends/server/types/Operation.java                    |   13 
 opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java |   35 +-
 8 files changed, 469 insertions(+), 300 deletions(-)

diff --git a/opends/src/server/org/opends/server/api/WorkQueue.java b/opends/src/server/org/opends/server/api/WorkQueue.java
index f60605c..b9fddd5 100644
--- a/opends/src/server/org/opends/server/api/WorkQueue.java
+++ b/opends/src/server/org/opends/server/api/WorkQueue.java
@@ -23,17 +23,16 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions copyright 2013 ForgeRock AS.
  */
 package org.opends.server.api;
+
 import org.opends.messages.Message;
-
-
-
 import org.opends.server.admin.std.server.WorkQueueCfg;
 import org.opends.server.config.ConfigException;
-import org.opends.server.types.AbstractOperation;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.InitializationException;
+import org.opends.server.types.Operation;
 
 
 
@@ -101,7 +100,7 @@
    *                              already has too many pending
    *                              requests in the queue).
    */
-  public abstract void submitOperation(AbstractOperation operation)
+  public abstract void submitOperation(Operation operation)
          throws DirectoryException;
 
 
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index c625d3b..b6047f4 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -110,13 +110,6 @@
    */
   private static final DebugTracer TRACER = getTracer();
 
-    /**
-    * The fully-qualified name of this class.
-    */
-    private static final String CLASS_NAME =
-       "org.opends.server.core.DirectoryServer";
-
-
   /**
    * The singleton Directory Server instance.
    */
@@ -184,462 +177,549 @@
    */
   private static int START_AS_NON_DETACH_QUIET = 104;
 
-  // The policy to use regarding single structural objectclass enforcement.
+  /** The policy to use regarding single structural objectclass enforcement. */
   private AcceptRejectWarn singleStructuralClassPolicy;
 
-  // The policy to use regarding syntax enforcement.
+  /** The policy to use regarding syntax enforcement. */
   private AcceptRejectWarn syntaxEnforcementPolicy;
 
-  // The account status notification handler config manager for the server.
+  /** The account status notification handler config manager for the server. */
   private AccountStatusNotificationHandlerConfigManager
        accountStatusNotificationHandlerConfigManager;
 
-  // The default syntax to use for binary attributes.
+  /** The default syntax to use for binary attributes. */
   private AttributeSyntax<AttributeSyntaxCfg> defaultBinarySyntax;
 
-  // The default syntax to use for Boolean attributes.
+  /** The default syntax to use for Boolean attributes. */
   private AttributeSyntax<AttributeSyntaxCfg> defaultBooleanSyntax;
 
-  // The default syntax to use for DN attributes.
+  /** The default syntax to use for DN attributes. */
   private AttributeSyntax<AttributeSyntaxCfg> defaultDNSyntax;
 
-  // The default syntax to use for integer attributes.
+  /** The default syntax to use for integer attributes. */
   private AttributeSyntax<AttributeSyntaxCfg> defaultIntegerSyntax;
 
-  // The default syntax to use for string attributes.
+  /** The default syntax to use for string attributes. */
   private AttributeSyntax<DirectoryStringAttributeSyntaxCfg>
                defaultStringSyntax;
 
-  // The default attribute syntax to use for attributes with no defined syntax.
+  /**
+   * The default attribute syntax to use for attributes with no defined syntax.
+   */
   private AttributeSyntax<DirectoryStringAttributeSyntaxCfg> defaultSyntax;
 
-  // The attribute type used to reference the "objectclass" attribute.
+  /** The attribute type used to reference the "objectclass" attribute. */
   private AttributeType objectClassAttributeType;
 
-  // The authenticated users manager for the server.
+  /** The authenticated users manager for the server. */
   private AuthenticatedUsers authenticatedUsers;
 
-  // The configuration manager that will handle the server backends.
+  /** The configuration manager that will handle the server backends. */
   private BackendConfigManager backendConfigManager;
 
-  // Indicates whether to automatically add missing RDN attributes to entries
-  // during an add request.
+  /**
+   * Indicates whether to automatically add missing RDN attributes to entries
+   * during an add request.
+   */
   private boolean addMissingRDNAttributes;
 
-  // Indicates whether to allow attribute name exceptions (i.e., attribute names
-  // can contain underscores and may start with a digit).
+  /**
+   * Indicates whether to allow attribute name exceptions (i.e., attribute names
+   * can contain underscores and may start with a digit).
+   */
   private boolean allowAttributeNameExceptions;
 
-  // Indicates whether a simple bind request containing a DN must also provide a
-  // password.
+  /**
+   * Indicates whether a simple bind request containing a DN must also provide a
+   * password.
+   */
   private boolean bindWithDNRequiresPassword;
 
-  // Indicates whether the Directory Server should perform schema checking for
-  // update operations.
+  /**
+   * Indicates whether the Directory Server should perform schema checking for
+   * update operations.
+   */
   private boolean checkSchema;
 
-  // Indicates whether the server has been bootstrapped.
+  /** Indicates whether the server has been bootstrapped. */
   private boolean isBootstrapped;
 
-  // Indicates whether the server is currently online.
+  /** Indicates whether the server is currently online. */
   private boolean isRunning;
 
-  // Indicates whether the server is currently in "lockdown mode".
+  /** Indicates whether the server is currently in "lockdown mode". */
   private boolean lockdownMode;
 
-  // Indicates whether the server should send a response to operations that have
-  // been abandoned.
+  /**
+   * Indicates whether the server should send a response to operations that have
+   * been abandoned.
+   */
   private boolean notifyAbandonedOperations;
 
-  // Indicates whether to save a copy of the configuration on successful
-  // startup.
+  /**
+   * Indicates whether to save a copy of the configuration on successful
+   * startup.
+   */
   private boolean saveConfigOnSuccessfulStartup;
 
-  // Indicates whether the server is currently in the process of shutting down.
+  /**
+   * Indicates whether the server is currently in the process of shutting down.
+   */
   private boolean shuttingDown;
 
-  // Indicates whether the server should reject unauthenticated requests.
+  /** Indicates whether the server should reject unauthenticated requests. */
   private boolean rejectUnauthenticatedRequests;
 
-  // Indicates whether bind responses should include failure reason messages.
+  /**
+   * Indicates whether bind responses should include failure reason messages.
+   */
   private boolean returnBindErrorMessages;
 
-  // The configuration manager that will handle the certificate mapper.
+  /** The configuration manager that will handle the certificate mapper. */
   private CertificateMapperConfigManager certificateMapperConfigManager;
 
-  // The class used to provide the config handler implementation.
+  /** The class used to provide the config handler implementation. */
   private Class configClass;
 
-  // The configuration handler for the Directory Server.
+  /** The configuration handler for the Directory Server. */
   private ConfigHandler configHandler;
 
-  // The set of account status notification handlers defined in the server.
+  /** The set of account status notification handlers defined in the server. */
   private ConcurrentHashMap<DN,AccountStatusNotificationHandler>
                accountStatusNotificationHandlers;
 
-  // The set of certificate mappers registered with the server.
+  /** The set of certificate mappers registered with the server. */
   private ConcurrentHashMap<DN,CertificateMapper> certificateMappers;
 
-  // The set of alternate bind DNs for the root users.
+  /** The set of alternate bind DNs for the root users. */
   private ConcurrentHashMap<DN,DN> alternateRootBindDNs;
 
-  // The set of identity mappers registered with the server (mapped between
-  // the configuration entry Dn and the mapper).
+  /**
+   * The set of identity mappers registered with the server (mapped between the
+   * configuration entry Dn and the mapper).
+   */
   private ConcurrentHashMap<DN,IdentityMapper> identityMappers;
 
-  // The set of JMX MBeans that have been registered with the server (mapped
-  // between the associated configuration entry DN and the MBean).
+  /**
+   * The set of JMX MBeans that have been registered with the server (mapped
+   * between the associated configuration entry DN and the MBean).
+   */
   private ConcurrentHashMap<DN,JMXMBean> mBeans;
 
-  // The set of key manager providers registered with the server.
+  /** The set of key manager providers registered with the server. */
   private ConcurrentHashMap<DN,KeyManagerProvider> keyManagerProviders;
 
-  // The set of extensions registered with the server.
+  /** The set of extensions registered with the server. */
   private ConcurrentHashMap<DN,Extension> extensions;
 
-  // The set of password generators registered with the Directory Server, as a
-  // mapping between the DN of the associated configuration entry and the
-  // generator implementation.
+  /**
+   * The set of password generators registered with the Directory Server, as a
+   * mapping between the DN of the associated configuration entry and the
+   * generator implementation.
+   */
   private ConcurrentHashMap<DN,PasswordGenerator> passwordGenerators;
 
-  // The set of authentication policies registered with the Directory Server, as
-  // a mapping between the DN of the associated configuration entry and the
-  // policy implementation.
+  /**
+   * The set of authentication policies registered with the Directory Server, as
+   * a mapping between the DN of the associated configuration entry and the
+   * policy implementation.
+   */
   private ConcurrentHashMap<DN,AuthenticationPolicy> authenticationPolicies;
 
-  // The set of password validators registered with the Directory Server, as a
-  // mapping between the DN of the associated configuration entry and the
-  // validator implementation.
+  /**
+   * The set of password validators registered with the Directory Server, as a
+   * mapping between the DN of the associated configuration entry and the
+   * validator implementation.
+   */
   private ConcurrentHashMap<DN,
                PasswordValidator<? extends PasswordValidatorCfg>>
                passwordValidators;
 
-  // The set of trust manager providers registered with the server.
+  /** The set of trust manager providers registered with the server. */
   private ConcurrentHashMap<DN,TrustManagerProvider> trustManagerProviders;
 
-  // The set of log rotation policies registered with the Directory Server, as
-  // a mapping between the DN of the associated configuration entry and the
-  // policy implementation.
+  /**
+   * The set of log rotation policies registered with the Directory Server, as a
+   * mapping between the DN of the associated configuration entry and the policy
+   * implementation.
+   */
   private ConcurrentHashMap<DN, RotationPolicy> rotationPolicies;
 
-  // The set of log retention policies registered with the Directory Server, as
-  // a mapping between the DN of the associated configuration entry and the
-  // policy implementation.
+  /**
+   * The set of log retention policies registered with the Directory Server, as
+   * a mapping between the DN of the associated configuration entry and the
+   * policy implementation.
+   */
   private ConcurrentHashMap<DN, RetentionPolicy> retentionPolicies;
 
-  // The set supported LDAP protocol versions.
+  /** The set supported LDAP protocol versions. */
   private ConcurrentHashMap<Integer,List<ConnectionHandler>>
                supportedLDAPVersions;
 
-  // The set of extended operation handlers registered with the server (mapped
-  // between the OID of the extended operation and the handler).
+  /**
+   * The set of extended operation handlers registered with the server (mapped
+   * between the OID of the extended operation and the handler).
+   */
   private ConcurrentHashMap<String,ExtendedOperationHandler>
                extendedOperationHandlers;
 
-  // The set of monitor providers registered with the Directory Server, as a
-  // mapping between the monitor name and the corresponding implementation.
+  /**
+   * The set of monitor providers registered with the Directory Server, as a
+   * mapping between the monitor name and the corresponding implementation.
+   */
   private ConcurrentHashMap<String,
                             MonitorProvider<? extends MonitorProviderCfg>>
                monitorProviders;
 
-  // The set of password storage schemes defined in the server (mapped between
-  // the lowercase scheme name and the storage scheme) that support the
-  // authentication password syntax.
+  /**
+   * The set of password storage schemes defined in the server (mapped between
+   * the lowercase scheme name and the storage scheme) that support the
+   * authentication password syntax.
+   */
   private ConcurrentHashMap<String,PasswordStorageScheme>
                authPasswordStorageSchemes;
 
-  // The set of password storage schemes defined in the server (mapped between
-  // the lowercase scheme name and the storage scheme).
+  /**
+   * The set of password storage schemes defined in the server (mapped between
+   * the lowercase scheme name and the storage scheme).
+   */
   private ConcurrentHashMap<String,PasswordStorageScheme>
                passwordStorageSchemes;
 
-  // The set of password storage schemes defined in the server (mapped between
-  // the DN of the configuration entry and the storage scheme).
+  /**
+   * The set of password storage schemes defined in the server (mapped between
+   * the DN of the configuration entry and the storage scheme).
+   */
   private ConcurrentHashMap<DN,PasswordStorageScheme>
                passwordStorageSchemesByDN;
 
-  // The set of SASL mechanism handlers registered with the server (mapped
-  // between the mechanism name and the handler).
+  /**
+   * The set of SASL mechanism handlers registered with the server (mapped
+   * between the mechanism name and the handler).
+   */
   private ConcurrentHashMap<String,SASLMechanismHandler> saslMechanismHandlers;
 
-  // The connection handler configuration manager for the Directory Server.
+  /** The connection handler configuration manager for the Directory Server. */
   private ConnectionHandlerConfigManager connectionHandlerConfigManager = null;
 
-  // The set of alert handlers registered with the Directory Server.
+  /** The set of alert handlers registered with the Directory Server. */
   private CopyOnWriteArrayList<AlertHandler> alertHandlers;
 
-  // The set of backup task listeners registered with the Directory Server.
+  /** The set of backup task listeners registered with the Directory Server. */
   private CopyOnWriteArrayList<BackupTaskListener> backupTaskListeners;
 
-  // The set of change notification listeners registered with the Directory
-  // Server.
+  /**
+   * The set of change notification listeners registered with the Directory
+   * Server.
+   */
   private CopyOnWriteArrayList<ChangeNotificationListener>
                changeNotificationListeners;
 
-  // The set of connection handlers registered with the Directory Server.
+  /** The set of connection handlers registered with the Directory Server. */
   private CopyOnWriteArrayList<ConnectionHandler> connectionHandlers;
 
-  // The set of export task listeners registered with the Directory Server.
+  /** The set of export task listeners registered with the Directory Server. */
   private CopyOnWriteArrayList<ExportTaskListener> exportTaskListeners;
 
-  // The set of import task listeners registered with the Directory Server.
+  /** The set of import task listeners registered with the Directory Server. */
   private CopyOnWriteArrayList<ImportTaskListener> importTaskListeners;
 
-  // The set of restore task listeners registered with the Directory Server.
+  /** The set of restore task listeners registered with the Directory Server. */
   private CopyOnWriteArrayList<RestoreTaskListener> restoreTaskListeners;
 
-  // The set of initialization completed listeners that have been registered
-  // with the Directory Server.
+  /**
+   * The set of initialization completed listeners that have been registered
+   * with the Directory Server.
+   */
   private CopyOnWriteArrayList<InitializationCompletedListener>
           initializationCompletedListeners;
 
-  // The set of shutdown listeners that have been registered with the Directory
-  // Server.
+  /**
+   * The set of shutdown listeners that have been registered with the Directory
+   * Server.
+   */
   private CopyOnWriteArrayList<ServerShutdownListener> shutdownListeners;
 
-  // The set of synchronization providers that have been registered with the
-  // Directory Server.
+  /**
+   * The set of synchronization providers that have been registered with the
+   * Directory Server.
+   */
   private
     CopyOnWriteArrayList<SynchronizationProvider<SynchronizationProviderCfg>>
                synchronizationProviders;
 
-  // The set of virtual attributes defined in the server.
+  /** The set of virtual attributes defined in the server. */
   private CopyOnWriteArrayList<VirtualAttributeRule> virtualAttributes;
 
-  // The set of backend initialization listeners registered with the Directory
-  // Server.
+  /**
+   * The set of backend initialization listeners registered with the Directory
+   * Server.
+   */
   private CopyOnWriteArraySet<BackendInitializationListener>
                backendInitializationListeners;
 
-  // The set of root DNs registered with the Directory Server.
+  /** The set of root DNs registered with the Directory Server. */
   private CopyOnWriteArraySet<DN> rootDNs;
 
-  // The core configuration manager for the Directory Server.
+  /** The core configuration manager for the Directory Server. */
   private CoreConfigManager coreConfigManager;
 
-  // The crypto manager for the Directory Server.
+  /** The crypto manager for the Directory Server. */
   private CryptoManagerImpl cryptoManager;
 
-  // The default compressed schema manager.
+  /** The default compressed schema manager. */
   private DefaultCompressedSchema compressedSchema;
 
-  // The environment configuration for the Directory Server.
+  /** The environment configuration for the Directory Server. */
   private DirectoryEnvironmentConfig environmentConfig;
 
-  // The shutdown hook that has been registered with the server.
+  /** The shutdown hook that has been registered with the server. */
   private DirectoryServerShutdownHook shutdownHook;
 
-  // The DN of the default password policy configuration entry.
+  /** The DN of the default password policy configuration entry. */
   private DN defaultPasswordPolicyDN;
 
-  // The DN of the identity mapper that will be used to resolve authorization
-  // IDs contained in the proxied authorization V2 control.
+  /**
+   * The DN of the identity mapper that will be used to resolve authorization
+   * IDs contained in the proxied authorization V2 control.
+   */
   private DN proxiedAuthorizationIdentityMapperDN;
 
-  // The DN of the entry containing the server schema definitions.
+  /** The DN of the entry containing the server schema definitions. */
   private DN schemaDN;
 
-  // The Directory Server entry cache.
+  /** The Directory Server entry cache. */
   private EntryCache entryCache;
 
-  // The configuration manager for the entry cache.
+  /** The configuration manager for the entry cache. */
   private EntryCacheConfigManager entryCacheConfigManager;
 
-  // The configuration manager for extended operation handlers.
+  /** The configuration manager for extended operation handlers. */
   private ExtendedOperationConfigManager extendedOperationConfigManager;
 
-  // The path to the file containing the Directory Server configuration, or the
-  // information needed to bootstrap the configuration handler.
+  /**
+   * The path to the file containing the Directory Server configuration, or the
+   * information needed to bootstrap the configuration handler.
+   */
   private File configFile;
 
-  // The group manager for the Directory Server.
+  /** The group manager for the Directory Server. */
   private GroupManager groupManager;
 
-  // The subentry manager for the Directory Server.
+  /** The subentry manager for the Directory Server. */
   private SubentryManager subentryManager;
 
-  // The configuration manager for identity mappers.
+  /** The configuration manager for identity mappers. */
   private IdentityMapperConfigManager identityMapperConfigManager;
 
-  // The maximum number of entries that should be returned for a search unless
-  // overridden on a per-user basis.
+  /**
+   * The maximum number of entries that should be returned for a search unless
+   * overridden on a per-user basis.
+   */
   private int sizeLimit;
 
-  // The maximum length of time in seconds that should be allowed for a search
-  // unless overridden on a per-user basis.
+  /**
+   * The maximum length of time in seconds that should be allowed for a search
+   * unless overridden on a per-user basis.
+   */
   private int timeLimit;
 
-  // The maxiumum number of candidates that should be check for matches during
-  // a search.
+  /**
+   * The maximum number of candidates that should be check for matches during a
+   * search.
+   */
   private int lookthroughLimit;
 
-  // The current active persistent searches.
+  /** The current active persistent searches. */
   private AtomicInteger activePSearches = new AtomicInteger(0);
 
-  //The maximum number of concurrent persistent searches.
+  /** The maximum number of concurrent persistent searches. */
   private int maxPSearches;
 
-  // Whether to use collect operation processing times in nanosecond resolution
+  /**
+   * Whether to use collect operation processing times in nanosecond resolution.
+   */
   private boolean useNanoTime;
 
-  // The key manager provider configuration manager for the Directory Server.
+  /**
+   * The key manager provider configuration manager for the Directory Server.
+   */
   private KeyManagerProviderConfigManager keyManagerProviderConfigManager;
 
-  // The extension configuration manager for the Directory Server.
+  /** The extension configuration manager for the Directory Server. */
   private ExtensionConfigManager extensionConfigManager;
 
-  // The set of connections that are currently established.
+  /** The set of connections that are currently established. */
   private LinkedHashSet<ClientConnection> establishedConnections;
 
-  // The sets of mail server properties
+  /** The sets of mail server properties. */
   private List<Properties> mailServerPropertySets;
 
-  // The set of schema changes made by editing the schema configuration files
-  // with the server offline.
+  /**
+   * The set of schema changes made by editing the schema configuration files
+   * with the server offline.
+   */
   private List<Modification> offlineSchemaChanges;
 
-  // The log rotation policy config manager for the Directory Server.
+  /** The log rotation policy config manager for the Directory Server. */
   private LogRotationPolicyConfigManager rotationPolicyConfigManager;
 
-  // The log retention policy config manager for the Directory Server.
+  /** The log retention policy config manager for the Directory Server. */
   private LogRetentionPolicyConfigManager retentionPolicyConfigManager;
 
-  // The logger configuration manager for the Directory Server.
+  /** The logger configuration manager for the Directory Server. */
   private LoggerConfigManager loggerConfigManager;
 
-  // The number of connections currently established to the server.
+  /** The number of connections currently established to the server. */
   private long currentConnections;
 
-  // The idle time limit for the server.
+  /** The idle time limit for the server. */
   private long idleTimeLimit;
 
-  // The maximum number of connections that will be allowed at any given time.
+  /**
+   * The maximum number of connections that will be allowed at any given time.
+   */
   private long maxAllowedConnections;
 
-  // The maximum number of connections established at one time.
+  /** The maximum number of connections established at one time. */
   private long maxConnections;
 
-  // The time that this Directory Server instance was started.
+  /** The time that this Directory Server instance was started. */
   private long startUpTime;
 
-  // The total number of connections established since startup.
+  /** The total number of connections established since startup. */
   private long totalConnections;
 
-  // The MBean server used to handle JMX interaction.
+  /** The MBean server used to handle JMX interaction. */
   private MBeanServer mBeanServer;
 
-  // The monitor config manager for the Directory Server.
+  /** The monitor config manager for the Directory Server. */
   private MonitorConfigManager monitorConfigManager;
 
-  // The operating system on which the server is running.
+  /** The operating system on which the server is running. */
   private final OperatingSystem operatingSystem;
 
-  // The configuration handler used to manage the password generators.
+  /** The configuration handler used to manage the password generators. */
   private PasswordGeneratorConfigManager passwordGeneratorConfigManager;
 
-  // The default password policy for the Directory Server.
+  /** The default password policy for the Directory Server. */
   private PasswordPolicy defaultPasswordPolicy;
 
-  // The configuration handler used to manage the authentication policies.
+  /** The configuration handler used to manage the authentication policies. */
   private PasswordPolicyConfigManager authenticationPolicyConfigManager;
 
-  // The configuration handler used to manage the password storage schemes.
+  /** The configuration handler used to manage the password storage schemes. */
   private PasswordStorageSchemeConfigManager storageSchemeConfigManager;
 
-  // The configuration handler used to manage the password validators.
+  /** The configuration handler used to manage the password validators. */
   private PasswordValidatorConfigManager passwordValidatorConfigManager;
 
-  // The plugin config manager for the Directory Server.
+  /** The plugin config manager for the Directory Server. */
   private PluginConfigManager pluginConfigManager;
 
-  // The result code that should be used for internal "server" errors.
+  /** The result code that should be used for internal "server" errors. */
   private ResultCode serverErrorResultCode;
 
-  // The special backend used for the Directory Server root DSE.
+  /** The special backend used for the Directory Server root DSE. */
   private RootDSEBackend rootDSEBackend;
 
-  // The root DN config manager for the server.
+  /** The root DN config manager for the server. */
   private RootDNConfigManager rootDNConfigManager;
 
-  // The SASL mechanism config manager for the Directory Server.
+  /** The SASL mechanism config manager for the Directory Server. */
   private SASLConfigManager saslConfigManager;
 
-  // The schema for the Directory Server.
+  /** The schema for the Directory Server. */
   private Schema schema;
 
-  // The schema configuration manager for the Directory Server.
+  /** The schema configuration manager for the Directory Server. */
   private SchemaConfigManager schemaConfigManager;
 
-  // The set of disabled privileges.
+  /** The set of disabled privileges. */
   private Set<Privilege> disabledPrivileges;
 
-  // The set of allowed task classes.
+  /** The set of allowed task classes. */
   private Set<String> allowedTasks;
 
-  // The time that the server was started, formatted in UTC time.
+  /** The time that the server was started, formatted in UTC time. */
   private String startTimeUTC;
 
-  // The synchronization provider configuration manager for the Directory
-  // Server.
+  /**
+   * The synchronization provider configuration manager for the Directory
+   * Server.
+   */
   private SynchronizationProviderConfigManager
                synchronizationProviderConfigManager;
 
-  // Registry for base DN and naming context information.
+  /** Registry for base DN and naming context information. */
   private BaseDnRegistry baseDnRegistry;
 
 
-  // The set of backends registered with the server.
+  /** The set of backends registered with the server. */
   private TreeMap<String,Backend> backends;
 
-  // The mapping between backends and their unique indentifiers for their
-  // offline state, representing either checksum or other unique value to
-  // be used for detecting any offline modifications to a given backend.
+  /**
+   * The mapping between backends and their unique identifiers for their offline
+   * state, representing either checksum or other unique value to be used for
+   * detecting any offline modifications to a given backend.
+   */
   private ConcurrentHashMap<String,Long> offlineBackendsStateIDs;
 
-  // The set of supported controls registered with the Directory Server.
+  /** The set of supported controls registered with the Directory Server. */
   private TreeSet<String> supportedControls;
 
-  // The set of supported feature OIDs registered with the Directory Server.
+  /** The set of supported feature OIDs registered with the Directory Server. */
   private TreeSet<String> supportedFeatures;
 
-  // The trust manager provider configuration manager for the Directory Server.
+  /**
+   * The trust manager provider configuration manager for the Directory Server.
+   */
   private TrustManagerProviderConfigManager trustManagerProviderConfigManager;
 
-  // The virtual attribute provider configuration manager for the Directory
-  // Server.
+  /**
+   * The virtual attribute provider configuration manager for the Directory
+   * Server.
+   */
   private VirtualAttributeConfigManager virtualAttributeConfigManager;
 
-  // The work queue that will be used to service client requests.
+  /** The work queue that will be used to service client requests. */
   private WorkQueue workQueue;
 
-  // The writability mode for the Directory Server.
+  /** The writability mode for the Directory Server. */
   private WritabilityMode writabilityMode;
 
-  // The mappings between the names and WorkflowElements
-  // registered with the Directory Server
+  /**
+   * The mappings between the names and WorkflowElements registered with the
+   * Directory Server.
+   */
   private final ConcurrentHashMap<String, WorkflowElement> workflowElements =
           new ConcurrentHashMap<String, WorkflowElement>();
 
-  // The workflow configuration mode (auto or manual).
+  /** The workflow configuration mode (auto or manual). */
   private WorkflowConfigurationMode workflowConfigurationMode;
 
-  // The network group config manager for the Directory Server.
-  // This config manager is used when the workflow configuration
-  // mode is 'manual'.
+  /**
+   * The network group config manager for the Directory Server. This config
+   * manager is used when the workflow configuration mode is 'manual'.
+   */
   private NetworkGroupConfigManager networkGroupConfigManager;
 
-  // The workflow config manager for the Directory Server.
-  // This config manager is used when the workflow configuration
-  // mode is 'manual'.
+  /**
+   * The workflow config manager for the Directory Server. This config manager
+   * is used when the workflow configuration mode is 'manual'.
+   */
   private WorkflowConfigManager workflowConfigManager;
 
-  // The workflow element config manager for the Directory Server.
-  // This config manager is used when the workflow configuration
-  // mode is 'manual'.
+  /**
+   * The workflow element config manager for the Directory Server. This config
+   * manager is used when the workflow configuration mode is 'manual'.
+   */
   private WorkflowElementConfigManager workflowElementConfigManager;
 
-  // The maximum size that internal buffers will be allowed to grow to until
-  // they are trimmed.
+  /**
+   * The maximum size that internal buffers will be allowed to grow to until
+   * they are trimmed.
+   */
   private int maxInternalBufferSize = DEFAULT_MAX_INTERNAL_BUFFER_SIZE;
 
   /**
@@ -7215,7 +7295,7 @@
    * @throws  DirectoryException  If a problem prevents the operation from being
    *                              added to the queue (e.g., the queue is full).
    */
-  public static void enqueueRequest(AbstractOperation operation)
+  public static void enqueueRequest(Operation operation)
          throws DirectoryException
   {
     ClientConnection clientConnection = operation.getClientConnection();
@@ -9067,7 +9147,7 @@
   @Override
   public String getClassName()
   {
-    return CLASS_NAME;
+    return DirectoryServer.class.getName();
   }
 
 
diff --git a/opends/src/server/org/opends/server/core/OperationWrapper.java b/opends/src/server/org/opends/server/core/OperationWrapper.java
index d385c16..355fd6a 100644
--- a/opends/src/server/org/opends/server/core/OperationWrapper.java
+++ b/opends/src/server/org/opends/server/core/OperationWrapper.java
@@ -23,16 +23,15 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
- *      Portions Copyright 2011 ForgeRock AS
+ *      Portions Copyright 2011-2013 ForgeRock AS
  */
 package org.opends.server.core;
 
-import org.opends.messages.MessageBuilder;
-import org.opends.messages.Message;
-
 import java.util.List;
 import java.util.Map;
 
+import org.opends.messages.Message;
+import org.opends.messages.MessageBuilder;
 import org.opends.server.api.ClientConnection;
 import org.opends.server.types.*;
 import org.opends.server.controls.ControlDecoder;
@@ -44,7 +43,7 @@
  */
 public class OperationWrapper implements Operation
 {
-  // The wrapped operation.
+  /** The wrapped operation. */
   private Operation operation;
 
 
@@ -61,6 +60,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void addRequestControl(Control control)
   {
     operation.addRequestControl(control);
@@ -69,6 +69,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void addResponseControl(Control control)
   {
     operation.addResponseControl(control);
@@ -77,6 +78,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void appendErrorMessage(Message message)
   {
     operation.appendErrorMessage(message);
@@ -85,6 +87,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public CancelResult cancel(CancelRequest cancelRequest)
   {
     return operation.cancel(cancelRequest);
@@ -93,6 +96,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void abort(CancelRequest cancelRequest)
   {
     operation.abort(cancelRequest);
@@ -101,6 +105,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void disconnectClient(
           DisconnectReason disconnectReason,
           boolean sendNotification,
@@ -114,6 +119,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean dontSynchronize()
   {
     return operation.dontSynchronize();
@@ -122,6 +128,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public Object getAttachment(String name)
   {
     return operation.getAttachment(name);
@@ -130,6 +137,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public Map<String, Object> getAttachments()
   {
     return operation.getAttachments();
@@ -138,6 +146,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public DN getAuthorizationDN()
   {
     return operation.getAuthorizationDN();
@@ -146,6 +155,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public Entry getAuthorizationEntry()
   {
     return operation.getAuthorizationEntry();
@@ -154,6 +164,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public CancelRequest getCancelRequest()
   {
     return operation.getCancelRequest();
@@ -162,6 +173,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public CancelResult getCancelResult()
   {
     return operation.getCancelResult();
@@ -170,6 +182,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public ClientConnection getClientConnection()
   {
     return operation.getClientConnection();
@@ -178,6 +191,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public String[][] getCommonLogElements()
   {
     return operation.getCommonLogElements();
@@ -186,6 +200,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public long getConnectionID()
   {
     return operation.getConnectionID();
@@ -194,6 +209,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public MessageBuilder getErrorMessage()
   {
     return operation.getErrorMessage();
@@ -202,6 +218,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public DN getMatchedDN()
   {
     return operation.getMatchedDN();
@@ -210,6 +227,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public int getMessageID()
   {
     return operation.getMessageID();
@@ -218,6 +236,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public long getOperationID()
   {
     return operation.getOperationID();
@@ -226,6 +245,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public OperationType getOperationType()
   {
     return operation.getOperationType();
@@ -234,6 +254,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public long getProcessingStartTime()
   {
     return operation.getProcessingStartTime();
@@ -242,6 +263,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public long getProcessingStopTime()
   {
     return operation.getProcessingStopTime();
@@ -250,6 +272,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public long getProcessingTime()
   {
     return operation.getProcessingTime();
@@ -258,6 +281,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public long getProcessingNanoTime()
   {
     return operation.getProcessingNanoTime();
@@ -266,6 +290,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public List<String> getReferralURLs()
   {
     return operation.getReferralURLs();
@@ -274,6 +299,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public List<Control> getRequestControls()
   {
     return operation.getRequestControls();
@@ -282,6 +308,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public <T extends Control> T getRequestControl(
       ControlDecoder<T> d)throws DirectoryException
   {
@@ -291,6 +318,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public String[][] getRequestLogElements()
   {
     return operation.getRequestLogElements();
@@ -299,6 +327,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public List<Control> getResponseControls()
   {
     return operation.getResponseControls();
@@ -307,6 +336,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public String[][] getResponseLogElements()
   {
     return operation.getResponseLogElements();
@@ -315,6 +345,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public ResultCode getResultCode()
   {
     return operation.getResultCode();
@@ -323,6 +354,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isInternalOperation()
   {
     return operation.isInternalOperation();
@@ -331,6 +363,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isSynchronizationOperation()
   {
     return operation.isSynchronizationOperation();
@@ -339,6 +372,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void operationCompleted()
   {
     operation.operationCompleted();
@@ -347,6 +381,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public Object removeAttachment(String name)
   {
     return operation.removeAttachment(name);
@@ -355,6 +390,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void removeRequestControl(Control control)
   {
     operation.removeRequestControl(control);
@@ -363,6 +399,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void removeResponseControl(Control control)
   {
     operation.removeResponseControl(control);
@@ -371,6 +408,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public Object setAttachment(String name, Object value)
   {
     return operation.setAttachment(name, value);
@@ -379,6 +417,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setAttachments(Map<String, Object> attachments)
   {
     operation.setAttachments(attachments);
@@ -387,6 +426,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setAuthorizationEntry(Entry authorizationEntry)
   {
     operation.setAuthorizationEntry(authorizationEntry);
@@ -395,6 +435,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setDontSynchronize(boolean dontSynchronize)
   {
     operation.setDontSynchronize(dontSynchronize);
@@ -403,6 +444,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setErrorMessage(MessageBuilder errorMessage)
   {
     operation.setErrorMessage(errorMessage);
@@ -411,6 +453,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setInternalOperation(boolean isInternalOperation)
   {
     operation.setInternalOperation(isInternalOperation);
@@ -419,6 +462,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setMatchedDN(DN matchedDN)
   {
     operation.setMatchedDN(matchedDN);
@@ -427,6 +471,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setReferralURLs(List<String> referralURLs)
   {
     operation.setReferralURLs(referralURLs);
@@ -435,6 +480,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setResponseData(DirectoryException directoryException)
   {
     operation.setResponseData(directoryException);
@@ -443,6 +489,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setResultCode(ResultCode resultCode)
   {
     operation.setResultCode(resultCode);
@@ -451,6 +498,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void setSynchronizationOperation(boolean isSynchronizationOperation)
   {
     operation.setSynchronizationOperation(isSynchronizationOperation);
@@ -461,6 +509,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public final int hashCode()
   {
     return getClientConnection().hashCode() * (int) getOperationID();
@@ -471,6 +520,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public final boolean equals(Object obj)
   {
     if (this == obj)
@@ -495,6 +545,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void toString(StringBuilder buffer)
   {
     operation.toString(buffer);
@@ -503,6 +554,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public synchronized final void checkIfCanceled(boolean signalTooLate)
       throws CanceledOperationException {
     operation.checkIfCanceled(signalTooLate);
@@ -511,14 +563,23 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void registerPostResponseCallback(Runnable callback)
   {
     operation.registerPostResponseCallback(callback);
   }
 
+  /** {@inheritDoc} */
+  @Override
+  public void run()
+  {
+    operation.run();
+  }
+
   /**
    * {@inheritDoc}
    */
+  @Override
   public List<AdditionalLogItem> getAdditionalLogItems()
   {
     return operation.getAdditionalLogItems();
@@ -527,6 +588,7 @@
   /**
    *{@inheritDoc}
    */
+  @Override
   public void addAdditionalLogItem(AdditionalLogItem item)
   {
     operation.addAdditionalLogItem(item);
diff --git a/opends/src/server/org/opends/server/extensions/ParallelWorkQueue.java b/opends/src/server/org/opends/server/extensions/ParallelWorkQueue.java
index a910bef..7cf3e35 100644
--- a/opends/src/server/org/opends/server/extensions/ParallelWorkQueue.java
+++ b/opends/src/server/org/opends/server/extensions/ParallelWorkQueue.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions copyright 2013 ForgeRock AS.
  */
 package org.opends.server.extensions;
 
@@ -83,31 +84,37 @@
 
 
 
-  // The set of worker threads that will be used to process this work queue.
+  /** 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;
 
-  // Indicates whether one or more of the worker threads needs to be killed at
-  // the next convenient opportunity.
+  /**
+   * Indicates whether one or more of the worker threads needs to be killed at
+   * the next convenient opportunity.
+   */
   private boolean killThreads;
 
-  // Indicates whether the Directory Server is shutting down.
+  /** Indicates whether the Directory Server is shutting down. */
   private boolean shutdownRequested;
 
-  // The thread number used for the last worker thread that was created.
+  /** The thread number used for the last worker thread that was created. */
   private int lastThreadNumber;
 
-  // The number of worker threads that should be active (or will be shortly if
-  // a configuration change has not been completely applied).
+  /**
+   * The number of worker threads that should be active (or will be shortly if a
+   * configuration change has not been completely applied).
+   */
   private int numWorkerThreads;
 
-  // The queue that will be used to actually hold the pending operations.
-  private ConcurrentLinkedQueue<AbstractOperation> opQueue;
+  /** The queue that will be used to actually hold the pending operations. */
+  private ConcurrentLinkedQueue<Operation> opQueue;
 
-  // The lock used to provide threadsafe access for the queue.
+  /** The lock used to provide threadsafe access for the queue. */
   private final Object queueLock = new Object();
 
 
@@ -143,7 +150,7 @@
     numWorkerThreads = getNumWorkerThreads(configuration);
 
     // Create the actual work queue.
-    opQueue = new ConcurrentLinkedQueue<AbstractOperation>();
+    opQueue = new ConcurrentLinkedQueue<Operation>();
 
     // Create the set of worker threads that should be used to service the
     // work queue.
@@ -266,8 +273,7 @@
    *                              at its maximum capacity).
    */
   @Override
-  public void submitOperation(AbstractOperation operation)
-         throws DirectoryException
+  public void submitOperation(Operation operation) throws DirectoryException
   {
     if (shutdownRequested)
     {
@@ -294,7 +300,7 @@
    *          if the server is shutting down and no more operations will be
    *          processed.
    */
-  public AbstractOperation nextOperation(ParallelWorkerThread workerThread)
+  public Operation nextOperation(ParallelWorkerThread workerThread)
   {
     return retryNextOperation(workerThread, 0);
   }
@@ -317,7 +323,7 @@
    *          if the server is shutting down and no more operations will be
    *          processed, or if there have been too many consecutive failures.
    */
-  private AbstractOperation retryNextOperation(
+  private Operation retryNextOperation(
                                        ParallelWorkerThread workerThread,
                                        int numFailures)
   {
@@ -333,8 +339,7 @@
           int currentThreads = workerThreads.size();
           if (currentThreads > numWorkerThreads)
           {
-            if (workerThreads.remove((ParallelWorkerThread)
-              Thread.currentThread()))
+            if (workerThreads.remove(Thread.currentThread()))
             {
               currentThreads--;
             }
@@ -374,7 +379,7 @@
     {
       while (true)
       {
-        AbstractOperation nextOperation = null;
+        Operation nextOperation = null;
         if (queueSemaphore.tryAcquire(5, TimeUnit.SECONDS)) {
           nextOperation = opQueue.poll();
         }
@@ -395,8 +400,7 @@
                 int currentThreads = workerThreads.size();
                 if (currentThreads > numWorkerThreads)
                 {
-                  if (workerThreads.remove((ParallelWorkerThread)
-                    Thread.currentThread()))
+                  if (workerThreads.remove(Thread.currentThread()))
                   {
                     currentThreads--;
                   }
@@ -494,6 +498,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isConfigurationChangeAcceptable(
                       ParallelWorkQueueCfg configuration,
                       List<Message> unacceptableReasons)
@@ -506,6 +511,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public ConfigChangeResult applyConfigurationChange(
                                  ParallelWorkQueueCfg configuration)
   {
diff --git a/opends/src/server/org/opends/server/extensions/ParallelWorkerThread.java b/opends/src/server/org/opends/server/extensions/ParallelWorkerThread.java
index 8a3b61f..5ff68e5 100644
--- a/opends/src/server/org/opends/server/extensions/ParallelWorkerThread.java
+++ b/opends/src/server/org/opends/server/extensions/ParallelWorkerThread.java
@@ -23,24 +23,24 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Portions copyright 2013 ForgeRock AS.
  */
 package org.opends.server.extensions;
-import org.opends.messages.Message;
-
 
 
 import java.util.Map;
 
+import org.opends.messages.Message;
 import org.opends.server.api.DirectoryThread;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.AbstractOperation;
+import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.types.CancelRequest;
 import org.opends.server.types.DebugLogLevel;
 import org.opends.server.types.DisconnectReason;
+import org.opends.server.types.Operation;
 
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
-import org.opends.server.loggers.debug.DebugTracer;
 import static org.opends.messages.CoreMessages.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -57,24 +57,28 @@
    */
   private static final DebugTracer TRACER = getTracer();
 
-  // Indicates whether the Directory Server is shutting down and this thread
-  // should stop running.
+  /**
+   * Indicates whether the Directory Server is shutting down and this thread
+   * should stop running.
+   */
   private boolean shutdownRequested;
 
-  // Indicates whether this thread was stopped because the server threadnumber
-  // was reduced.
+  /**
+   * Indicates whether this thread was stopped because the server threadnumber
+   * was reduced.
+   */
   private boolean stoppedByReducedThreadNumber;
 
-  // Indicates whether this thread is currently waiting for work.
+  /** Indicates whether this thread is currently waiting for work. */
   private boolean waitingForWork;
 
-  // The operation that this worker thread is currently processing.
-  private AbstractOperation operation;
+  /** The operation that this worker thread is currently processing. */
+  private Operation operation;
 
-  // The handle to the actual thread for this worker thread.
+  /** The handle to the actual thread for this worker thread. */
   private Thread workerThread;
 
-  // The work queue that this worker thread will service.
+  /** The work queue that this worker thread will service. */
   private ParallelWorkQueue workQueue;
 
 
diff --git a/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java b/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
index a3d04fc..4f79854 100644
--- a/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
+++ b/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions copyright 2013 ForgeRock AS.
  */
 package org.opends.server.extensions;
 
@@ -30,9 +31,8 @@
 
 import static org.opends.messages.ConfigMessages.*;
 import static org.opends.messages.CoreMessages.*;
-import static org.opends.server.loggers.ErrorLogger.logError;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.debug.DebugLogger.getTracer;
+import static org.opends.server.loggers.ErrorLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -73,54 +73,70 @@
    */
   private static final int MAX_RETRY_COUNT = 5;
 
-  // The set of worker threads that will be used to process this work queue.
+  /** The set of worker threads that will be used to process this work queue. */
   private final ArrayList<TraditionalWorkerThread> workerThreads =
     new ArrayList<TraditionalWorkerThread>();
 
-  // 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;
 
-  // The number of times that an attempt to submit a new request has been
-  // rejected because the work queue is already at its maximum capacity.
+  /**
+   * The number of times that an attempt to submit a new request has been
+   * rejected because the work queue is already at its maximum capacity.
+   */
   private AtomicLong queueFullRejects;
 
-  // Indicates whether one or more of the worker threads needs to be killed at
-  // the next convenient opportunity.
+  /**
+   * Indicates whether one or more of the worker threads needs to be killed at
+   * the next convenient opportunity.
+   */
   private boolean killThreads;
 
-  // Indicates whether the Directory Server is shutting down.
+  /** Indicates whether the Directory Server is shutting down. */
   private boolean shutdownRequested;
 
-  // The thread number used for the last worker thread that was created.
+  /** The thread number used for the last worker thread that was created. */
   private int lastThreadNumber;
 
-  // The maximum number of pending requests that this work queue will allow
-  // before it will start rejecting them.
+  /**
+   * The maximum number of pending requests that this work queue will allow
+   * before it will start rejecting them.
+   */
   private int maxCapacity;
 
-  // The number of worker threads that should be active (or will be shortly if
-  // a configuration change has not been completely applied).
+  /**
+   * The number of worker threads that should be active (or will be shortly if a
+   * configuration change has not been completely applied).
+   */
   private int numWorkerThreads;
 
-  // The queue overflow policy: true indicates that operations will be blocked
-  // until the queue has available capacity, otherwise operations will be
-  // rejected.
-  //
-  // This is hard-coded to true for now because a reject on full policy does
-  // not seem to have a valid use case.
-  //
+  /**
+   * The queue overflow policy: true indicates that operations will be blocked
+   * until the queue has available capacity, otherwise operations will be
+   * rejected.
+   * <p>
+   * This is hard-coded to true for now because a reject on full policy does not
+   * seem to have a valid use case.
+   * </p>
+   */
   private final boolean isBlocking = true;
 
-  // The queue that will be used to actually hold the pending operations.
-  private LinkedBlockingQueue<AbstractOperation> opQueue;
+  /** The queue that will be used to actually hold the pending operations. */
+  private LinkedBlockingQueue<Operation> opQueue;
 
-  // The locks used to provide threadsafe access for the queue.
-
-  // Used for non-config changes.
+  /**
+   * The lock used to provide threadsafe access for the queue, used for
+   * non-config changes.
+   */
   private final ReadLock queueReadLock;
 
-  // Used for config changes.
+  /**
+   * The lock used to provide threadsafe access for the queue, used for config
+   * changes.
+   */
   private final WriteLock queueWriteLock;
   {
     ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
@@ -166,13 +182,13 @@
       // Create the actual work queue.
       if (maxCapacity > 0)
       {
-        opQueue = new LinkedBlockingQueue<AbstractOperation>(maxCapacity);
+        opQueue = new LinkedBlockingQueue<Operation>(maxCapacity);
       }
       else
       {
         // This will never be the case, since the configuration definition
         // ensures that the capacity is always finite.
-        opQueue = new LinkedBlockingQueue<AbstractOperation>();
+        opQueue = new LinkedBlockingQueue<Operation>();
       }
 
       // Create the set of worker threads that should be used to service the
@@ -316,8 +332,7 @@
    *           already at its maximum capacity).
    */
   @Override
-  public void submitOperation(AbstractOperation operation)
-      throws DirectoryException
+  public void submitOperation(Operation operation) throws DirectoryException
   {
     queueReadLock.lock();
     try
@@ -396,7 +411,7 @@
    *         if the server is shutting down and no more operations will be
    *         processed.
    */
-  public AbstractOperation nextOperation(TraditionalWorkerThread workerThread)
+  public Operation nextOperation(TraditionalWorkerThread workerThread)
   {
     return retryNextOperation(workerThread, 0);
   }
@@ -419,8 +434,8 @@
    *         if the server is shutting down and no more operations will be
    *         processed, or if there have been too many consecutive failures.
    */
-  private AbstractOperation retryNextOperation(
-      TraditionalWorkerThread workerThread, int numFailures)
+  private Operation retryNextOperation(TraditionalWorkerThread workerThread,
+      int numFailures)
   {
     // See if we should kill off this thread. This could be necessary if the
     // number of worker threads has been decreased with the server online. If
@@ -449,7 +464,7 @@
 
       while (true)
       {
-        AbstractOperation nextOperation = opQueue.poll(5, TimeUnit.SECONDS);
+        Operation nextOperation = opQueue.poll(5, TimeUnit.SECONDS);
         if (nextOperation != null)
         {
           return nextOperation;
@@ -627,6 +642,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isConfigurationChangeAcceptable(
       TraditionalWorkQueueCfg configuration, List<Message> unacceptableReasons)
   {
@@ -638,6 +654,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public ConfigChangeResult applyConfigurationChange(
       TraditionalWorkQueueCfg configuration)
   {
@@ -695,18 +712,18 @@
     {
       // First switch the queue with the exclusive lock.
       queueWriteLock.lock();
-      LinkedBlockingQueue<AbstractOperation> oldOpQueue;
+      LinkedBlockingQueue<Operation> oldOpQueue;
       try
       {
-        LinkedBlockingQueue<AbstractOperation> newOpQueue = null;
+        LinkedBlockingQueue<Operation> newOpQueue = null;
         if (newMaxCapacity > 0)
         {
-          newOpQueue = new LinkedBlockingQueue<AbstractOperation>(
+          newOpQueue = new LinkedBlockingQueue<Operation>(
               newMaxCapacity);
         }
         else
         {
-          newOpQueue = new LinkedBlockingQueue<AbstractOperation>();
+          newOpQueue = new LinkedBlockingQueue<Operation>();
         }
 
         oldOpQueue = opQueue;
@@ -720,7 +737,7 @@
       }
 
       // Now resubmit any pending requests - we'll need the shared lock.
-      AbstractOperation pendingOperation = null;
+      Operation pendingOperation = null;
       queueReadLock.lock();
       try
       {
@@ -747,10 +764,7 @@
         }
         while ((pendingOperation = oldOpQueue.poll()) != null)
         {
-          if (pendingOperation != null)
-          {
-            pendingOperation.abort(cancelRequest);
-          }
+          pendingOperation.abort(cancelRequest);
         }
       }
       finally
diff --git a/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java b/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
index c492e34..bc73665 100644
--- a/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
+++ b/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
@@ -23,25 +23,24 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
- *      Portions copyright 2011 ForgeRock AS
+ *      Portions copyright 2011-2013 ForgeRock AS
  */
 package org.opends.server.extensions;
-import org.opends.messages.Message;
-
 
 
 import java.util.Map;
 
+import org.opends.messages.Message;
 import org.opends.server.api.DirectoryThread;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.AbstractOperation;
+import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.types.CancelRequest;
 import org.opends.server.types.DebugLogLevel;
 import org.opends.server.types.DisconnectReason;
+import org.opends.server.types.Operation;
 
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
-import org.opends.server.loggers.debug.DebugTracer;
 import static org.opends.messages.CoreMessages.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -58,24 +57,28 @@
    */
   private static final DebugTracer TRACER = getTracer();
 
-  // Indicates whether the Directory Server is shutting down and this thread
-  // should stop running.
+  /**
+   * Indicates whether the Directory Server is shutting down and this thread
+   * should stop running.
+   */
   private volatile boolean shutdownRequested;
 
-  // Indicates whether this thread was stopped because the server threadnumber
-  // was reduced.
+  /**
+   * Indicates whether this thread was stopped because the server threadnumber
+   * was reduced.
+   */
   private boolean stoppedByReducedThreadNumber;
 
-  // Indicates whether this thread is currently waiting for work.
+  /** Indicates whether this thread is currently waiting for work. */
   private boolean waitingForWork;
 
-  // The operation that this worker thread is currently processing.
-  private AbstractOperation operation;
+  /** The operation that this worker thread is currently processing. */
+  private Operation operation;
 
-  // The handle to the actual thread for this worker thread.
+  /** The handle to the actual thread for this worker thread. */
   private Thread workerThread;
 
-  // The work queue that this worker thread will service.
+  /** The work queue that this worker thread will service. */
   private TraditionalWorkQueue workQueue;
 
 
@@ -136,6 +139,7 @@
    * Operates in a loop, retrieving the next request from the work queue,
    * processing it, and then going back to the queue for more.
    */
+  @Override
   public void run()
   {
     workerThread = currentThread();
@@ -279,7 +283,7 @@
     {
       try
       {
-        final AbstractOperation localOperation = operation;
+        final Operation localOperation = operation;
         if (localOperation != null)
         {
           CancelRequest cancelRequest = new CancelRequest(true,
@@ -306,6 +310,7 @@
    *
    * @return debug information about this thread as a string.
    */
+  @Override
   public Map<String, String> getDebugProperties()
   {
     Map<String, String> properties = super.getDebugProperties();
diff --git a/opends/src/server/org/opends/server/types/Operation.java b/opends/src/server/org/opends/server/types/Operation.java
index da360f4..bc8b156 100644
--- a/opends/src/server/org/opends/server/types/Operation.java
+++ b/opends/src/server/org/opends/server/types/Operation.java
@@ -23,19 +23,17 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
- *      Portions copyright 2011 ForgeRock AS.
+ *      Portions copyright 2011-2013 ForgeRock AS.
  */
 package org.opends.server.types;
-import org.opends.messages.Message;
-
-
 
 import java.util.List;
 import java.util.Map;
 
+import org.opends.messages.Message;
+import org.opends.messages.MessageBuilder;
 import org.opends.server.api.ClientConnection;
 import org.opends.server.controls.ControlDecoder;
-import org.opends.messages.MessageBuilder;
 
 
 /**
@@ -53,7 +51,7 @@
      mayInstantiate=false,
      mayExtend=false,
      mayInvoke=true)
-public interface Operation
+public interface Operation extends Runnable
 {
   /**
    * Identifier used to get the local operation [if any] in the
@@ -73,7 +71,7 @@
    * Terminates the client connection being used to process this
    * operation.  If this is called by a plugin, then that plugin must
    * return a result indicating that the  client connection has been
-   * teriminated.
+   * terminated.
    *
    * @param  disconnectReason  The disconnect reason that provides the
    *                           generic cause for the disconnect.
@@ -584,6 +582,7 @@
    *
    * @return  A string representation of this operation.
    */
+  @Override
   public abstract String toString();
 
   /**

--
Gitblit v1.10.0