You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/04/12 15:05:49 UTC

[1/2] activemq-artemis git commit: ARTEMIS-1108: Removed AIOFileLockManager

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 0937e7541 -> a1664bdd4


ARTEMIS-1108: Removed AIOFileLockManager

AIOFileLockManager doesn't work on NFS-mounted share store directories.
Since the GFS2 bug https://bugzilla.redhat.com/show_bug.cgi?id=678585
has been fixed end of 2011, the class AIOFileLockManager is no longer needed and I have removed it.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/557f02ba
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/557f02ba
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/557f02ba

Branch: refs/heads/master
Commit: 557f02ba4d721620e53ae1a45cb879d653e4fab2
Parents: 0937e75
Author: Bernd Gutjahr <be...@hpe.com>
Authored: Tue Apr 11 09:47:11 2017 +0200
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Apr 12 10:45:26 2017 -0400

----------------------------------------------------------------------
 .../server/impl/AIOFileLockNodeManager.java     | 103 -------------------
 .../core/server/impl/ActiveMQServerImpl.java    |   3 -
 .../tests/util/ColocatedActiveMQServer.java     |   9 +-
 .../unit/core/server/impl/FileLockTest.java     |  10 --
 4 files changed, 1 insertion(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/557f02ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AIOFileLockNodeManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AIOFileLockNodeManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AIOFileLockNodeManager.java
deleted file mode 100644
index 0892a11..0000000
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AIOFileLockNodeManager.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.core.server.impl;
-
-import java.io.File;
-import java.nio.channels.FileLock;
-
-import org.apache.activemq.artemis.core.io.aio.ActiveMQFileLock;
-import org.apache.activemq.artemis.jlibaio.LibaioContext;
-import org.apache.activemq.artemis.jlibaio.LibaioFile;
-
-/**
- * This is using the ActiveMQ Artemis Libaio Native to perform calls to flock on a Linux system. At the
- * current version of RHEL there's a bug on GFS2 and because of that fctl is not functional what
- * will cause issues on Failover over Shared Storage.
- * <p>
- * This will provide an alternative to perform locks through our native module until fctl is fixed
- * on Linux.
- * <p>
- * https://bugzilla.redhat.com/show_bug.cgi?id=678585
- */
-public final class AIOFileLockNodeManager extends FileLockNodeManager {
-
-   /**
-    * @param directory
-    * @param replicatingBackup
-    */
-   public AIOFileLockNodeManager(final File directory, boolean replicatingBackup) {
-      super(directory, replicatingBackup);
-   }
-
-   public AIOFileLockNodeManager(final File directory, boolean replicatingBackup, long lockAcquisitionTimeout) {
-      super(directory, replicatingBackup);
-
-      this.lockAcquisitionTimeout = lockAcquisitionTimeout;
-   }
-
-   @Override
-   protected FileLock tryLock(final int lockPos) throws Exception {
-      File file = newFileForRegionLock(lockPos);
-
-      LibaioFile fileControl = LibaioContext.openControlFile(file.getAbsolutePath(), false);
-
-      if (!fileControl.lock()) {
-         fileControl.close();
-         return null;
-      }
-
-      FileLock lock = new ActiveMQFileLock(fileControl);
-
-      return lock;
-
-   }
-
-   @Override
-   protected FileLock lock(final int liveLockPos) throws Exception {
-      long start = System.currentTimeMillis();
-
-      File file = newFileForRegionLock(liveLockPos);
-
-      while (!interrupted) {
-         FileLock lockFile = tryLock(liveLockPos);
-         if (lockFile != null) {
-            return lockFile;
-         } else {
-            try {
-               Thread.sleep(500);
-            } catch (InterruptedException e) {
-               return null;
-            }
-
-            if (lockAcquisitionTimeout != -1 && (System.currentTimeMillis() - start) > lockAcquisitionTimeout) {
-               throw new Exception("timed out waiting for lock");
-            }
-         }
-      }
-
-      return null;
-   }
-
-   /**
-    * @param liveLockPos
-    * @return
-    */
-   protected File newFileForRegionLock(final int liveLockPos) {
-      File file = newFile("server." + liveLockPos + ".lock");
-      return file;
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/557f02ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index ede4ff0..4934b09 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -154,7 +154,6 @@ import org.apache.activemq.artemis.core.settings.impl.ResourceLimitSettings;
 import org.apache.activemq.artemis.core.transaction.ResourceManager;
 import org.apache.activemq.artemis.core.transaction.impl.ResourceManagerImpl;
 import org.apache.activemq.artemis.core.version.Version;
-import org.apache.activemq.artemis.jlibaio.LibaioContext;
 import org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
@@ -446,8 +445,6 @@ public class ActiveMQServerImpl implements ActiveMQServer {
       NodeManager manager;
       if (!configuration.isPersistenceEnabled()) {
          manager = new InVMNodeManager(replicatingBackup);
-      } else if (configuration.getJournalType() == JournalType.ASYNCIO && LibaioContext.isLoaded()) {
-         manager = new AIOFileLockNodeManager(directory, replicatingBackup, configuration.getJournalLockAcquisitionTimeout());
       } else {
          manager = new FileLockNodeManager(directory, replicatingBackup, configuration.getJournalLockAcquisitionTimeout());
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/557f02ba/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ColocatedActiveMQServer.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ColocatedActiveMQServer.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ColocatedActiveMQServer.java
index 6130dcf..c901187 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ColocatedActiveMQServer.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ColocatedActiveMQServer.java
@@ -22,12 +22,9 @@ import java.io.File;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.core.server.JournalType;
 import org.apache.activemq.artemis.core.server.NodeManager;
-import org.apache.activemq.artemis.core.server.impl.AIOFileLockNodeManager;
 import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
 import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager;
-import org.apache.activemq.artemis.jlibaio.LibaioContext;
 import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
 
 public class ColocatedActiveMQServer extends ActiveMQServerImpl {
@@ -68,11 +65,7 @@ public class ColocatedActiveMQServer extends ActiveMQServerImpl {
    @Override
    protected NodeManager createNodeManager(final File directory, boolean replicatingBackup) {
       if (replicatingBackup) {
-         if (getConfiguration().getJournalType() == JournalType.ASYNCIO && LibaioContext.isLoaded()) {
-            return new AIOFileLockNodeManager(directory, replicatingBackup, getConfiguration().getJournalLockAcquisitionTimeout());
-         } else {
-            return new FileLockNodeManager(directory, replicatingBackup, getConfiguration().getJournalLockAcquisitionTimeout());
-         }
+         return new FileLockNodeManager(directory, replicatingBackup, getConfiguration().getJournalLockAcquisitionTimeout());
       } else {
          if (backup) {
             return nodeManagerBackup;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/557f02ba/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/FileLockTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/FileLockTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/FileLockTest.java
index 76dcfa8..8812793 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/FileLockTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/FileLockTest.java
@@ -18,9 +18,7 @@ package org.apache.activemq.artemis.tests.unit.core.server.impl;
 
 import java.io.File;
 
-import org.apache.activemq.artemis.core.server.impl.AIOFileLockNodeManager;
 import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager;
-import org.apache.activemq.artemis.jlibaio.LibaioContext;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.junit.Before;
 import org.junit.Test;
@@ -41,14 +39,6 @@ public class FileLockTest extends ActiveMQTestBase {
 
    }
 
-   @Test
-   public void testAIOLock() throws Exception {
-      if (LibaioContext.isLoaded()) {
-         doTestLock(new AIOFileLockNodeManager(getTestDirfile(), false), new AIOFileLockNodeManager(getTestDirfile(), false));
-      }
-
-   }
-
    public void doTestLock(final FileLockNodeManager lockManager1,
                           final FileLockNodeManager lockManager2) throws Exception {
       lockManager1.start();


[2/2] activemq-artemis git commit: This closes #1194

Posted by cl...@apache.org.
This closes #1194


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a1664bdd
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a1664bdd
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a1664bdd

Branch: refs/heads/master
Commit: a1664bdd47f9c2d81059cad9cb1610e35f110dc1
Parents: 0937e75 557f02b
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Apr 12 11:05:36 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Apr 12 11:05:36 2017 -0400

----------------------------------------------------------------------
 .../server/impl/AIOFileLockNodeManager.java     | 103 -------------------
 .../core/server/impl/ActiveMQServerImpl.java    |   3 -
 .../tests/util/ColocatedActiveMQServer.java     |   9 +-
 .../unit/core/server/impl/FileLockTest.java     |  10 --
 4 files changed, 1 insertion(+), 124 deletions(-)
----------------------------------------------------------------------