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

Violette Roche-Montane
23.51.2013 2bdda99416ddf25d1122d376cfd474ce31451b8a
CR-2024 OPENDJ-1078 OpenDJ doesn't release server.lock after upgrade
1 files modified
21 ■■■■ changed files
opends/src/server/org/opends/server/tools/upgrade/Upgrade.java 21 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/upgrade/Upgrade.java
@@ -532,20 +532,21 @@
  {
    final String lockFile = LockFileManager.getServerLockFileName();
    final Message message = ERR_UPGRADE_REQUIRES_SERVER_OFFLINE.get();
    final StringBuilder failureReason = new StringBuilder();
    try
    {
      final StringBuilder failureReason = new StringBuilder();
      if (!LockFileManager.acquireExclusiveLock(lockFile, failureReason))
      {
        throw new ClientException(EXIT_CODE_ERROR, message);
      }
    }
    catch (Exception e)
    {
      // Assume that if we cannot acquire the lock file the server is
      // running.
      throw new ClientException(EXIT_CODE_ERROR, message);
      if (!LockFileManager.acquireExclusiveLock(lockFile, failureReason))
      {
        LOG.log(Level.SEVERE, failureReason.toString());
        throw new ClientException(EXIT_CODE_ERROR,
            ERR_UPGRADE_REQUIRES_SERVER_OFFLINE.get());
      }
    }
    finally
    {
      LockFileManager.releaseLock(lockFile, failureReason);
    }
  }