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

kenneth_suter
25.55.2007 7fa5e0b85d304264e4a8407894cc8696b9e1ff92
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).
1 files modified
18 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/Status.java 18 ●●●●● patch | view | raw | blame | history
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,