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 2015/08/14 07:03:20 UTC
activemq-artemis git commit: Revert "ARTEMIS-187 hold lock between
live server and tools"
Repository: activemq-artemis
Updated Branches:
refs/heads/master 154e9d610 -> 030f2fc59
Revert "ARTEMIS-187 hold lock between live server and tools"
This reverts commit f0f4f1684d083170764f7bd3a273c60f44aaa464.
Sorry about this.. I will rework this and send a commit again
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/030f2fc5
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/030f2fc5
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/030f2fc5
Branch: refs/heads/master
Commit: 030f2fc59aa92a2630cedb70e19a73bdcaedf511
Parents: 154e9d6
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Aug 14 01:02:11 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Aug 14 01:02:39 2015 -0400
----------------------------------------------------------------------
.../cli/commands/tools/CompactJournal.java | 2 --
.../cli/commands/tools/DataAbstract.java | 31 --------------------
.../artemis/cli/commands/tools/PrintData.java | 2 --
.../cli/commands/tools/XmlDataExporter.java | 2 --
.../apache/activemq/cli/test/ArtemisTest.java | 9 ------
.../artemis/core/server/NodeManager.java | 3 --
.../core/server/impl/ActiveMQServerImpl.java | 5 ++--
.../core/server/impl/FileLockNodeManager.java | 9 ------
.../core/server/impl/InVMNodeManager.java | 7 -----
.../core/server/impl/LiveOnlyActivation.java | 21 ++++---------
.../discovery/DiscoveryBaseTest.java | 6 ----
11 files changed, 7 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/CompactJournal.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/CompactJournal.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/CompactJournal.java
index ba0e9ce..af55345 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/CompactJournal.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/CompactJournal.java
@@ -33,14 +33,12 @@ public final class CompactJournal extends DataAbstract implements Action {
public Object execute(ActionContext context) throws Exception {
super.execute(context);
try {
- testLock();
Configuration configuration = getFileConfiguration();
compactJournal(new File(getJournal()), "activemq-data", "amq", configuration.getJournalMinFiles(), configuration.getJournalFileSize(), null);
compactJournal(new File(getBinding()), "activemq-bindings", "bindings", 2, 1048576, null);
}
catch (Exception e) {
treatError(e, "data", "compact");
- return e;
}
return null;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/DataAbstract.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/DataAbstract.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/DataAbstract.java
index 47edaee..c08dd44 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/DataAbstract.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/DataAbstract.java
@@ -18,15 +18,9 @@
package org.apache.activemq.artemis.cli.commands.tools;
import java.io.File;
-import java.nio.channels.FileLock;
import io.airlift.airline.Option;
import org.apache.activemq.artemis.cli.commands.Configurable;
-import org.apache.activemq.artemis.core.config.Configuration;
-import org.apache.activemq.artemis.core.server.JournalType;
-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;
/**
* Abstract class for places where you need bindings, journal paging and large messages configuration
@@ -45,31 +39,6 @@ public abstract class DataAbstract extends Configurable {
@Option(name = "--large-messages", description = "The folder used for large-messages (default from broker.xml)")
public String largeMessges;
-
- protected void testLock() throws Exception {
-
- FileLockNodeManager fileLockNodeManager;
- Configuration configuration = getFileConfiguration();
- if (getFileConfiguration().getJournalType() == JournalType.ASYNCIO && LibaioContext.isLoaded()) {
- fileLockNodeManager = new AIOFileLockNodeManager(new File(getJournal()), false, configuration.getJournalLockAcquisitionTimeout());
- }
- else {
- fileLockNodeManager = new FileLockNodeManager(new File(getJournal()), false, configuration.getJournalLockAcquisitionTimeout());
- }
-
- fileLockNodeManager.start();
-
- try (FileLock lock = fileLockNodeManager.tryLockLive()) {
- if (lock == null) {
- throw new RuntimeException("Server is locked!");
- }
- }
- finally {
- fileLockNodeManager.stop();
- }
-
- }
-
public String getLargeMessages() throws Exception {
if (largeMessges == null) {
largeMessges = getFileConfiguration().getLargeMessagesLocation().getAbsolutePath();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java
index 0802b13..68dc5dc 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java
@@ -63,12 +63,10 @@ public class PrintData extends DataAbstract implements Action {
public Object execute(ActionContext context) throws Exception {
super.execute(context);
try {
- testLock();
printData(new File(getBinding()), new File(getJournal()), new File(getPaging()));
}
catch (Exception e) {
treatError(e, "data", "print");
- return e;
}
return null;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/XmlDataExporter.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/XmlDataExporter.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/XmlDataExporter.java
index 66101b9..0d96aae 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/XmlDataExporter.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/XmlDataExporter.java
@@ -129,12 +129,10 @@ public final class XmlDataExporter extends DataAbstract implements Action {
super.execute(context);
try {
- testLock();
process(context.out, getBinding(), getJournal(), getPaging(), getLargeMessages());
}
catch (Exception e) {
treatError(e, "data", "exp");
- return e;
}
return null;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
index b6b5ac7..cfcc53f 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
@@ -93,15 +93,6 @@ public class ArtemisTest {
// Some exceptions may happen on the initialization, but they should be ok on start the basic core protocol
Artemis.execute("run");
- Object object = Artemis.execute("data", "print");
- Assert.assertTrue("An error was expected", object != null && object instanceof Throwable);
-
- object = Artemis.execute("data", "compact");
- Assert.assertTrue("An error was expected", object != null && object instanceof Throwable);
-
- object = Artemis.execute("data", "exp");
- Assert.assertTrue("An error was expected", object != null && object instanceof Throwable);
-
try (ServerLocator locator = ServerLocatorImpl.newLocator("tcp://localhost:61616");
ClientSessionFactory factory = locator.createSessionFactory();
ClientSession coreSession = factory.createSession()) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java
----------------------------------------------------------------------
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 222f0ce..421daaa 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
@@ -21,7 +21,6 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
import org.apache.activemq.artemis.api.core.SimpleString;
@@ -131,8 +130,6 @@ public abstract class NodeManager implements ActiveMQComponent {
releaseBackup();
}
- public abstract FileLock tryLockLive();
-
/**
* Ensures existence of persistent information about the server's nodeID.
* <p>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/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 de19512..8853154 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
@@ -347,10 +347,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
protected NodeManager createNodeManager(final File directory, boolean replicatingBackup) {
NodeManager manager;
if (!configuration.isPersistenceEnabled()) {
- return new InVMNodeManager(replicatingBackup);
+ manager = new InVMNodeManager(replicatingBackup);
}
-
- if (configuration.getJournalType() == JournalType.ASYNCIO && LibaioContext.isLoaded()) {
+ else if (configuration.getJournalType() == JournalType.ASYNCIO && LibaioContext.isLoaded()) {
manager = new AIOFileLockNodeManager(directory, replicatingBackup, configuration.getJournalLockAcquisitionTimeout());
}
else {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java
----------------------------------------------------------------------
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 4b4134b..acb431d 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
@@ -73,15 +73,6 @@ public class FileLockNodeManager extends NodeManager {
super.start();
}
- public FileLock tryLockLive() {
- try {
- return tryLock(FileLockNodeManager.LIVE_LOCK_POS);
- }
- catch (Exception e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
@Override
public boolean isAwaitingFailback() throws Exception {
return getState() == FileLockNodeManager.FAILINGBACK;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java
index c11c810..726cb50 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/InVMNodeManager.java
@@ -18,7 +18,6 @@ package org.apache.activemq.artemis.core.server.impl;
import java.io.File;
import java.io.IOException;
-import java.nio.channels.FileLock;
import java.util.concurrent.Semaphore;
import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
@@ -97,12 +96,6 @@ public final class InVMNodeManager extends NodeManager {
}
@Override
- public FileLock tryLockLive() {
- // no op.. doesn't make sense on InVM
- return null;
- }
-
- @Override
public void startLiveNode() throws Exception {
state = FAILING_BACK;
liveLock.acquire();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java
index 0a6c07e..1c82bbf 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LiveOnlyActivation.java
@@ -16,11 +16,6 @@
*/
package org.apache.activemq.artemis.core.server.impl;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
-
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.Pair;
import org.apache.activemq.artemis.api.core.SimpleString;
@@ -37,6 +32,11 @@ import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtoco
import org.apache.activemq.artemis.core.server.cluster.ha.LiveOnlyPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
public class LiveOnlyActivation extends Activation {
//this is how we act when we initially start as live
@@ -55,11 +55,6 @@ public class LiveOnlyActivation extends Activation {
public void run() {
try {
-
- /* We will hold a lock here so print-data and other tools
- * won't be able to run */
- activeMQServer.getNodeManager().startLiveNode();
-
activeMQServer.initialisePart1(false);
activeMQServer.initialisePart2(false);
@@ -84,12 +79,6 @@ public class LiveOnlyActivation extends Activation {
scaleDownServerLocator.close();
scaleDownServerLocator = null;
}
-
- try {
- activeMQServer.getNodeManager().stop();
- }
- catch (Throwable ignored) {
- }
}
public void freezeConnections(RemotingService remotingService) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/030f2fc5/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java
index e2e450b..06bc14e 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java
@@ -17,7 +17,6 @@
package org.apache.activemq.artemis.tests.integration.discovery;
import java.net.InetAddress;
-import java.nio.channels.FileLock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -178,11 +177,6 @@ public class DiscoveryBaseTest extends ActiveMQTestBase {
}
@Override
- public FileLock tryLockLive() {
- return null;
- }
-
- @Override
public void awaitLiveNode() throws Exception {
}