From 7fa5e0b85d304264e4a8407894cc8696b9e1ff92 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Mon, 25 Jun 2007 21:55:20 +0000
Subject: [PATCH] This fixes an issue when determining the location of the lock file in order to determine if a server is running or not.  The previous strategy caused problems if the an application instantiated different Installation objects corresponding to different root directories (like the upgrader).

---
 opends/src/quicksetup/org/opends/quicksetup/Status.java |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/Status.java b/opends/src/quicksetup/org/opends/quicksetup/Status.java
index d6e55ba..28f1187 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Status.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Status.java
@@ -27,7 +27,8 @@
 
 package org.opends.quicksetup;
 
-import org.opends.server.util.ServerConstants;
+import static org.opends.server.util.ServerConstants.SERVER_LOCK_FILE_NAME;
+import static org.opends.server.util.ServerConstants.LOCK_FILE_SUFFIX;
 import org.opends.server.core.LockFileManager;
 import org.opends.quicksetup.util.Utils;
 
@@ -39,8 +40,6 @@
  */
 public class Status {
 
-  private static boolean lockPathInitialized;
-
   private Installation installation;
 
   /**
@@ -111,15 +110,10 @@
    */
   public boolean isServerRunning() {
     boolean isServerRunning;
-    if (!lockPathInitialized) {
-      File locksDir = installation.getLocksDirectory();
-
-      System.setProperty(
-              ServerConstants.PROPERTY_LOCK_DIRECTORY,
-              Utils.getPath(locksDir));
-      lockPathInitialized = true;
-    }
-    String lockFile = LockFileManager.getServerLockFileName();
+    String lockFileName = SERVER_LOCK_FILE_NAME + LOCK_FILE_SUFFIX;
+    String lockFile =
+            Utils.getPath(new File(installation.getLocksDirectory(),
+                                   lockFileName));
     StringBuilder failureReason = new StringBuilder();
     try {
       if (LockFileManager.acquireExclusiveLock(lockFile,

--
Gitblit v1.10.0