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 2016/05/16 16:07:59 UTC
[1/2] activemq-artemis git commit: ARTEMIS-517 API to check sync with
backup
Repository: activemq-artemis
Updated Branches:
refs/heads/master 9a9968c35 -> e04e99874
ARTEMIS-517 API to check sync with backup
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/04c9564d
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/04c9564d
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/04c9564d
Branch: refs/heads/master
Commit: 04c9564d777e8d6cd8a5b48a43d6303985320dd3
Parents: 9a9968c
Author: jbertram <jb...@apache.org>
Authored: Fri May 6 14:53:55 2016 -0500
Committer: jbertram <jb...@apache.org>
Committed: Mon May 16 10:01:18 2016 -0500
----------------------------------------------------------------------
.../core/management/ActiveMQServerControl.java | 7 +++++++
.../impl/ActiveMQServerControlImpl.java | 13 +++++++++++++
.../core/server/ActiveMQMessageBundle.java | 3 +++
.../artemis/core/server/ActiveMQServer.java | 6 ++++++
.../core/server/impl/ActiveMQServerImpl.java | 20 ++++++++++++++++++++
.../artemis/tests/util/ActiveMQTestBase.java | 2 +-
.../ActiveMQServerControlUsingCoreTest.java | 5 +++++
7 files changed, 55 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/04c9564d/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
index 39b18f2..7784992 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
@@ -396,6 +396,13 @@ public interface ActiveMQServerControl {
@Attribute(desc = "uptime of this server in milliseconds")
long getUptimeMillis();
+ /**
+ * Returns whether the initial replication synchronization process with the backup server is complete; applicable for
+ * either the live or backup server.
+ */
+ @Attribute(desc = "whether the initial replication synchronization process with the backup server is complete")
+ boolean isReplicaSync();
+
// Operations ----------------------------------------------------
/**
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/04c9564d/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index 6e7f4dc..df84c48 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -670,6 +670,19 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
}
@Override
+ public boolean isReplicaSync() {
+ checkStarted();
+
+ clearIO();
+ try {
+ return server.isReplicaSync();
+ }
+ finally {
+ blockOnIO();
+ }
+ }
+
+ @Override
public String[] getAddressNames() {
checkStarted();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/04c9564d/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
index 4de94b9..dfcfed2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
@@ -371,4 +371,7 @@ public interface ActiveMQMessageBundle {
@Message(id = 119117, value = "Replicator is null. Replication was likely terminated.")
ActiveMQIllegalStateException replicatorIsNull();
+
+ @Message(id = 119118, value = "Management method not applicable for current server configuration")
+ IllegalStateException methodNotApplicable();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/04c9564d/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
index 0c6fe11..d5786e6 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
@@ -211,6 +211,12 @@ public interface ActiveMQServer extends ActiveMQComponent {
QueueDeleter getJMSQueueDeleter();
/**
+ * Returns whether the initial replication synchronization process with the backup server is complete; applicable for
+ * either the live or backup server.
+ */
+ boolean isReplicaSync();
+
+ /**
* Wait for server initialization.
*
* @param timeout
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/04c9564d/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 641cedd..60235de 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
@@ -674,6 +674,26 @@ public class ActiveMQServerImpl implements ActiveMQServer {
this.jmsQueueDeleter = jmsQueueDeleter;
}
+ @Override
+ public boolean isReplicaSync() {
+ if (activation instanceof SharedNothingLiveActivation) {
+ ReplicationManager replicationManager = getReplicationManager();
+
+ if (replicationManager == null) {
+ return false;
+ }
+ else {
+ return !replicationManager.isSynchronizing();
+ }
+ }
+ else if (activation instanceof SharedNothingBackupActivation) {
+ return ((SharedNothingBackupActivation) activation).isRemoteBackupUpToDate();
+ }
+ else {
+ throw ActiveMQMessageBundle.BUNDLE.methodNotApplicable();
+ }
+ }
+
/**
* Stops the server
*
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/04c9564d/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
index e8fd9ef..ee00229 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
@@ -1319,7 +1319,7 @@ public abstract class ActiveMQTestBase extends Assert {
boolean isRemoteUpToDate = true;
if (isReplicated) {
if (activation instanceof SharedNothingBackupActivation) {
- isRemoteUpToDate = ((SharedNothingBackupActivation) activation).isRemoteBackupUpToDate();
+ isRemoteUpToDate = backup.isReplicaSync();
}
else {
//we may have already failed over and changed the Activation
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/04c9564d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
index e760b01..7519fef 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
@@ -239,6 +239,11 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
}
@Override
+ public boolean isReplicaSync() {
+ return false;
+ }
+
+ @Override
public int getIDCacheSize() {
return (Integer) proxy.retrieveAttributeValue("IDCacheSize");
}
[2/2] activemq-artemis git commit: This closes #513
Posted by cl...@apache.org.
This closes #513
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/e04e9987
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/e04e9987
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/e04e9987
Branch: refs/heads/master
Commit: e04e99874b2cdfd0efb6828afa302b835dd2f416
Parents: 9a9968c 04c9564
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon May 16 12:07:45 2016 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 16 12:07:45 2016 -0400
----------------------------------------------------------------------
.../core/management/ActiveMQServerControl.java | 7 +++++++
.../impl/ActiveMQServerControlImpl.java | 13 +++++++++++++
.../core/server/ActiveMQMessageBundle.java | 3 +++
.../artemis/core/server/ActiveMQServer.java | 6 ++++++
.../core/server/impl/ActiveMQServerImpl.java | 20 ++++++++++++++++++++
.../artemis/tests/util/ActiveMQTestBase.java | 2 +-
.../ActiveMQServerControlUsingCoreTest.java | 5 +++++
7 files changed, 55 insertions(+), 1 deletion(-)
----------------------------------------------------------------------