activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2567 restore locking semantics on server.lock when reading status
Date Thu, 05 Dec 2019 20:55:44 GMT
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 04db90e  ARTEMIS-2567 restore locking semantics on server.lock when reading status
     new d2215aa  This closes #2909
04db90e is described below

commit 04db90eddeda6df406c984da95e95a2b425c6c54
Author: Justin Bertram <jbertram@apache.org>
AuthorDate: Thu Dec 5 11:39:11 2019 -0600

    ARTEMIS-2567 restore locking semantics on server.lock when reading status
---
 .../org/apache/activemq/artemis/core/server/NodeManager.java  |  2 +-
 .../artemis/core/server/impl/FileLockNodeManager.java         | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java
index 8ad8e60..4b5c3cb 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java
@@ -30,7 +30,7 @@ import org.apache.activemq.artemis.utils.UUIDGenerator;
 public abstract class NodeManager implements ActiveMQComponent {
 
    protected static final byte FIRST_TIME_START = '0';
-   private static final String SERVER_LOCK_NAME = "server.lock";
+   public static final String SERVER_LOCK_NAME = "server.lock";
    private static final String ACCESS_MODE = "rw";
 
    protected final boolean replicatedBackup;
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java
index 116b977..8e6e33c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java
@@ -108,7 +108,16 @@ public class FileLockNodeManager extends NodeManager {
    protected synchronized void setUpServerLockFile() throws IOException {
       super.setUpServerLockFile();
 
-      for (int i = 0; i < 3; i++) {
+      if (lockChannels[0] == null || !lockChannels[0].isOpen()) {
+         File fileLock = newFile(NodeManager.SERVER_LOCK_NAME);
+         if (!fileLock.exists()) {
+            fileLock.createNewFile();
+         }
+         RandomAccessFile randomFileLock = new RandomAccessFile(fileLock, "rw");
+         lockChannels[0] = randomFileLock.getChannel();
+      }
+
+      for (int i = 1; i < 3; i++) {
          if (lockChannels[i] != null && lockChannels[i].isOpen()) {
             continue;
          }


Mime
View raw message