This closes #513
This commit is contained in:
commit
e04e99874b
|
@ -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 ----------------------------------------------------
|
||||
|
||||
/**
|
||||
|
|
|
@ -669,6 +669,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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -210,6 +210,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.
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -238,6 +238,11 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplicaSync() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIDCacheSize() {
|
||||
return (Integer) proxy.retrieveAttributeValue("IDCacheSize");
|
||||
|
|
Loading…
Reference in New Issue