From 2cf4412179a4ca8610d7fbb2108040377290bf82 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 06 Jun 2014 13:12:34 +0000
Subject: [PATCH] OPENDJ-1453 (CR-3697) Change time heart beat change numbers should be synced with updates
---
opends/src/server/org/opends/server/core/DirectoryServer.java | 104 ++++++++++++++++++++-------------------------------
1 files changed, 41 insertions(+), 63 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 35ed81b..fd2cd43 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2010-2013 ForgeRock AS.
+ * Portions Copyright 2010-2014 ForgeRock AS.
*/
package org.opends.server.core;
@@ -136,43 +136,43 @@
* Returned when the user specified the --checkStartability option with other
* options like printing the usage, dumping messages, displaying version, etc.
*/
- private static int NOTHING_TO_DO = 0;
+ private static final int NOTHING_TO_DO = 0;
/**
* Returned when the user specified the --checkStartability option with
* some incompatible arguments.
*/
- private static int CHECK_ERROR = 1;
+ private static final int CHECK_ERROR = 1;
/**
* The server is already started.
*/
- private static int SERVER_ALREADY_STARTED = 98;
+ private static final int SERVER_ALREADY_STARTED = 98;
/**
* The server must be started as detached process.
*/
- private static int START_AS_DETACH = 99;
+ private static final int START_AS_DETACH = 99;
/**
* The server must be started as a non-detached process.
*/
- private static int START_AS_NON_DETACH = 100;
+ private static final int START_AS_NON_DETACH = 100;
/**
* The server must be started as a window service.
*/
- private static int START_AS_WINDOWS_SERVICE = 101;
+ private static final int START_AS_WINDOWS_SERVICE = 101;
/**
* The server must be started as detached and it is being called from the
* Windows Service.
*/
- private static int START_AS_DETACH_CALLED_FROM_WINDOWS_SERVICE = 102;
+ private static final int START_AS_DETACH_CALLED_FROM_WINDOWS_SERVICE = 102;
/**
* The server must be started as detached process and should not produce any
* output.
*/
- private static int START_AS_DETACH_QUIET = 103;
+ private static final int START_AS_DETACH_QUIET = 103;
/**
* The server must be started as non-detached process and should not produce
* any output.
*/
- private static int START_AS_NON_DETACH_QUIET = 104;
+ private static final int START_AS_NON_DETACH_QUIET = 104;
/** The policy to use regarding single structural objectclass enforcement. */
private AcceptRejectWarn singleStructuralClassPolicy;
@@ -524,7 +524,7 @@
private int lookthroughLimit;
/** The current active persistent searches. */
- private AtomicInteger activePSearches = new AtomicInteger(0);
+ private final AtomicInteger activePSearches = new AtomicInteger(0);
/** The maximum number of concurrent persistent searches. */
private int maxPSearches;
@@ -951,8 +951,7 @@
* @throws InitializationException If a problem occurs while attempting to
* bootstrap the server.
*/
- public void bootstrapServer()
- throws InitializationException
+ private void bootstrapServer() throws InitializationException
{
// First, make sure that the server isn't currently running. If it isn't,
// then make sure that no other thread will try to start or bootstrap the
@@ -2015,7 +2014,7 @@
* the backends that is not related to the
* server configuration.
*/
- public void initializeBackends()
+ private void initializeBackends()
throws ConfigException, InitializationException
{
backendConfigManager = new BackendConfigManager();
@@ -2119,9 +2118,8 @@
* workflow conflicts with the workflow
* ID of an existing workflow.
*/
- public static void createAndRegisterWorkflowsWithDefaultNetworkGroup(
- Backend backend
- ) throws DirectoryException
+ private static void createAndRegisterWorkflowsWithDefaultNetworkGroup(
+ Backend backend) throws DirectoryException
{
// Create a workflow for each backend base DN and register the workflow
// with the default/internal/admin network group.
@@ -2152,10 +2150,8 @@
* workflow conflicts with the workflow
* ID of an existing workflow.
*/
- public static WorkflowImpl createWorkflow(
- DN baseDN,
- Backend backend
- ) throws DirectoryException
+ private static WorkflowImpl createWorkflow(DN baseDN, Backend backend)
+ throws DirectoryException
{
String backendID = backend.getBackendID();
@@ -2348,7 +2344,7 @@
* attempting to initialize and start the
* Directory Server.
*/
- public void configureWorkflowsManual()
+ private void configureWorkflowsManual()
throws ConfigException, InitializationException
{
// First of all re-initialize the current workflow configuration
@@ -2436,7 +2432,7 @@
* the group manager that is not related to
* the server configuration.
*/
- public void initializeGroupManager()
+ private void initializeGroupManager()
throws ConfigException, InitializationException
{
try
@@ -7915,16 +7911,9 @@
directoryServer.shuttingDown = true;
}
- try {
- directoryServer.configHandler.getConfigRootEntry();
- } catch (Exception e) {
-
- }
-
// Send an alert notification that the server is shutting down.
- Message message = NOTE_SERVER_SHUTDOWN.get(className, reason);
sendAlertNotification(directoryServer, ALERT_TYPE_SERVER_SHUTDOWN,
- message);
+ NOTE_SERVER_SHUTDOWN.get(className, reason));
// Create a shutdown monitor that will watch the rest of the shutdown
@@ -7951,7 +7940,18 @@
}
directoryServer.connectionHandlers.clear();
+ if (directoryServer.workQueue != null)
+ {
+ directoryServer.workQueue.finalizeWorkQueue(reason);
+ directoryServer.workQueue.waitUntilIdle(ServerShutdownMonitor.WAIT_TIME);
+ }
+ // shutdown replication
+ for (SynchronizationProvider provider :
+ directoryServer.synchronizationProviders)
+ {
+ provider.finalizeSynchronizationProvider();
+ }
// Call the shutdown plugins, and then finalize all the plugins defined in
// the server.
@@ -7961,14 +7961,6 @@
directoryServer.pluginConfigManager.finalizePlugins();
}
-
- // shutdown the Synchronization Providers
- for (SynchronizationProvider provider :
- directoryServer.synchronizationProviders)
- {
- provider.finalizeSynchronizationProvider();
- }
-
// Deregister the shutdown hook.
if (directoryServer.shutdownHook != null)
{
@@ -7980,13 +7972,6 @@
}
- // Stop the work queue.
- if (directoryServer.workQueue != null)
- {
- directoryServer.workQueue.finalizeWorkQueue(reason);
- }
-
-
// Notify all the shutdown listeners.
for (ServerShutdownListener shutdownListener :
directoryServer.shutdownListeners)
@@ -8151,9 +8136,8 @@
StringBuilder failureReason = new StringBuilder();
if (! LockFileManager.releaseLock(lockFile, failureReason))
{
- message = WARN_SHUTDOWN_CANNOT_RELEASE_SHARED_BACKEND_LOCK.
- get(backend.getBackendID(), String.valueOf(failureReason));
- logError(message);
+ logError(WARN_SHUTDOWN_CANNOT_RELEASE_SHARED_BACKEND_LOCK.get(
+ backend.getBackendID(), String.valueOf(failureReason)));
// FIXME -- Do we need to send an admin alert?
}
}
@@ -8164,9 +8148,8 @@
TRACER.debugCaught(DebugLogLevel.ERROR, e2);
}
- message = WARN_SHUTDOWN_CANNOT_RELEASE_SHARED_BACKEND_LOCK.
- get(backend.getBackendID(), stackTraceToSingleLineString(e2));
- logError(message);
+ logError(WARN_SHUTDOWN_CANNOT_RELEASE_SHARED_BACKEND_LOCK.get(
+ backend.getBackendID(), stackTraceToSingleLineString(e2)));
// FIXME -- Do we need to send an admin alert?
}
}
@@ -8187,14 +8170,11 @@
}
// Release exclusive lock held on server.lock file
- String serverLockFileName = LockFileManager.getServerLockFileName();
- StringBuilder failureReason = new StringBuilder();
-
try {
- if (!LockFileManager.releaseLock(serverLockFileName,
- failureReason)) {
- message = NOTE_SERVER_SHUTDOWN.get(className, failureReason);
- logError(message);
+ String serverLockFileName = LockFileManager.getServerLockFileName();
+ StringBuilder failureReason = new StringBuilder();
+ if (!LockFileManager.releaseLock(serverLockFileName, failureReason)) {
+ logError(NOTE_SERVER_SHUTDOWN.get(className, failureReason));
}
} catch (Exception e) {
if (debugEnabled()) {
@@ -9441,13 +9421,11 @@
* @return Returns the class loader to be used with this directory
* server application.
*/
- public static ClassLoader getClassLoader()
+ private static ClassLoader getClassLoader()
{
return ClassLoaderProvider.getInstance().getClassLoader();
}
-
-
/**
* Loads the named class using this directory server application's
* class loader.
@@ -9646,7 +9624,7 @@
*
* @return the workflow configuration mode
*/
- public static boolean workflowConfigurationModeIsAuto()
+ private static boolean workflowConfigurationModeIsAuto()
{
return directoryServer.workflowConfigurationMode
== WorkflowConfigurationMode.AUTO;
--
Gitblit v1.10.0