ARTEMIS-3474 replace non-inclusive terms

This commit does the following:

 - Replaces non-inclusive terms (e.g. master, slave, etc.) in the
   source, docs, & configuration.
 - Supports previous configuration elements, but logs when old elements
   are used.
 - Provides migration documentation.
 - Updates XSD with new config elements and simplifies by combining some
    overlapping complexTypes.
 - Removes ambiguous "live" language that's used with regard to high
   availability.
 - Standardizes use of "primary," "backup," "active," & "passive" as
   nomenclature to describe both configuration & runtime state for high
   availability.
This commit is contained in:
Justin Bertram 2023-08-05 09:24:06 -05:00 committed by clebertsuconic
parent ff8f45de07
commit 85b2f4b126
357 changed files with 5157 additions and 4758 deletions

View File

@ -86,8 +86,8 @@ public class Create extends InstallAbstract {
private static final String ETC_LOGIN_CONFIG = "login.config";
private static final String ETC_LOGIN_CONFIG_WITH_GUEST = "etc/login-with-guest.config";
private static final String ETC_LOGIN_CONFIG_WITHOUT_GUEST = "etc/login-without-guest.config";
public static final String ETC_REPLICATED_MASTER_SETTINGS_TXT = "etc/replicated-master-settings.txt";
public static final String ETC_REPLICATED_SLAVE_SETTINGS_TXT = "etc/replicated-slave-settings.txt";
public static final String ETC_REPLICATED_PRIMARY_SETTINGS_TXT = "etc/replicated-primary-settings.txt";
public static final String ETC_REPLICATED_BACKUP_SETTINGS_TXT = "etc/replicated-backup-settings.txt";
public static final String ETC_SHARED_STORE_SETTINGS_TXT = "etc/shared-store-settings.txt";
public static final String ETC_CLUSTER_SECURITY_SETTINGS_TXT = "etc/cluster-security-settings.txt";
public static final String ETC_CLUSTER_SETTINGS_TXT = "etc/cluster-settings.txt";
@ -170,9 +170,13 @@ public class Create extends InstallAbstract {
@Option(names = "--shared-store", description = "Enable broker shared store.")
private boolean sharedStore = false;
@Option(names = "--slave", description = "Be a slave broker. Valid for shared store or replication.")
@Deprecated(forRemoval = true)
@Option(names = "--slave", description = "Deprecated for removal. Use 'backup' instead.", hidden = true)
private boolean slave;
@Option(names = "--backup", description = "Be a backup broker. Valid for shared store or replication.")
private boolean backup;
@Option(names = "--failover-on-shutdown", description = "Whether broker shutdown will trigger failover for clients using the core protocol. Valid only for shared store. Default: false.")
private boolean failoverOnShutodwn;
@ -496,8 +500,8 @@ public class Create extends InstallAbstract {
this.role = role;
}
private boolean isSlave() {
return slave;
private boolean isBackup() {
return slave || backup;
}
private boolean isFailoverOnShutodwn() {
@ -562,7 +566,7 @@ public class Create extends InstallAbstract {
filters.put("${device-block-size}", Integer.toString(journalDeviceBlockSize));
filters.put("${master-slave}", isSlave() ? "slave" : "master");
filters.put("${primary-backup}", isBackup() ? "backup" : "primary");
filters.put("${failover-on-shutdown}", isFailoverOnShutodwn() ? "true" : "false");
@ -581,7 +585,7 @@ public class Create extends InstallAbstract {
if (replicated) {
clustered = true;
filters.put("${replicated.settings}", readTextFile(isSlave() ? ETC_REPLICATED_SLAVE_SETTINGS_TXT : ETC_REPLICATED_MASTER_SETTINGS_TXT, filters));
filters.put("${replicated.settings}", readTextFile(isBackup() ? ETC_REPLICATED_BACKUP_SETTINGS_TXT : ETC_REPLICATED_PRIMARY_SETTINGS_TXT, filters));
} else {
filters.put("${replicated.settings}", "");
}

View File

@ -142,9 +142,9 @@ public class ActivationSequenceList extends LockAbstract {
}
try (MutableLong coordinatedActivationSequence = manager.getMutableLong(nodeId);
DistributedLock liveLock = manager.getDistributedLock(nodeId)) {
if (!liveLock.tryLock()) {
throw new IllegalStateException("Cannot safely get the coordinated activation sequence for NodeID=" + nodeId + ": maybe the live lock is still held.");
DistributedLock primaryLock = manager.getDistributedLock(nodeId)) {
if (!primaryLock.tryLock()) {
throw new IllegalStateException("Cannot safely get the coordinated activation sequence for NodeID=" + nodeId + ": maybe the primary lock is still held.");
}
coordinatedSequence = coordinatedActivationSequence.get();
if (out != null) {

View File

@ -125,9 +125,9 @@ public class ActivationSequenceSet extends LockAbstract {
}
try (MutableLong coordinatedActivationSequence = manager.getMutableLong(localNodeId);
DistributedLock liveLock = manager.getDistributedLock(localNodeId)) {
if (!liveLock.tryLock()) {
throw new IllegalStateException("Cannot safely set coordinated activation sequence for NodeID=" + localNodeId + ": live lock is still held.");
DistributedLock primaryLock = manager.getDistributedLock(localNodeId)) {
if (!primaryLock.tryLock()) {
throw new IllegalStateException("Cannot safely set coordinated activation sequence for NodeID=" + localNodeId + ": primary lock is still held.");
}
final long remoteActivationSequence = coordinatedActivationSequence.get();
coordinatedActivationSequence.set(value);

View File

@ -86,10 +86,10 @@ public class ClusterNodeVerifier implements AutoCloseable {
mainTopology.forEach((a, b) -> {
try {
context.out.println("--> Verifying Topology for NodeID " + b.nodeID + ", live = " + b.live + ", backup = " + b.backup);
if (b.live != null) {
context.out.println(" verification on live " + b.live);
if (!subVerify(context, b.live, mainTopology)) {
context.out.println("--> Verifying Topology for NodeID " + b.nodeID + ", primary = " + b.primary + ", backup = " + b.backup);
if (b.primary != null) {
context.out.println(" verification on primary " + b.primary);
if (!subVerify(context, b.primary, mainTopology)) {
verificationResult.set(false);
} else {
context.out.println(" ok!");
@ -115,14 +115,14 @@ public class ClusterNodeVerifier implements AutoCloseable {
if (supportTime) {
Long[] times = fetchTopologyTime(mainTopology);
context.out.printf(FORMAT, "nodeID", "live", "live local time", "backup");
context.out.printf(FORMAT, "nodeID", "primary", "primary local time", "backup");
context.out.println();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long initialTime = System.currentTimeMillis();
mainTopology.forEach((id, node) -> {
context.out.printf(FORMAT, id, node.live, formatDate(sdf, node.liveTime), node.backup);
context.out.printf(FORMAT, id, node.primary, formatDate(sdf, node.primaryTime), node.backup);
context.out.println();
});
@ -169,13 +169,13 @@ public class ClusterNodeVerifier implements AutoCloseable {
protected Long[] fetchTopologyTime(Map<String, TopologyItem> topologyItemMap) {
ArrayList<Long> times = new ArrayList<>(topologyItemMap.size() * 2);
topologyItemMap.forEach((id, node) -> {
if (node.live != null) {
if (node.primary != null) {
try {
node.liveTime = fetchTime(node.live);
times.add(node.liveTime);
node.primaryTime = fetchTime(node.primary);
times.add(node.primaryTime);
} catch (Exception e) {
ActionContext.system().err.println("Cannot fetch liveTime for nodeID=" + id + ", url=" + node.live + " -> " + e.getMessage());
node.liveTime = 0;
ActionContext.system().err.println("Cannot fetch liveTime for nodeID=" + id + ", url=" + node.primary + " -> " + e.getMessage());
node.primaryTime = 0;
}
}
});
@ -233,7 +233,7 @@ public class ClusterNodeVerifier implements AutoCloseable {
context.out.printf(prefix + "%-40s | %-25s | %-25s", "nodeID", "live", "backup");
context.out.println();
navigateTopology(topology, t -> {
context.out.printf(prefix + "%-40s | %-25s | %-25s", t.nodeID, t.live, t.backup);
context.out.printf(prefix + "%-40s | %-25s | %-25s", t.nodeID, t.primary, t.backup);
context.out.println();
});
}
@ -241,10 +241,10 @@ public class ClusterNodeVerifier implements AutoCloseable {
private void navigateTopology(JsonArray topology, Consumer<TopologyItem> consumer) {
for (int i = 0; i < topology.size(); i++) {
JsonObject node = topology.getJsonObject(i);
JsonString live = node.getJsonString("live");
JsonString primary = node.getJsonString("primary");
JsonString backup = node.getJsonString("backup");
String nodeID = node.getString("nodeID");
TopologyItem item = new TopologyItem(nodeID, live != null ? live.getString() : null, backup != null ? backup.getString() : null);
TopologyItem item = new TopologyItem(nodeID, primary != null ? primary.getString() : null, backup != null ? backup.getString() : null);
consumer.accept(item);
}
}
@ -258,8 +258,8 @@ public class ClusterNodeVerifier implements AutoCloseable {
}
protected long fetchTime(String uri) throws Exception {
SimpleManagement liveManagement = new SimpleManagement(uri, user, password);
return liveManagement.getCurrentTimeMillis();
SimpleManagement management = new SimpleManagement(uri, user, password);
return management.getCurrentTimeMillis();
}
protected JsonArray fetchMainTopology() throws Exception {
@ -267,22 +267,22 @@ public class ClusterNodeVerifier implements AutoCloseable {
}
protected JsonArray fetchTopology(String uri) throws Exception {
SimpleManagement liveManagement = new SimpleManagement(uri, user, password);
return liveManagement.listNetworkTopology();
SimpleManagement management = new SimpleManagement(uri, user, password);
return management.listNetworkTopology();
}
public static class TopologyItem {
final String nodeID, live, backup;
final String nodeID, primary, backup;
long liveTime, backupTime;
long primaryTime, backupTime;
TopologyItem(String nodeID, String live, String backup) {
TopologyItem(String nodeID, String primary, String backup) {
this.nodeID = nodeID;
if (live != null) {
this.live = "tcp://" + live;
if (primary != null) {
this.primary = "tcp://" + primary;
} else {
this.live = null;
this.primary = null;
}
if (backup != null) {
this.backup = "tcp://" + backup;
@ -302,7 +302,7 @@ public class ClusterNodeVerifier implements AutoCloseable {
if (nodeID != null ? !nodeID.equals(item.nodeID) : item.nodeID != null)
return false;
if (live != null ? !live.equals(item.live) : item.live != null)
if (primary != null ? !primary.equals(item.primary) : item.primary != null)
return false;
return backup != null ? backup.equals(item.backup) : item.backup == null;
}
@ -310,14 +310,14 @@ public class ClusterNodeVerifier implements AutoCloseable {
@Override
public int hashCode() {
int result = nodeID != null ? nodeID.hashCode() : 0;
result = 31 * result + (live != null ? live.hashCode() : 0);
result = 31 * result + (primary != null ? primary.hashCode() : 0);
result = 31 * result + (backup != null ? backup.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "TopologyItem{" + "nodeID='" + nodeID + '\'' + ", live='" + live + '\'' + ", backup='" + backup + '\'' + '}';
return "TopologyItem{" + "nodeID='" + nodeID + '\'' + ", primary='" + primary + '\'' + ", backup='" + backup + '\'' + '}';
}
}
}

View File

@ -35,9 +35,13 @@ public class NodeCheck extends CheckAbstract {
@Option(names = "--memoryUsage", description = "Memory usage percentage to check.")
private Integer memoryUsage;
@Deprecated(forRemoval = true)
@Option(names = "--live", description = "Check that the node has a connected live.")
private boolean live;
@Option(names = "--primary", description = "Check that the node has a connected live.")
private boolean primary;
@Option(names = "--backup", description = "Check that the node has a connected backup.")
private boolean backup;
@ -68,14 +72,18 @@ public class NodeCheck extends CheckAbstract {
this.memoryUsage = memoryUsage;
}
public boolean isLive() {
return live;
public boolean isPrimary() {
return live || primary;
}
public void setLive(boolean live) {
this.live = live;
}
public void setPrimary(boolean primary) {
this.primary = primary;
}
public boolean isBackup() {
return backup;
}
@ -96,8 +104,8 @@ public class NodeCheck extends CheckAbstract {
protected CheckTask[] getCheckTasks() {
ArrayList<CheckTask> checkTasks = new ArrayList<>();
if (live) {
checkTasks.add(new CheckTask("the node has a live", this::checkNodeLive));
if (primary || live) {
checkTasks.add(new CheckTask("the node has a primary", this::checkNodePrimary));
}
if (backup) {
@ -143,7 +151,7 @@ public class NodeCheck extends CheckAbstract {
}
}
private void checkNodeLive(final CheckContext context) throws Exception {
private void checkNodePrimary(final CheckContext context) throws Exception {
String nodeId = getName();
if (nodeId == null) {
@ -152,8 +160,8 @@ public class NodeCheck extends CheckAbstract {
NodeInfo node = context.getTopology().get(nodeId);
if (node == null || node.getLive() == null) {
throw new CheckException("No live found for the node " + nodeId);
if (node == null || node.getPrimary() == null) {
throw new CheckException("No primary found for the node " + nodeId);
}
}
@ -173,7 +181,7 @@ public class NodeCheck extends CheckAbstract {
private void checkNodePeers(final CheckContext context) throws Exception {
int topologyPeers = context.getTopology().values().stream().
mapToInt(node -> (node.getLive() != null ? 1 : 0) +
mapToInt(node -> (node.getPrimary() != null ? 1 : 0) +
(node.getBackup() != null ? 1 : 0)).sum();
if (topologyPeers < peers) {

View File

@ -1,8 +1,8 @@
<ha-policy>
<replication>
<master>
<primary>
<vote-on-replication-failure>true</vote-on-replication-failure>
</master>
</primary>
</replication>
</ha-policy>

View File

@ -1,8 +1,8 @@
<ha-policy>
<shared-store>
<${master-slave}>
<${primary-backup}>
<failover-on-shutdown>${failover-on-shutdown}</failover-on-shutdown>
</${master-slave}>
</${primary-backup}>
</shared-store>
</ha-policy>

View File

@ -915,12 +915,12 @@ public class ArtemisTest extends CliTestBase {
addCmd.setUserCommandUser("user2");
addCmd.setUserCommandPassword("password2");
addCmd.setRole("admin,manager,master");
addCmd.setRole("admin,manager,primary");
addCmd.execute(new TestActionContext());
addCmd.setUserCommandUser("user3");
addCmd.setUserCommandPassword("password3");
addCmd.setRole("system,master");
addCmd.setRole("system,primary");
addCmd.execute(new TestActionContext());
//verify use list cmd
@ -936,11 +936,11 @@ public class ArtemisTest extends CliTestBase {
.matcher(result)
.find());
assertTrue(Pattern
.compile("\"user2\"\\((admin|manager|master),(admin|manager|master),(admin|manager|master)\\)")
.compile("\"user2\"\\((admin|manager|primary),(admin|manager|primary),(admin|manager|primary)\\)")
.matcher(result)
.find());
assertTrue(Pattern
.compile("\"user3\"\\((master|system),(master|system)\\)")
.compile("\"user3\"\\((primary|system),(primary|system)\\)")
.matcher(result)
.find());
@ -961,10 +961,10 @@ public class ArtemisTest extends CliTestBase {
//reset role
resetCommand.setUserCommandUser("user2");
resetCommand.setRole("manager,master,operator");
resetCommand.setRole("manager,primary,operator");
resetCommand.execute(new TestActionContext());
checkRole("user2", roleFile, basic, "manager", "master", "operator");
checkRole("user2", roleFile, basic, "manager", "primary", "operator");
//reset both
resetCommand.setUserCommandUser("user3");
@ -1159,8 +1159,8 @@ public class ArtemisTest extends CliTestBase {
activeMQServerControl.addUser("user1", "password1", "admin,manager", plaintext);
assertTrue(checkPassword("user1", "password1", userFile));
assertEquals(plaintext, !PasswordMaskingUtil.isEncMasked(getStoredPassword("user1", userFile)));
activeMQServerControl.addUser("user2", "password2", "admin,manager,master", plaintext);
activeMQServerControl.addUser("user3", "password3", "system,master", plaintext);
activeMQServerControl.addUser("user2", "password2", "admin,manager,primary", plaintext);
activeMQServerControl.addUser("user3", "password3", "system,primary", plaintext);
//verify use list cmd
@ -1170,8 +1170,8 @@ public class ArtemisTest extends CliTestBase {
contains(JsonUtil.readJsonArray(jsonResult), "user1", "manager");
contains(JsonUtil.readJsonArray(jsonResult), "user2", "admin");
contains(JsonUtil.readJsonArray(jsonResult), "user2", "manager");
contains(JsonUtil.readJsonArray(jsonResult), "user2", "master");
contains(JsonUtil.readJsonArray(jsonResult), "user3", "master");
contains(JsonUtil.readJsonArray(jsonResult), "user2", "primary");
contains(JsonUtil.readJsonArray(jsonResult), "user3", "primary");
contains(JsonUtil.readJsonArray(jsonResult), "user3", "system");
checkRole("user1", roleFile, "admin", "manager");
@ -1185,9 +1185,9 @@ public class ArtemisTest extends CliTestBase {
assertEquals(plaintext, !PasswordMaskingUtil.isEncMasked(getStoredPassword("user1", userFile)));
//reset role
activeMQServerControl.resetUser("user2", null, "manager,master,operator", plaintext);
activeMQServerControl.resetUser("user2", null, "manager,primary,operator", plaintext);
checkRole("user2", roleFile, "manager", "master", "operator");
checkRole("user2", roleFile, "manager", "primary", "operator");
assertTrue(checkPassword("user2", "password2", userFile));
assertEquals(plaintext, !PasswordMaskingUtil.isEncMasked(getStoredPassword("user2", userFile)));

View File

@ -78,7 +78,7 @@ public class ClusterVerifyTest {
@Override
protected JsonArray fetchMainTopology() throws Exception {
return read("[{\"nodeID\":\"A1\",\"live\":\"A:1\", \"backup\":\"B:1\"}, {\"nodeID\":\"A2\",\"live\":\"A:2\", \"backup\":\"B:2\"}, {\"nodeID\":\"A3\",\"live\":\"A:3\", \"backup\":\"B:3\"}]");
return read("[{\"nodeID\":\"A1\",\"primary\":\"A:1\", \"backup\":\"B:1\"}, {\"nodeID\":\"A2\",\"primary\":\"A:2\", \"backup\":\"B:2\"}, {\"nodeID\":\"A3\",\"primary\":\"A:3\", \"backup\":\"B:3\"}]");
}
@Override
@ -87,14 +87,14 @@ public class ClusterVerifyTest {
switch (uri) {
case "tcp://A:1":
case "tcp://B:1":
return read("[{\"nodeID\":\"A1\",\"live\":\"A:1\", \"backup\":\"B:1\"}, {\"nodeID\":\"A2\",\"live\":\"A:2\", \"backup\":\"B:2\"}, {\"nodeID\":\"A3\",\"live\":\"A:3\", \"backup\":\"B:3\"}]");
return read("[{\"nodeID\":\"A1\",\"primary\":\"A:1\", \"backup\":\"B:1\"}, {\"nodeID\":\"A2\",\"primary\":\"A:2\", \"backup\":\"B:2\"}, {\"nodeID\":\"A3\",\"primary\":\"A:3\", \"backup\":\"B:3\"}]");
case "tcp://A:2":
case "tcp://B:2":
return read("[{\"nodeID\":\"A1\",\"live\":\"A:1\"}, {\"nodeID\":\"A2\",\"live\":\"A:2\"}, {\"nodeID\":\"A3\",\"live\":\"A:3\"}]");
return read("[{\"nodeID\":\"A1\",\"primary\":\"A:1\"}, {\"nodeID\":\"A2\",\"primary\":\"A:2\"}, {\"nodeID\":\"A3\",\"primary\":\"A:3\"}]");
case "tcp://A:3":
case "tcp://B:3":
default:
return read("[{\"nodeID\":\"A1\",\"live\":\"A:1\", \"backup\":\"B:1\"}, {\"nodeID\":\"A2\",\"live\":\"A:2\", \"backup\":\"B:2\"}]");
return read("[{\"nodeID\":\"A1\",\"primary\":\"A:1\", \"backup\":\"B:1\"}, {\"nodeID\":\"A2\",\"primary\":\"A:2\", \"backup\":\"B:2\"}]");
}
} else {
return fetchMainTopology();

View File

@ -45,8 +45,8 @@ public class StreamClassPathTest {
testStream(Create.class, "etc/" + Create.ETC_BROKER_XML);
testStream(Create.class, "etc/" + Create.ETC_ARTEMIS_ROLES_PROPERTIES);
testStream(Create.class, "etc/" + Create.ETC_ARTEMIS_USERS_PROPERTIES);
testStream(Create.class, Create.ETC_REPLICATED_MASTER_SETTINGS_TXT);
testStream(Create.class, Create.ETC_REPLICATED_SLAVE_SETTINGS_TXT);
testStream(Create.class, Create.ETC_REPLICATED_PRIMARY_SETTINGS_TXT);
testStream(Create.class, Create.ETC_REPLICATED_BACKUP_SETTINGS_TXT);
testStream(Create.class, Create.ETC_SHARED_STORE_SETTINGS_TXT);
testStream(Create.class, Create.ETC_CLUSTER_SECURITY_SETTINGS_TXT);
testStream(Create.class, Create.ETC_CLUSTER_SETTINGS_TXT);

View File

@ -43,7 +43,7 @@ public final class UUIDGenerator {
private static final UUIDGenerator sSingleton = new UUIDGenerator();
// Windows has some fake adapters that will return the same HARDWARE ADDRESS on any computer. We need to ignore those
private static final byte[][] BLACK_LIST = new byte[][]{{2, 0, 84, 85, 78, 1}};
private static final byte[][] DENY_LIST = new byte[][]{{2, 0, 84, 85, 78, 1}};
/**
* Random-generator, used by various UUID-generation methods:
@ -211,9 +211,9 @@ public final class UUIDGenerator {
}
private static boolean isBlackList(final byte[] address) {
for (byte[] blackList : UUIDGenerator.BLACK_LIST) {
if (Arrays.equals(address, blackList)) {
private static boolean isDenyList(final byte[] address) {
for (byte[] denyList : UUIDGenerator.DENY_LIST) {
if (Arrays.equals(address, denyList)) {
return true;
}
}
@ -285,8 +285,8 @@ public final class UUIDGenerator {
byte[] paddedAddress = UUIDGenerator.getZeroPaddedSixBytes(address);
if (UUIDGenerator.isBlackList(address)) {
throw new Exception("black listed address");
if (UUIDGenerator.isDenyList(address)) {
throw new Exception("deny listed address");
}
if (paddedAddress != null) {

View File

@ -252,45 +252,45 @@ public class SizeAwareMetricTest {
}
@Test
public void testMaxElementsReleaseNonSizeParentMetric() throws Exception {
SizeAwareMetric metricMaster = new SizeAwareMetric(10000, 500, 10,10);
SizeAwareMetric metricMain = new SizeAwareMetric(10000, 500, 10,10);
SizeAwareMetric metric = new SizeAwareMetric(10000, 500, 1000,1000);
metric.setOnSizeCallback(metricMaster::addSize);
metric.setOnSizeCallback(metricMain::addSize);
AtomicBoolean over = new AtomicBoolean(false);
metricMaster.setOverCallback(() -> over.set(true));
metricMaster.setUnderCallback(() -> over.set(false));
metricMain.setOverCallback(() -> over.set(true));
metricMain.setUnderCallback(() -> over.set(false));
for (int i = 0; i < 11; i++) {
metric.addSize(10);
}
metric.addSize(1000, true);
Assert.assertEquals(1110L, metricMaster.getSize());
Assert.assertEquals(11, metricMaster.getElements());
Assert.assertEquals(1110L, metricMain.getSize());
Assert.assertEquals(11, metricMain.getElements());
Assert.assertEquals(1110L, metric.getSize());
Assert.assertEquals(11, metric.getElements());
Assert.assertTrue(metricMaster.isOverElements());
Assert.assertFalse(metricMaster.isOverSize());
Assert.assertTrue(metricMain.isOverElements());
Assert.assertFalse(metricMain.isOverSize());
Assert.assertFalse(metric.isOverElements());
Assert.assertFalse(metric.isOverSize());
Assert.assertTrue(over.get());
metric.addSize(-1000, true);
Assert.assertEquals(110L, metricMaster.getSize());
Assert.assertEquals(11, metricMaster.getElements());
Assert.assertTrue(metricMaster.isOverElements());
Assert.assertFalse(metricMaster.isOverSize());
Assert.assertEquals(110L, metricMain.getSize());
Assert.assertEquals(11, metricMain.getElements());
Assert.assertTrue(metricMain.isOverElements());
Assert.assertFalse(metricMain.isOverSize());
Assert.assertTrue(over.get());
for (int i = 0; i < 11; i++) {
metric.addSize(-10);
}
Assert.assertEquals(0L, metricMaster.getSize());
Assert.assertEquals(0L, metricMaster.getElements());
Assert.assertFalse(metricMaster.isOver());
Assert.assertEquals(0L, metricMain.getSize());
Assert.assertEquals(0L, metricMain.getElements());
Assert.assertFalse(metricMain.isOver());
Assert.assertEquals(0L, metric.getSize());
Assert.assertEquals(0L, metric.getElements());
Assert.assertFalse(metric.isOver());
@ -494,27 +494,27 @@ public class SizeAwareMetricTest {
@Test
public void testMultipleNonSized() throws Exception {
AtomicBoolean over = new AtomicBoolean(false);
final SizeAwareMetric metricMaster = new SizeAwareMetric(0, 0, 1, 1);
final SizeAwareMetric metricMain = new SizeAwareMetric(0, 0, 1, 1);
SizeAwareMetric metric = new SizeAwareMetric(0, 0, 1, 1);
metric.setSizeEnabled(false);
metric.setOverCallback(() -> over.set(true));
metric.setOnSizeCallback(metricMaster::addSize);
metric.setOnSizeCallback(metricMain::addSize);
for (int i = 0; i < 10; i++) {
metric.addSize(10, true);
}
Assert.assertEquals(100, metricMaster.getSize());
Assert.assertEquals(100, metricMain.getSize());
Assert.assertEquals(100, metric.getSize());
Assert.assertEquals(0, metricMaster.getElements());
Assert.assertEquals(0, metricMain.getElements());
Assert.assertEquals(0, metric.getElements());
for (int i = 0; i < 10; i++) {
metric.addSize(10, false);
}
Assert.assertEquals(200, metricMaster.getSize());
Assert.assertEquals(200, metricMain.getSize());
Assert.assertEquals(200, metric.getSize());
Assert.assertEquals(10, metricMaster.getElements());
Assert.assertEquals(10, metricMain.getElements());
Assert.assertEquals(10, metric.getElements());
}

View File

@ -408,20 +408,20 @@ public final class ActiveMQDefaultConfiguration {
// If true then the server will request a backup on another node
private static boolean DEFAULT_HAPOLICY_REQUEST_BACKUP = false;
// How many times the live server will try to request a backup, -1 means for ever.
// How many times this server will try to request a backup, -1 means for ever.
private static int DEFAULT_HAPOLICY_BACKUP_REQUEST_RETRIES = -1;
// How long to wait for retries between attempts to request a backup server.
private static long DEFAULT_HAPOLICY_BACKUP_REQUEST_RETRY_INTERVAL = 5000;
// Whether or not this live server will accept backup requests from other live servers.
// Whether or not this server will accept backup requests from other servers.
private static int DEFAULT_HAPOLICY_MAX_BACKUPS = 1;
// The offset to use for the Connectors and Acceptors when creating a new backup server.
private static int DEFAULT_HAPOLICY_BACKUP_PORT_OFFSET = 100;
// Whether to check the cluster for a (live) server using our own server ID when starting up. This option is only necessary for performing 'fail-back' on replicating servers. Strictly speaking this setting only applies to live servers and not to backups.
private static boolean DEFAULT_CHECK_FOR_LIVE_SERVER = false;
// Whether to check the cluster for an active server using our own server ID when starting up. This option is only necessary for performing 'fail-back' on replicating servers. Strictly speaking this setting only applies to primary servers and not to backups.
private static boolean DEFAULT_CHECK_FOR_ACTIVE_SERVER = false;
// This specifies how many times a replicated backup server can restart after moving its files on start. Once there are this number of backup journal files the server will stop permanently after if fails back.
private static int DEFAULT_MAX_SAVED_REPLICATED_JOURNALS_SIZE = 2;
@ -435,10 +435,10 @@ public final class ActiveMQDefaultConfiguration {
// When a replica comes online this is how long the replicating server will wait for a confirmation from the replica that the replication synchronization process is complete
private static long DEFAULT_INITIAL_REPLICATION_SYNC_TIMEOUT = 30000;
// Will this backup server come live on a normal server shutdown
// Will this backup server become active on a normal server shutdown
private static boolean DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN = false;
// Will a shared-store master startup wait for activation
// Will a shared-store primary startup wait for activation
private static boolean DEFAULT_WAIT_FOR_ACTIVATION = true;
// Will the broker populate the message with the name of the validated user
@ -1330,7 +1330,7 @@ public final class ActiveMQDefaultConfiguration {
}
/**
* How many times the live server will try to request a backup, -1 means for ever.
* How many times the primary server will try to request a backup, -1 means for ever.
*/
public static int getDefaultHapolicyBackupRequestRetries() {
return DEFAULT_HAPOLICY_BACKUP_REQUEST_RETRIES;
@ -1344,7 +1344,7 @@ public final class ActiveMQDefaultConfiguration {
}
/**
* Whether or not this live server will accept backup requests from other live servers.
* Whether or not this server will accept backup requests from other servers.
*/
public static int getDefaultHapolicyMaxBackups() {
return DEFAULT_HAPOLICY_MAX_BACKUPS;
@ -1358,10 +1358,10 @@ public final class ActiveMQDefaultConfiguration {
}
/**
* Whether to check the cluster for a (live) server using our own server ID when starting up. This option is only necessary for performing 'fail-back' on replicating servers. Strictly speaking this setting only applies to live servers and not to backups.
* Whether to check the cluster for an active server using our own server ID when starting up. This option is only necessary for performing 'fail-back' on replicating servers. Strictly speaking this setting only applies to primary servers and not to backups.
*/
public static boolean isDefaultCheckForLiveServer() {
return DEFAULT_CHECK_FOR_LIVE_SERVER;
public static boolean isDefaultCheckForActiveServer() {
return DEFAULT_CHECK_FOR_ACTIVE_SERVER;
}
/**
@ -1403,14 +1403,14 @@ public final class ActiveMQDefaultConfiguration {
}
/**
* Will this backup server come live on a normal server shutdown
* Will this backup server become active on a normal server shutdown
*/
public static boolean isDefaultFailoverOnServerShutdown() {
return DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
}
/**
* Will a shared-store master startup wait for activation
* Will a shared-store primary startup wait for activation
*/
public static boolean isDefaultWaitForActivation() {
return DEFAULT_WAIT_FOR_ACTIVATION;

View File

@ -100,7 +100,7 @@ public final class JsonUtil {
for (int i1 = 0; i1 < data.length; i1++) {
String dataConverted = convertJsonValue(data[i1], String.class).toString();
try (ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(new ByteArrayInputStream(Base64.decode(dataConverted)))) {
ois.setWhiteList("java.util,java.lang,javax.management");
ois.setAllowList("java.util,java.lang,javax.management");
cds[i1] = (CompositeDataSupport) ois.readObject();
}
}

View File

@ -360,10 +360,10 @@ public final class ActiveMQClient {
}
/**
* Create a ServerLocator which creates session factories from a set of live servers, no HA
* Create a ServerLocator which creates session factories from a set of active servers, no HA
* backup information is propagated to the client
* <p>
* The UDP address and port are used to listen for live servers in the cluster
* The UDP address and port are used to listen for active servers in the cluster
*
* @param groupConfiguration
* @return the ServerLocator
@ -373,9 +373,9 @@ public final class ActiveMQClient {
}
/**
* Create a ServerLocator which creates session factories from a set of live servers, no HA
* Create a ServerLocator which creates session factories from a set of active servers, no HA
* backup information is propagated to the client The UDP address and port are used to listen for
* live servers in the cluster
* active servers in the cluster
*
* @param ha The Locator will support topology updates and ha (this required the server to be
* clustered, otherwise the first connection will timeout)
@ -396,7 +396,7 @@ public final class ActiveMQClient {
* downloaded and automatically updated whenever the cluster topology changes.
* <p>
* If the topology includes backup servers that information is also propagated to the client so
* that it can know which server to failover onto in case of live server failure.
* that it can know which server to failover onto in case of active server failure.
*
* @param initialServers The initial set of servers used to make a connection to the cluster.
* Each one is tried in turn until a successful connection is made. Once a connection
@ -418,7 +418,7 @@ public final class ActiveMQClient {
* updated whenever the cluster topology changes.
* <p>
* If the topology includes backup servers that information is also propagated to the client so
* that it can know which server to failover onto in case of live server failure.
* that it can know which server to failover onto in case of active server failure.
*
* @param groupConfiguration
* @return the ServerLocator

View File

@ -490,7 +490,7 @@ public interface ServerLocator extends AutoCloseable {
ServerLocator setAckBatchSize(int ackBatchSize);
/**
* Returns an array of TransportConfigurations representing the static list of live servers used
* Returns an array of TransportConfigurations representing the static list of servers used
* when creating this object
*
* @return array with all static {@link TransportConfiguration}s
@ -674,7 +674,7 @@ public interface ServerLocator extends AutoCloseable {
int getInitialConnectAttempts();
/**
* Sets the maximum number of failover attempts to establish a connection to other live servers after a connection failure.
* Sets the maximum number of failover attempts to establish a connection to other primary servers after a connection failure.
* <p>
* Value must be -1 (to retry infinitely), 0 (to never retry connection) or greater than 0.
*
@ -690,7 +690,7 @@ public interface ServerLocator extends AutoCloseable {
/**
* Returns true if the client will automatically attempt to connect to the backup server if the initial
* connection to the live server fails
* connection to the primary server fails
* <p>
* Default value is {@link ActiveMQClient#DEFAULT_FAILOVER_ON_INITIAL_CONNECTION}.
*/

View File

@ -28,22 +28,22 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
public interface TopologyMember {
/**
* Returns the {@code backup-group-name} of the live server and backup servers associated with
* Returns the {@code backup-group-name} of the primary server and backup servers associated with
* Topology entry.
* <p>
* This is a server configuration value. A (remote) backup will only work with live servers that
* This is a server configuration value. A (remote) backup will only work with primary servers that
* have a matching {@code backup-group-name}.
* <p>
* This value does not apply to "shared-storage" backup and live pairs.
* This value does not apply to "shared-storage" backup and primary pairs.
*
* @return the {@code backup-group-name}
*/
String getBackupGroupName();
/**
* Returns the {@code scale-down-group-name} of the live server with this Topology entry.
* Returns the {@code scale-down-group-name} of the server with this Topology entry.
* <p>
* This is a server configuration value. a live server will only send its messages to another live server
* This is a server configuration value. An active server will only send its messages to another active server
* with matching {@code scale-down-group-name}.
* <p>
*
@ -54,12 +54,18 @@ public interface TopologyMember {
/**
* @return configuration relative to the live server
*/
@Deprecated(forRemoval = true)
TransportConfiguration getLive();
/**
* @return configuration relative to the primary server
*/
TransportConfiguration getPrimary();
/**
* Returns the TransportConfiguration relative to the backup server if any.
*
* @return a {@link TransportConfiguration} for the backup, or null} if the live server has no
* @return a {@link TransportConfiguration} for the backup, or null if the primary server has no
* backup server.
*/
TransportConfiguration getBackup();

View File

@ -282,7 +282,7 @@ public interface ActiveMQServerControl {
void setMessageCounterSamplePeriod(long newPeriod) throws Exception;
/**
* Returns {@code true} if this server is a backup, {@code false} if it is a live server.
* Returns {@code true} if this server is a backup, {@code false} if it is a primary server.
* <br>
* If a backup server has been activated, returns {@code false}.
*/
@ -290,9 +290,9 @@ public interface ActiveMQServerControl {
boolean isBackup();
/**
* Returns whether this server shares its data store with a corresponding live or backup server.
* Returns whether this server shares its data store with a corresponding primary or backup server.
*/
@Attribute(desc = "Whether this server shares its data store with a corresponding live or backup serve")
@Attribute(desc = "Whether this server shares its data store with a corresponding primary or backup serve")
boolean isSharedStore();
/**
@ -468,7 +468,7 @@ public interface ActiveMQServerControl {
/**
* Returns whether the initial replication synchronization process with the backup server is complete; applicable for
* either the live or backup server.
* either the primary or backup server.
*/
@Attribute(desc = "Whether the initial replication synchronization process with the backup server is complete")
boolean isReplicaSync();

View File

@ -27,15 +27,15 @@ import org.apache.activemq.artemis.api.core.JsonUtil;
*/
public class NodeInfo {
private final String id;
private final String live;
private final String primary;
private final String backup;
public String getId() {
return id;
}
public String getLive() {
return live;
public String getPrimary() {
return primary;
}
public String getBackup() {
@ -51,15 +51,15 @@ public class NodeInfo {
NodeInfo[] nodes = new NodeInfo[array.size()];
for (int i = 0; i < array.size(); i++) {
JsonObject nodeObject = array.getJsonObject(i);
NodeInfo role = new NodeInfo(nodeObject.getString("nodeID"), nodeObject.getString("live", null), nodeObject.getString("backup", null));
NodeInfo role = new NodeInfo(nodeObject.getString("nodeID"), nodeObject.getString("primary", null), nodeObject.getString("backup", null));
nodes[i] = role;
}
return nodes;
}
public NodeInfo(String id, String live, String backup) {
public NodeInfo(String id, String primary, String backup) {
this.id = id;
this.live = live;
this.primary = primary;
this.backup = backup;
}
}

View File

@ -124,7 +124,7 @@ public interface ActiveMQClientLogger {
@LogMessage(id = 212033, value = "unable to send notification when discovery group is stopped", level = LogMessage.Level.WARN)
void errorSendingNotifOnDiscoveryStop(Throwable e);
@LogMessage(id = 212034, value = "There are more than one servers on the network broadcasting the same node id. " + "You will see this message exactly once (per node) if a node is restarted, in which case it can be safely " + "ignored. But if it is logged continuously it means you really do have more than one node on the same network " + "active concurrently with the same node id. This could occur if you have a backup node active at the same time as " + "its live node. nodeID={}", level = LogMessage.Level.WARN)
@LogMessage(id = 212034, value = "There are more than one servers on the network broadcasting the same node id. You will see this message exactly once (per node) if a node is restarted, in which case it can be safely ignored. But if it is logged continuously it means you really do have more than one node on the same network active concurrently with the same node id. This could occur if you have a backup node active at the same time as its primary node. nodeID={}", level = LogMessage.Level.WARN)
void multipleServersBroadcastingSameNode(String nodeId);
@LogMessage(id = 212035, value = "error receiving packet in discovery", level = LogMessage.Level.WARN)

View File

@ -160,7 +160,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
private final ConfirmationWindowWarning confirmationWindowWarning;
private String liveNodeID;
private String primaryNodeID;
// We need to cache this value here since some listeners may be registered after connectionReadyForWrites was called.
private boolean connectionReadyForWrites;
@ -309,7 +309,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
}
@Override
public void setBackupConnector(final TransportConfiguration live, final TransportConfiguration backUp) {
public void setBackupConnector(final TransportConfiguration primary, final TransportConfiguration backUp) {
Connector localConnector = connector;
// if the connector has never been used (i.e. the getConnection hasn't been called yet), we will need
@ -319,15 +319,15 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
localConnector = connectorFactory.createConnector(currentConnectorConfig.getCombinedParams(), new DelegatingBufferHandler(), this, closeExecutor, threadPool, scheduledThreadPool, clientProtocolManager);
}
if (localConnector.isEquivalent(live.getParams()) && backUp != null && !localConnector.isEquivalent(backUp.getParams())
if (localConnector.isEquivalent(primary.getParams()) && backUp != null && !localConnector.isEquivalent(backUp.getParams())
// check if a server is trying to set its cluster connector config as backup connector config
&& !(serverLocator.getClusterTransportConfiguration() != null && serverLocator.getClusterTransportConfiguration().isSameParams(backUp))) {
logger.debug("Setting up backup config = {} for live = {}", backUp, live);
logger.debug("Setting up backup config = {} for primary = {}", backUp, primary);
backupConnectorConfig = backUp;
} else {
if (logger.isDebugEnabled()) {
logger.debug("ClientSessionFactoryImpl received backup update for live/backup pair = {} / {} but it didn't belong to {}",
live, backUp, currentConnectorConfig);
logger.debug("ClientSessionFactoryImpl received backup update for primary/backup pair = {} / {} but it didn't belong to {}",
primary, backUp, currentConnectorConfig);
}
}
}
@ -1086,9 +1086,9 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
//we check if we can actually connect.
// we do it here as to receive the reply connection has to be not null
//make sure to reset this.connection == null
if (connection != null && liveNodeID != null) {
if (connection != null && primaryNodeID != null) {
try {
if (!clientProtocolManager.checkForFailover(liveNodeID)) {
if (!clientProtocolManager.checkForFailover(primaryNodeID)) {
connection.destroy();
this.connection = null;
return null;
@ -1248,8 +1248,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
}
/**
* It will connect to either live or backup accordingly to the current configurations
* it will also switch to backup case it can't connect to live and there's a backup configured
* It will connect to either primary or backup accordingly to the current configurations
* it will also switch to backup case it can't connect to primary and there's a backup configured
*
* @return
*/
@ -1504,7 +1504,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
Connection transportConnection = createTransportConnection();
if (transportConnection == null) {
logger.trace("Neither backup or live were active, will just give up now");
logger.trace("Neither backup or primary were active, will just give up now");
return null;
}
@ -1533,8 +1533,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
}
@Override
public String getLiveNodeId() {
return liveNodeID;
public String getPrimaryNodeId() {
return primaryNodeID;
}
class SessionFactoryTopologyHandler implements TopologyResponseHandler {
@ -1580,9 +1580,9 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
boolean isLast) {
try {
// if it is our connector then set the live id used for failover
// if it is our connector then set the primary id used for failover
if (connectorPair.getA() != null && TransportConfigurationUtil.isSameHost(connectorPair.getA(), currentConnectorConfig)) {
liveNodeID = nodeID;
primaryNodeID = nodeID;
}
serverLocator.notifyNodeUp(uniqueEventID, nodeID, backupGroupName, scaleDownGroupName, connectorPair, isLast);

View File

@ -35,7 +35,7 @@ public interface ClientSessionFactoryInternal extends ClientSessionFactory {
boolean waitForTopology(long timeout, TimeUnit unit);
String getLiveNodeId();
String getPrimaryNodeId();
// for testing

View File

@ -1175,7 +1175,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
@Override
public String getNodeId() {
return sessionFactory.getLiveNodeId();
return sessionFactory.getPrimaryNodeId();
}
// ClientSessionInternal implementation
@ -1766,14 +1766,14 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
return false;
}
String liveNodeId = sessionFactory.getLiveNodeId();
String otherLiveNodeId = ((ClientSessionFactoryInternal) other.getSessionFactory()).getLiveNodeId();
String primaryNodeId = sessionFactory.getPrimaryNodeId();
String otherPrimaryNodeId = ((ClientSessionFactoryInternal) other.getSessionFactory()).getPrimaryNodeId();
if (liveNodeId != null && otherLiveNodeId != null) {
return liveNodeId.equals(otherLiveNodeId);
if (primaryNodeId != null && otherPrimaryNodeId != null) {
return primaryNodeId.equals(otherPrimaryNodeId);
}
//we shouldn't get here, live node id should always be set
//we shouldn't get here, primary node id should always be set
return sessionFactory == other.getSessionFactory();
}

View File

@ -379,7 +379,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
}
/**
* Create a ServerLocatorImpl using a static list of live servers
* Create a ServerLocatorImpl using a static list of servers
*
* @param transportConfigs
*/
@ -402,7 +402,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
}
/**
* Create a ServerLocatorImpl using a static list of live servers
* Create a ServerLocatorImpl using a static list of servers
*
* @param transportConfigs
*/
@ -607,14 +607,14 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
if (topologyMember == null) {
return null;
}
if (topologyMember.getLive() != null) {
ClientSessionFactoryInternal factory = (ClientSessionFactoryInternal) createSessionFactory(topologyMember.getLive());
if (topologyMember.getPrimary() != null) {
ClientSessionFactoryInternal factory = (ClientSessionFactoryInternal) createSessionFactory(topologyMember.getPrimary());
if (topologyMember.getBackup() != null) {
factory.setBackupConnector(topologyMember.getLive(), topologyMember.getBackup());
factory.setBackupConnector(topologyMember.getPrimary(), topologyMember.getBackup());
}
return factory;
}
if (topologyMember.getLive() == null && topologyMember.getBackup() != null) {
if (topologyMember.getPrimary() == null && topologyMember.getBackup() != null) {
// This shouldn't happen, however I wanted this to consider all possible cases
return (ClientSessionFactoryInternal) createSessionFactory(topologyMember.getBackup());
}
@ -1548,14 +1548,14 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
TopologyMember actMember = topology.getMember(nodeID);
if (actMember != null && actMember.getLive() != null && actMember.getBackup() != null) {
if (actMember != null && actMember.getPrimary() != null && actMember.getBackup() != null) {
HashSet<ClientSessionFactory> clonedFactories = new HashSet<>();
synchronized (factories) {
clonedFactories.addAll(factories);
}
for (ClientSessionFactory factory : clonedFactories) {
((ClientSessionFactoryInternal) factory).setBackupConnector(actMember.getLive(), actMember.getBackup());
((ClientSessionFactoryInternal) factory).setBackupConnector(actMember.getPrimary(), actMember.getBackup());
}
}
@ -1597,7 +1597,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
Collection<TopologyMemberImpl> membersCopy = topology.getMembers();
if (membersCopy.size() == 0) {
//it could happen when live is down, in that case we keeps the old copy
//it could happen when primary is down, in that case we keeps the old copy
//and don't update
return;
}

View File

@ -128,7 +128,7 @@ public final class Topology {
/**
* This is called by the server when the node is activated from backup state. It will always succeed
*/
public void updateAsLive(final String nodeId, final TopologyMemberImpl memberInput) {
public void updateAsPrimary(final String nodeId, final TopologyMemberImpl memberInput) {
synchronized (this) {
if (logger.isDebugEnabled()) {
logger.debug("{}::node {}={}", this, nodeId, memberInput);
@ -141,7 +141,7 @@ public final class Topology {
}
/**
* After the node is started, it will resend the notifyLive a couple of times to avoid gossip between two servers
* After the node is started, it will resend the notifyPrimary a couple of times to avoid gossip between two servers
*
* @param nodeId
*/
@ -168,14 +168,14 @@ public final class Topology {
TopologyMemberImpl currentMember = getMember(nodeId);
if (currentMember == null) {
if (logger.isTraceEnabled()) {
logger.trace("There's no live to be updated on backup update, node={} memberInput={}", nodeId, memberInput, new Exception("trace"));
logger.trace("There's no primary to be updated on backup update, node={} memberInput={}", nodeId, memberInput, new Exception("trace"));
}
currentMember = memberInput;
topology.put(nodeId, currentMember);
}
TopologyMemberImpl newMember = new TopologyMemberImpl(nodeId, currentMember.getBackupGroupName(), currentMember.getScaleDownGroupName(), currentMember.getLive(), memberInput.getBackup());
TopologyMemberImpl newMember = new TopologyMemberImpl(nodeId, currentMember.getBackupGroupName(), currentMember.getScaleDownGroupName(), currentMember.getPrimary(), memberInput.getBackup());
newMember.setUniqueEventID(System.currentTimeMillis());
topology.remove(nodeId);
topology.put(nodeId, newMember);
@ -220,11 +220,11 @@ public final class Topology {
sendMemberUp(nodeId, memberInput);
return true;
}
if (uniqueEventID > currentMember.getUniqueEventID() || (currentMember.getLive() == null && memberInput.getLive() != null)) {
TopologyMemberImpl newMember = new TopologyMemberImpl(nodeId, memberInput.getBackupGroupName(), memberInput.getScaleDownGroupName(), memberInput.getLive(), memberInput.getBackup());
if (uniqueEventID > currentMember.getUniqueEventID() || (currentMember.getPrimary() == null && memberInput.getPrimary() != null)) {
TopologyMemberImpl newMember = new TopologyMemberImpl(nodeId, memberInput.getBackupGroupName(), memberInput.getScaleDownGroupName(), memberInput.getPrimary(), memberInput.getBackup());
if (newMember.getLive() == null && currentMember.getLive() != null) {
newMember.setLive(currentMember.getLive());
if (newMember.getPrimary() == null && currentMember.getPrimary() != null) {
newMember.setPrimary(currentMember.getPrimary());
}
if (newMember.getBackup() == null && currentMember.getBackup() != null) {
@ -404,7 +404,7 @@ public final class Topology {
synchronized int nodes() {
int count = 0;
for (TopologyMemberImpl member : topology.values()) {
if (member.getLive() != null) {
if (member.getPrimary() != null) {
count++;
}
if (member.getBackup() != null) {
@ -445,7 +445,7 @@ public final class Topology {
public TransportConfiguration getBackupForConnector(final Connector connector) {
for (TopologyMemberImpl member : topology.values()) {
if (member.getLive() != null && connector.isEquivalent(member.getLive().getParams())) {
if (member.getPrimary() != null && connector.isEquivalent(member.getPrimary().getParams())) {
return member.getBackup();
}
}

View File

@ -58,7 +58,13 @@ public final class TopologyMemberImpl implements TopologyMember {
}
@Override
@Deprecated(forRemoval = true)
public TransportConfiguration getLive() {
return getPrimary();
}
@Override
public TransportConfiguration getPrimary() {
return connector.getA();
}
@ -71,7 +77,7 @@ public final class TopologyMemberImpl implements TopologyMember {
connector.setB(param);
}
public void setLive(final TransportConfiguration param) {
public void setPrimary(final TransportConfiguration param) {
connector.setA(param);
}
@ -129,8 +135,8 @@ public final class TopologyMemberImpl implements TopologyMember {
@Override
public String toURI() {
TransportConfiguration liveConnector = getLive();
Map<String, Object> props = liveConnector.getParams();
TransportConfiguration primaryConnector = getPrimary();
Map<String, Object> props = primaryConnector.getParams();
String host = ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, "localhost", props);
int port = ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, 0, props);
return "tcp://" + host + ":" + port;

View File

@ -422,8 +422,8 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
}
@Override
public boolean checkForFailover(String liveNodeID) throws ActiveMQException {
CheckFailoverMessage packet = new CheckFailoverMessage(liveNodeID);
public boolean checkForFailover(String nodeID) throws ActiveMQException {
CheckFailoverMessage packet = new CheckFailoverMessage(nodeID);
CheckFailoverReplyMessage message = (CheckFailoverReplyMessage) getChannel1().sendBlocking(packet, PacketImpl.CHECK_FOR_FAILOVER_REPLY);
return message.isOkToFailover();
}

View File

@ -163,9 +163,9 @@ public class BackwardsCompatibilityUtils {
public static Pair<TransportConfiguration, TransportConfiguration> checkTCPPairConversion(int clientIncrementingVersion,
TopologyMember member) {
if (clientIncrementingVersion < INITIAL_ACTIVEMQ_INCREMENTING_VERSION) {
return new Pair<>(convertTransport(member.getLive()), convertTransport(member.getBackup()));
return new Pair<>(convertTransport(member.getPrimary()), convertTransport(member.getBackup()));
}
return new Pair<>(member.getLive(), member.getBackup());
return new Pair<>(member.getPrimary(), member.getBackup());
}
/**

View File

@ -107,9 +107,9 @@ public class ClusterTopologyChangeMessage extends PacketImpl {
exit = buffer.readBoolean();
nodeID = buffer.readString();
if (!exit) {
boolean hasLive = buffer.readBoolean();
boolean hasPrimary = buffer.readBoolean();
TransportConfiguration a;
if (hasLive) {
if (hasPrimary) {
a = new TransportConfiguration();
a.decode(buffer);
} else {

View File

@ -106,9 +106,9 @@ public class ClusterTopologyChangeMessage_V2 extends ClusterTopologyChangeMessag
nodeID = buffer.readString();
uniqueEventID = buffer.readLong();
if (!exit) {
boolean hasLive = buffer.readBoolean();
boolean hasPrimary = buffer.readBoolean();
TransportConfiguration a;
if (hasLive) {
if (hasPrimary) {
a = new TransportConfiguration();
a.decode(buffer);
} else {

View File

@ -74,7 +74,7 @@ public interface ClientProtocolManager {
boolean cleanupBeforeFailover(ActiveMQException cause);
boolean checkForFailover(String liveNodeID) throws ActiveMQException;
boolean checkForFailover(String nodeID) throws ActiveMQException;
void setSessionFactory(ClientSessionFactory factory);

View File

@ -32,63 +32,91 @@ public class ObjectInputStreamWithClassLoader extends ObjectInputStream {
/**
* Value used to indicate that all classes should be white or black listed,
* Value used to indicate that all classes should be allowed or denied
*/
public static final String CATCH_ALL_WILDCARD = "*";
@Deprecated(forRemoval = true)
public static final String WHITELIST_PROPERTY = "org.apache.activemq.artemis.jms.deserialization.whitelist";
public static final String ALLOWLIST_PROPERTY = "org.apache.activemq.artemis.jms.deserialization.allowlist";
@Deprecated(forRemoval = true)
public static final String BLACKLIST_PROPERTY = "org.apache.activemq.artemis.jms.deserialization.blacklist";
public static final String DENYLIST_PROPERTY = "org.apache.activemq.artemis.jms.deserialization.denylist";
private List<String> whiteList = new ArrayList<>();
private List<String> blackList = new ArrayList<>();
private List<String> allowList = new ArrayList<>();
private List<String> denyList = new ArrayList<>();
public ObjectInputStreamWithClassLoader(final InputStream in) throws IOException {
super(in);
String whiteList = System.getProperty(WHITELIST_PROPERTY, null);
setWhiteList(whiteList);
addToAllowList(System.getProperty(WHITELIST_PROPERTY, null));
addToAllowList(System.getProperty(ALLOWLIST_PROPERTY, null));
String blackList = System.getProperty(BLACKLIST_PROPERTY, null);
setBlackList(blackList);
addToDenyList(System.getProperty(BLACKLIST_PROPERTY, null));
addToDenyList(System.getProperty(DENYLIST_PROPERTY, null));
}
/**
* @return the whiteList configured on this policy instance.
* @return the allowList configured on this policy instance.
*/
public String getWhiteList() {
return StringUtil.joinStringList(whiteList, ",");
public String getAllowList() {
return StringUtil.joinStringList(allowList, ",");
}
/**
* @return the blackList configured on this policy instance.
* @return the denyList configured on this policy instance.
*/
public String getBlackList() {
return StringUtil.joinStringList(blackList, ",");
public String getDenyList() {
return StringUtil.joinStringList(denyList, ",");
}
/**
* Replaces the currently configured whiteList with a comma separated
* string containing the new whiteList. Null or empty string denotes
* no whiteList entries, {@value #CATCH_ALL_WILDCARD} indicates that
* all classes are whiteListed.
* Replaces the currently configured allowList with a comma separated
* string containing the new allowList. Null or empty string denotes
* no allowList entries, {@value #CATCH_ALL_WILDCARD} indicates that
* all classes are allowListed.
*
* @param whiteList the whiteList that this policy is configured to recognize.
* @param allowList the list that this policy is configured to recognize.
*/
public void setWhiteList(String whiteList) {
this.whiteList = StringUtil.splitStringList(whiteList, ",");
public void setAllowList(String allowList) {
this.allowList = StringUtil.splitStringList(allowList, ",");
}
/**
* Replaces the currently configured blackList with a comma separated
* string containing the new blackList. Null or empty string denotes
* no blacklist entries, {@value #CATCH_ALL_WILDCARD} indicates that
* all classes are blacklisted.
* Adds to the currently configured allowList with a comma separated
* string containing the additional allowList entries. Null or empty
* string denotes no additional allowList entries.
*
* @param blackList the blackList that this policy is configured to recognize.
* @param allowList the additional list entries that this policy is
* configured to recognize.
*/
public void setBlackList(String blackList) {
this.blackList = StringUtil.splitStringList(blackList, ",");
public void addToAllowList(String allowList) {
this.allowList.addAll(StringUtil.splitStringList(allowList, ","));
}
/**
* Replaces the currently configured denyList with a comma separated
* string containing the new denyList. Null or empty string denotes
* no denylist entries, {@value #CATCH_ALL_WILDCARD} indicates that
* all classes are denylisted.
*
* @param denyList the list that this policy is configured to recognize.
*/
public void setDenyList(String denyList) {
this.denyList = StringUtil.splitStringList(denyList, ",");
}
/**
* Adds to the currently configured denyList with a comma separated
* string containing the additional denyList entries. Null or empty
* string denotes no additional denyList entries.
*
* @param denyList the additional list entries that this policy is
* configured to recognize.
*/
public void addToDenyList(String denyList) {
this.denyList.addAll(StringUtil.splitStringList(denyList, ","));
}
@Override
@ -97,12 +125,7 @@ public class ObjectInputStreamWithClassLoader extends ObjectInputStream {
return resolveClass0(desc);
} else {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Class>() {
@Override
public Class run() throws Exception {
return resolveClass0(desc);
}
});
return AccessController.doPrivileged((PrivilegedExceptionAction<Class>) () -> resolveClass0(desc));
} catch (PrivilegedActionException e) {
throw unwrapException(e);
}
@ -115,12 +138,7 @@ public class ObjectInputStreamWithClassLoader extends ObjectInputStream {
return resolveProxyClass0(interfaces);
} else {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Class>() {
@Override
public Class run() throws Exception {
return resolveProxyClass0(interfaces);
}
});
return AccessController.doPrivileged((PrivilegedExceptionAction<Class>) () -> resolveProxyClass0(interfaces));
} catch (PrivilegedActionException e) {
throw unwrapException(e);
}
@ -221,25 +239,25 @@ public class ObjectInputStreamWithClassLoader extends ObjectInputStream {
className = clazz.getName();
}
for (String blackListEntry : blackList) {
if (CATCH_ALL_WILDCARD.equals(blackListEntry)) {
for (String entry : denyList) {
if (CATCH_ALL_WILDCARD.equals(entry)) {
return false;
} else if (isClassOrPackageMatch(className, blackListEntry)) {
} else if (isClassOrPackageMatch(className, entry)) {
return false;
}
}
for (String whiteListEntry : whiteList) {
if (CATCH_ALL_WILDCARD.equals(whiteListEntry)) {
for (String entry : allowList) {
if (CATCH_ALL_WILDCARD.equals(entry)) {
return true;
} else if (isClassOrPackageMatch(className, whiteListEntry)) {
} else if (isClassOrPackageMatch(className, entry)) {
return true;
}
}
// Failing outright rejection or allow from above
// reject only if the whiteList is not empty.
return whiteList.size() == 0;
// reject only if the allowList is not empty.
return allowList.size() == 0;
}
private boolean isClassOrPackageMatch(String className, String listEntry) {

View File

@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlRootElement;
public class AuthorisationDTO {
@XmlElementRef( required = false)
@Deprecated
@Deprecated(forRemoval = true)
WhiteListDTO whitelist;
@XmlElementRef( required = false )
@ -39,7 +39,7 @@ public class AuthorisationDTO {
@XmlElementRef
RoleAccessDTO roleAccess;
@Deprecated
@Deprecated(forRemoval = true)
public WhiteListDTO getWhiteList() {
return whitelist;
}

View File

@ -25,7 +25,7 @@ import java.util.List;
@XmlRootElement(name = "whitelist")
@XmlAccessorType(XmlAccessType.FIELD)
@Deprecated
@Deprecated(forRemoval = true)
public class WhiteListDTO {
@XmlElementRef

View File

@ -47,7 +47,7 @@ var Artemis;
<input type="checkbox" ng-model="$ctrl.showInternalQueues">
</label>
<label style="margin-right: 1em" ng-show="$ctrl.cntLiveBrokers && $ctrl.cntBackupBrokers">Show Live Brokers:
<label style="margin-right: 1em" ng-show="$ctrl.cntLiveBrokers && $ctrl.cntBackupBrokers">Show Primary Brokers:
<input type="checkbox" ng-model="$ctrl.showLiveBrokers">
</label>
<label style="margin-right: 1em" ng-show="$ctrl.cntLiveBrokers && $ctrl.cntBackupBrokers">Show Backup Brokers:
@ -145,30 +145,30 @@ var Artemis;
updateInternalQueueKind();
});
function updateLiveBrokerKind() {
if(ctrl.kinds.ThisMasterBroker && !ctrl.showLiveBrokers) {
delete ctrl.kinds.ThisMasterBroker;
} else if (!ctrl.kinds.ThisMasterBroker && ctrl.showLiveBrokers) {
ctrl.kinds.ThisMasterBroker = true;
if(ctrl.kinds.ThisPrimaryBroker && !ctrl.showLiveBrokers) {
delete ctrl.kinds.ThisPrimaryBroker;
} else if (!ctrl.kinds.ThisPrimaryBroker && ctrl.showLiveBrokers) {
ctrl.kinds.ThisPrimaryBroker = true;
}
if(ctrl.kinds.MasterBroker && !ctrl.showLiveBrokers) {
delete ctrl.kinds.MasterBroker;
} else if (!ctrl.kinds.MasterBroker && ctrl.showLiveBrokers) {
ctrl.kinds.MasterBroker = true;
if(ctrl.kinds.PrimaryBroker && !ctrl.showLiveBrokers) {
delete ctrl.kinds.PrimaryBroker;
} else if (!ctrl.kinds.PrimaryBroker && ctrl.showLiveBrokers) {
ctrl.kinds.PrimaryBroker = true;
}
}
$scope.$watch('$ctrl.showLiveBrokers', function () {
updateLiveBrokerKind();
});
function updateBackupBrokerKind() {
if(ctrl.kinds.ThisSlaveBroker && !ctrl.showBackupBrokers) {
delete ctrl.kinds.ThisSlaveBroker;
} else if (!ctrl.kinds.ThisSlaveBroker && ctrl.showBackupBrokers) {
ctrl.kinds.ThisSlaveBroker = true;
if(ctrl.kinds.ThisBackupBroker && !ctrl.showBackupBrokers) {
delete ctrl.kinds.ThisBackupBroker;
} else if (!ctrl.kinds.ThisBackupBroker && ctrl.showBackupBrokers) {
ctrl.kinds.ThisBackupBroker = true;
}
if(ctrl.kinds.SlaveBroker && !ctrl.showBackupBrokers) {
delete ctrl.kinds.SlaveBroker;
} else if (!ctrl.kinds.SlaveBroker && ctrl.showBackupBrokers) {
ctrl.kinds.SlaveBroker = true;
if(ctrl.kinds.BackupBroker && !ctrl.showBackupBrokers) {
delete ctrl.kinds.BackupBroker;
} else if (!ctrl.kinds.BackupBroker && ctrl.showBackupBrokers) {
ctrl.kinds.BackupBroker = true;
}
if(ctrl.kinds.OtherBroker && !ctrl.showBackupBrokers) {
delete ctrl.kinds.OtherBroker;
@ -196,22 +196,22 @@ var Artemis;
ctrl.addressIcon = "";
ctrl.queueIcon = "";
ctrl.icons = {
"ThisMasterBroker": {
"ThisPrimaryBroker": {
"type": "glyph",
"icon": ctrl.serverIcon,
"fontfamily": "PatternFlyIcons-webfont"
},
"MasterBroker": {
"PrimaryBroker": {
"type": "glyph",
"icon": ctrl.serverIcon,
"fontfamily": "PatternFlyIcons-webfont"
},
"ThisSlaveBroker": {
"ThisBackupBroker": {
"type": "glyph",
"icon": ctrl.serverIcon,
"fontfamily": "PatternFlyIcons-webfont"
},
"SlaveBroker": {
"BackupBroker": {
"type": "glyph",
"icon": ctrl.serverIcon,
"fontfamily": "PatternFlyIcons-webfont"
@ -262,10 +262,10 @@ var Artemis;
ctrl.data.url = "fooBar";
ctrl.kinds = {
"ThisMasterBroker": true,
"MasterBroker": true,
"ThisSlaveBroker": true,
"SlaveBroker": true,
"ThisPrimaryBroker": true,
"PrimaryBroker": true,
"ThisBackupBroker": true,
"BackupBroker": true,
"OtherBroker": true,
"Address": true,
"Queue": true
@ -274,49 +274,49 @@ var Artemis;
ctrl.icons = ctrl.data.icons;
ctrl.nodes = {
"ThisMasterBroker": {
"name": "ThisMasterBroker",
"ThisPrimaryBroker": {
"name": "ThisPrimaryBroker",
"enabled": true,
"radius": 28,
"textX": 0,
"textY": 5,
"height": 30,
"width": 30,
"icon": ctrl.icons["ThisMasterBroker"].icon,
"fontFamily": ctrl.icons["ThisMasterBroker"].fontfamily
"icon": ctrl.icons["ThisPrimaryBroker"].icon,
"fontFamily": ctrl.icons["ThisPrimaryBroker"].fontfamily
},
"MasterBroker": {
"name": "MasterBroker",
"PrimaryBroker": {
"name": "PrimaryBroker",
"enabled": true,
"radius": 28,
"textX": 0,
"textY": 5,
"height": 30,
"width": 30,
"icon": ctrl.icons["MasterBroker"].icon,
"fontFamily": ctrl.icons["MasterBroker"].fontfamily
"icon": ctrl.icons["PrimaryBroker"].icon,
"fontFamily": ctrl.icons["PrimaryBroker"].fontfamily
},
"ThisSlaveBroker": {
"name": "ThisSlaveBroker",
"ThisBackupBroker": {
"name": "ThisBackupBroker",
"enabled": true,
"radius": 28,
"textX": 0,
"textY": 5,
"height": 30,
"width": 30,
"icon": ctrl.icons["ThisSlaveBroker"].icon,
"fontFamily": ctrl.icons["ThisSlaveBroker"].fontfamily
"icon": ctrl.icons["ThisBackupBroker"].icon,
"fontFamily": ctrl.icons["ThisBackupBroker"].fontfamily
},
"SlaveBroker": {
"name": "SlaveBroker",
"BackupBroker": {
"name": "BackupBroker",
"enabled": true,
"radius": 28,
"textX": 0,
"textY": 5,
"height": 30,
"width": 30,
"icon": ctrl.icons["SlaveBroker"].icon,
"fontFamily": ctrl.icons["SlaveBroker"].fontfamily
"icon": ctrl.icons["BackupBroker"].icon,
"fontFamily": ctrl.icons["BackupBroker"].fontfamily
},
"OtherBroker": {
"name": "OtherBroker",
@ -446,10 +446,10 @@ var Artemis;
val.Connectors = [];
}
if (thisBroker.live) {
ctrl.items[thisBroker.live] = {
"name": thisBroker.live.replace(/:6161[67]$/, ""),
"kind": isBackup ? "MasterBroker" : "ThisMasterBroker",
"brokerKind": "master",
ctrl.items[thisBroker.primary] = {
"name": thisBroker.primary.replace(/:6161[67]$/, ""),
"kind": isBackup ? "PrimaryBroker" : "ThisPrimaryBroker",
"brokerKind": "primary",
"status": "broker",
"display_kind": "Server",
"mbean": isBackup ? undefined : mBean
@ -459,30 +459,30 @@ var Artemis;
if (thisBroker.backup) {
ctrl.items[thisBroker.backup] = {
"name": thisBroker.backup.replace(/:6161[67]$/, ""),
"kind": isBackup ? "ThisSlaveBroker" : "SlaveBroker",
"brokerKind": "slave",
"kind": isBackup ? "ThisBackupBroker" : "BackupBroker",
"brokerKind": "backup",
"status": "broker",
"display_kind": "Server",
"mbean": isBackup ? mBean : undefined
};
cntBackupBrokers += 1;
}
if (thisBroker.live && thisBroker.backup) {
if (thisBroker.primary && thisBroker.backup) {
ctrl.relations.push({
"source": thisBroker.live,
"source": thisBroker.primary,
"target": thisBroker.backup
});
}
createAddresses(mBean, thisBroker.live)
createAddresses(mBean, thisBroker.primary)
}
angular.forEach(remoteBrokers, function (remoteBroker) {
if (nodeId != remoteBroker.nodeID) {
if (remoteBroker.live) {
ctrl.items[remoteBroker.live] = {
"name": remoteBroker.live.replace(/:6161[67]$/, ""),
"kind": "MasterBroker",
"brokerKind": "master",
ctrl.items[remoteBroker.primary] = {
"name": remoteBroker.primary.replace(/:6161[67]$/, ""),
"kind": "PrimaryBroker",
"brokerKind": "primary",
"status": "broker",
"display_kind": "Server"
};
@ -490,22 +490,22 @@ var Artemis;
//if we arent a backup then connect to it as we are in the cluster
if(!isBackup) {}
ctrl.relations.push({
"source": thisBroker.live,
"target": remoteBroker.live
"source": thisBroker.primary,
"target": remoteBroker.primary
});
}
if (remoteBroker.backup) {
ctrl.items[remoteBroker.backup] = {
"name": remoteBroker.backup.replace(/:6161[67]$/, ""),
"kind": "SlaveBroker",
"brokerKind": "slave",
"kind": "BackupBroker",
"brokerKind": "backup",
"status": "broker",
"display_kind": "Server"
};
cntBackupBrokers += 1;
ctrl.relations.push({
"source": remoteBroker.backup,
"target": remoteBroker.live
"target": remoteBroker.primary
});
}
}
@ -521,7 +521,7 @@ var Artemis;
ctrl.items[nodeId] = {
"name": nodeId.replace(/:6161[67]$/, ""),
"kind": "OtherBroker",
"brokerKind": "slave",
"brokerKind": "backup",
"status": "broker",
"display_kind": "Server"
};
@ -537,7 +537,7 @@ var Artemis;
ctrl.cntQueues = val.QueueNames.filter(name => !isInternalName(name, 0)).length;
ctrl.cntInternalQueues = val.QueueNames.filter(name => isInternalName(name, 0)).length;
}
function isInternalName(name, start=1) {
// starts at position 1 when the name is surrounded with quotes
return name.startsWith("$", start) || name.startsWith("notif", start);

View File

@ -67,7 +67,7 @@ public class PropertySQLProvider implements SQLProvider {
}
private static final int STATE_ROW_ID = 0;
private static final int LIVE_LOCK_ROW_ID = 1;
private static final int PRIMARY_LOCK_ROW_ID = 1;
private static final int BACKUP_LOCK_ROW_ID = 2;
private static final int NODE_ID_ROW_ID = 3;
@ -210,8 +210,8 @@ public class PropertySQLProvider implements SQLProvider {
}
@Override
public String createLiveLockSQL() {
return format(sql("create-state"), tableName, LIVE_LOCK_ROW_ID);
public String createPrimaryLockSQL() {
return format(sql("create-state"), tableName, PRIMARY_LOCK_ROW_ID);
}
@Override
@ -220,8 +220,8 @@ public class PropertySQLProvider implements SQLProvider {
}
@Override
public String tryAcquireLiveLockSQL() {
return format(sql("try-acquire-lock"), tableName, LIVE_LOCK_ROW_ID);
public String tryAcquirePrimaryLockSQL() {
return format(sql("try-acquire-lock"), tableName, PRIMARY_LOCK_ROW_ID);
}
@Override
@ -230,8 +230,8 @@ public class PropertySQLProvider implements SQLProvider {
}
@Override
public String tryReleaseLiveLockSQL() {
return format(sql("try-release-lock"), tableName, LIVE_LOCK_ROW_ID);
public String tryReleasePrimaryLockSQL() {
return format(sql("try-release-lock"), tableName, PRIMARY_LOCK_ROW_ID);
}
@Override
@ -240,8 +240,8 @@ public class PropertySQLProvider implements SQLProvider {
}
@Override
public String isLiveLockedSQL() {
return format(sql("is-locked"), tableName, LIVE_LOCK_ROW_ID);
public String isPrimaryLockedSQL() {
return format(sql("is-locked"), tableName, PRIMARY_LOCK_ROW_ID);
}
@Override
@ -250,8 +250,8 @@ public class PropertySQLProvider implements SQLProvider {
}
@Override
public String renewLiveLockSQL() {
return format(sql("renew-lock"), tableName, LIVE_LOCK_ROW_ID);
public String renewPrimaryLockSQL() {
return format(sql("renew-lock"), tableName, PRIMARY_LOCK_ROW_ID);
}
@Override

View File

@ -70,23 +70,23 @@ public interface SQLProvider {
String createNodeIdSQL();
String createLiveLockSQL();
String createPrimaryLockSQL();
String createBackupLockSQL();
String tryAcquireLiveLockSQL();
String tryAcquirePrimaryLockSQL();
String tryAcquireBackupLockSQL();
String tryReleaseLiveLockSQL();
String tryReleasePrimaryLockSQL();
String tryReleaseBackupLockSQL();
String isLiveLockedSQL();
String isPrimaryLockedSQL();
String isBackupLockedSQL();
String renewLiveLockSQL();
String renewPrimaryLockSQL();
String renewBackupLockSQL();

View File

@ -80,7 +80,7 @@ public class ActiveMQJMSClient {
* connection is made, up to date cluster topology information is downloaded and automatically
* updated whenever the cluster topology changes. If the topology includes backup servers that
* information is also propagated to the client so that it can know which server to failover onto
* in case of live server failure.
* in case of server failure.
*
* @param groupConfiguration
* @param jmsFactoryType
@ -92,9 +92,9 @@ public class ActiveMQJMSClient {
}
/**
* Create an ActiveMQConnectionFactory which creates session factories from a set of live servers, no HA backup information is propagated to the client
* Create an ActiveMQConnectionFactory which creates session factories from a set of active servers, no HA backup information is propagated to the client
*
* The UDP address and port are used to listen for live servers in the cluster
* The UDP address and port are used to listen for active servers in the cluster
*
* @param groupConfiguration
* @param jmsFactoryType
@ -113,7 +113,7 @@ public class ActiveMQJMSClient {
* the cluster, once that connection is made, up to date cluster topology information is
* downloaded and automatically updated whenever the cluster topology changes. If the topology
* includes backup servers that information is also propagated to the client so that it can know
* which server to failover onto in case of live server failure.
* which server to failover onto in case of server failure.
*
* @param jmsFactoryType
* @param initialServers The initial set of servers used to make a connection to the cluster.

View File

@ -255,7 +255,7 @@ public enum JMSFactoryType {
* connection is made, up to date cluster topology information is downloaded and automatically
* updated whenever the cluster topology changes. If the topology includes backup servers that
* information is also propagated to the client so that it can know which server to failover onto
* in case of live server failure.
* in case of server failure.
*
* @param groupConfiguration
* @return the ActiveMQConnectionFactory
@ -263,9 +263,9 @@ public enum JMSFactoryType {
public abstract ActiveMQConnectionFactory createConnectionFactoryWithHA(DiscoveryGroupConfiguration groupConfiguration);
/**
* Create an ActiveMQConnectionFactory which creates session factories from a set of live servers, no HA backup information is propagated to the client
* Create an ActiveMQConnectionFactory which creates session factories from a set of active servers, no HA backup information is propagated to the client
* <p>
* The UDP address and port are used to listen for live servers in the cluster
* The UDP address and port are used to listen for active servers in the cluster
*
* @param groupConfiguration
* @return the ActiveMQConnectionFactory
@ -280,7 +280,7 @@ public enum JMSFactoryType {
* the cluster, once that connection is made, up to date cluster topology information is
* downloaded and automatically updated whenever the cluster topology changes. If the topology
* includes backup servers that information is also propagated to the client so that it can know
* which server to failover onto in case of live server failure.
* which server to failover onto in case of server failure.
*
* @param initialServers The initial set of servers used to make a connection to the cluster.
* Each one is tried in turn until a successful connection is made. Once a connection

View File

@ -681,12 +681,22 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
return started;
}
@Deprecated(forRemoval = true)
public String getDeserializationBlackList() {
return this.factoryReference.getDeserializationBlackList();
return getDeserializationDenyList();
}
@Deprecated(forRemoval = true)
public String getDeserializationWhiteList() {
return this.factoryReference.getDeserializationWhiteList();
return getDeserializationAllowList();
}
public String getDeserializationDenyList() {
return this.factoryReference.getDeserializationDenyList();
}
public String getDeserializationAllowList() {
return this.factoryReference.getDeserializationAllowList();
}

View File

@ -90,9 +90,9 @@ public class ActiveMQConnectionFactory extends JNDIStorable implements Connectio
private String protocolManagerFactoryStr;
private String deserializationBlackList;
private String deserializationDenyList;
private String deserializationWhiteList;
private String deserializationAllowList;
private boolean cacheDestinations;
@ -169,23 +169,47 @@ public class ActiveMQConnectionFactory extends JNDIStorable implements Connectio
}
@Override
@Deprecated(forRemoval = true)
public String getDeserializationBlackList() {
return deserializationBlackList;
return deserializationDenyList;
}
@Override
public void setDeserializationBlackList(String blackList) {
this.deserializationBlackList = blackList;
@Deprecated(forRemoval = true)
public void setDeserializationBlackList(String denyList) {
this.deserializationDenyList = denyList;
}
@Override
@Deprecated(forRemoval = true)
public String getDeserializationWhiteList() {
return deserializationWhiteList;
return deserializationAllowList;
}
@Override
public void setDeserializationWhiteList(String whiteList) {
this.deserializationWhiteList = whiteList;
@Deprecated(forRemoval = true)
public void setDeserializationWhiteList(String allowList) {
this.deserializationAllowList = allowList;
}
@Override
public String getDeserializationDenyList() {
return deserializationDenyList;
}
@Override
public void setDeserializationDenyList(String denyList) {
this.deserializationDenyList = denyList;
}
@Override
public String getDeserializationAllowList() {
return deserializationAllowList;
}
@Override
public void setDeserializationAllowList(String allowList) {
this.deserializationAllowList = allowList;
}
@Override

View File

@ -137,13 +137,13 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess
}
try (ObjectInputStreamWithClassLoader ois = new ObjectInputStreamWithClassLoader(new ByteArrayInputStream(data))) {
String blackList = getDeserializationBlackList();
if (blackList != null) {
ois.setBlackList(blackList);
String denyList = getDeserializationDenyList();
if (denyList != null) {
ois.setDenyList(denyList);
}
String whiteList = getDeserializationWhiteList();
if (whiteList != null) {
ois.setWhiteList(whiteList);
String allowList = getDeserializationAllowList();
if (allowList != null) {
ois.setAllowList(allowList);
}
Serializable object = (Serializable) ois.readObject();
return object;
@ -181,19 +181,19 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess
}
}
private String getDeserializationBlackList() {
private String getDeserializationDenyList() {
if (options == null) {
return null;
} else {
return options.getDeserializationBlackList();
return options.getDeserializationDenyList();
}
}
private String getDeserializationWhiteList() {
private String getDeserializationAllowList() {
if (options == null) {
return null;
} else {
return options.getDeserializationWhiteList();
return options.getDeserializationAllowList();
}
}
}

View File

@ -690,12 +690,22 @@ public class ActiveMQSession implements QueueSession, TopicSession {
return internalCreateSharedConsumer(localTopic, name, messageSelector, ConsumerDurability.DURABLE);
}
@Deprecated(forRemoval = true)
public String getDeserializationBlackList() {
return connection.getDeserializationBlackList();
return getDeserializationDenyList();
}
@Deprecated(forRemoval = true)
public String getDeserializationWhiteList() {
return connection.getDeserializationWhiteList();
return getDeserializationAllowList();
}
public String getDeserializationDenyList() {
return connection.getDeserializationDenyList();
}
public String getDeserializationAllowList() {
return connection.getDeserializationAllowList();
}
enum ConsumerDurability {

View File

@ -18,16 +18,28 @@ package org.apache.activemq.artemis.jms.client;
/**
* Common interface to be used to share common parameters between the RA and client JMS.
* Initially developed to carry on Serialization packages white list but it could eventually be expanded.
* Initially developed to carry on Serialization packages allow list, but it could eventually be expanded.
*/
public interface ConnectionFactoryOptions {
@Deprecated(forRemoval = true)
String getDeserializationBlackList();
void setDeserializationBlackList(String blackList);
@Deprecated(forRemoval = true)
void setDeserializationBlackList(String denyList);
@Deprecated(forRemoval = true)
String getDeserializationWhiteList();
void setDeserializationWhiteList(String whiteList);
@Deprecated(forRemoval = true)
void setDeserializationWhiteList(String allowList);
String getDeserializationDenyList();
void setDeserializationDenyList(String denyList);
String getDeserializationAllowList();
void setDeserializationAllowList(String allowList);
}

View File

@ -173,13 +173,38 @@ public class ConnectionFactoryURITest {
@Test
public void testTCPAllProperties() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("tcp://localhost:3030?ha=true");
BeanUtilsBean bean = new BeanUtilsBean();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
populate(sb, bean, factory);
ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()), null);
checkEquals(bean, factory, factory2);
ignoreList.add("deserializationBlackList");
ignoreList.add("deserializationWhiteList");
try {
StringBuilder sb = new StringBuilder();
sb.append("tcp://localhost:3030?ha=true");
BeanUtilsBean bean = new BeanUtilsBean();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
populate(sb, bean, factory);
ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()), null);
checkEquals(bean, factory, factory2);
} finally {
ignoreList.remove("deserializationBlackList");
ignoreList.remove("deserializationWhiteList");
}
}
@Test
public void testTCPAllPropertiesWithDeprecatedProps() throws Exception {
ignoreList.add("deserializationDenyList");
ignoreList.add("deserializationAllowList");
try {
StringBuilder sb = new StringBuilder();
sb.append("tcp://localhost:3030?ha=true");
BeanUtilsBean bean = new BeanUtilsBean();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
populate(sb, bean, factory);
ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()), null);
checkEquals(bean, factory, factory2);
} finally {
ignoreList.remove("deserializationDenyList");
ignoreList.remove("deserializationAllowList");
}
}
@Test
@ -295,13 +320,38 @@ public class ConnectionFactoryURITest {
@Test
public void testUDPAllProperties() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("udp://localhost:3030?ha=true");
BeanUtilsBean bean = new BeanUtilsBean();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
populate(sb, bean, factory);
ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()), null);
checkEquals(bean, factory, factory2);
ignoreList.add("deserializationBlackList");
ignoreList.add("deserializationWhiteList");
try {
StringBuilder sb = new StringBuilder();
sb.append("udp://localhost:3030?ha=true");
BeanUtilsBean bean = new BeanUtilsBean();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
populate(sb, bean, factory);
ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()), null);
checkEquals(bean, factory, factory2);
} finally {
ignoreList.remove("deserializationBlackList");
ignoreList.remove("deserializationWhiteList");
}
}
@Test
public void testUDPAllPropertiesWithDeprecatedListProps() throws Exception {
ignoreList.add("deserializationDenyList");
ignoreList.add("deserializationAllowList");
try {
StringBuilder sb = new StringBuilder();
sb.append("udp://localhost:3030?ha=true");
BeanUtilsBean bean = new BeanUtilsBean();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
populate(sb, bean, factory);
ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()), null);
checkEquals(bean, factory, factory2);
} finally {
ignoreList.remove("deserializationDenyList");
ignoreList.remove("deserializationAllowList");
}
}
@Test
@ -356,13 +406,38 @@ public class ConnectionFactoryURITest {
@Test
public void testJGroupsAllProperties() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("jgroups://?file=param=value;param=value&channelName=channelName&ha=true");
BeanUtilsBean bean = new BeanUtilsBean();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
populate(sb, bean, factory);
ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()), null);
checkEquals(bean, factory, factory2);
ignoreList.add("deserializationBlackList");
ignoreList.add("deserializationWhiteList");
try {
StringBuilder sb = new StringBuilder();
sb.append("jgroups://?file=param=value;param=value&channelName=channelName&ha=true");
BeanUtilsBean bean = new BeanUtilsBean();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
populate(sb, bean, factory);
ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()), null);
checkEquals(bean, factory, factory2);
} finally {
ignoreList.remove("deserializationBlackList");
ignoreList.remove("deserializationWhiteList");
}
}
@Test
public void testJGroupsAllPropertiesWithDeprecatedListProps() throws Exception {
ignoreList.add("deserializationDenyList");
ignoreList.add("deserializationAllowList");
try {
StringBuilder sb = new StringBuilder();
sb.append("jgroups://?file=param=value;param=value&channelName=channelName&ha=true");
BeanUtilsBean bean = new BeanUtilsBean();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
populate(sb, bean, factory);
ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()), null);
checkEquals(bean, factory, factory2);
} finally {
ignoreList.remove("deserializationDenyList");
ignoreList.remove("deserializationAllowList");
}
}
@Test

View File

@ -1515,7 +1515,7 @@ public final class JMSBridgeImpl implements JMSBridge {
logger.trace("Sending message {}", msg);
// Make sure the correct time to live gets propagated
// Make sure the correct time-to-live gets propagated
long timeToLive = msg.getJMSExpiration();

View File

@ -184,13 +184,25 @@ public interface ConnectionFactoryConfiguration extends EncodingSupport {
JMSFactoryType getFactoryType();
@Deprecated(forRemoval = true)
String getDeserializationBlackList();
void setDeserializationBlackList(String blackList);
@Deprecated(forRemoval = true)
void setDeserializationBlackList(String denyList);
@Deprecated(forRemoval = true)
String getDeserializationWhiteList();
void setDeserializationWhiteList(String whiteList);
@Deprecated(forRemoval = true)
void setDeserializationWhiteList(String allowList);
String getDeserializationDenyList();
void setDeserializationDenyList(String denyList);
String getDeserializationAllowList();
void setDeserializationAllowList(String allowList);
int getInitialMessagePacketSize();

View File

@ -117,9 +117,9 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
private JMSFactoryType factoryType = JMSFactoryType.CF;
private String deserializationBlackList;
private String deserializationDenyList;
private String deserializationWhiteList;
private String deserializationAllowList;
private int initialMessagePacketSize = ActiveMQClient.DEFAULT_INITIAL_MESSAGE_PACKET_SIZE;
@ -646,9 +646,9 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
protocolManagerFactoryStr = BufferHelper.readNullableSimpleStringAsString(buffer);
deserializationBlackList = BufferHelper.readNullableSimpleStringAsString(buffer);
deserializationDenyList = BufferHelper.readNullableSimpleStringAsString(buffer);
deserializationWhiteList = BufferHelper.readNullableSimpleStringAsString(buffer);
deserializationAllowList = BufferHelper.readNullableSimpleStringAsString(buffer);
enable1xPrefixes = buffer.readableBytes() > 0 ? buffer.readBoolean() : ActiveMQJMSClient.DEFAULT_ENABLE_1X_PREFIXES;
@ -745,9 +745,9 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
BufferHelper.writeAsNullableSimpleString(buffer, protocolManagerFactoryStr);
BufferHelper.writeAsNullableSimpleString(buffer, deserializationBlackList);
BufferHelper.writeAsNullableSimpleString(buffer, deserializationDenyList);
BufferHelper.writeAsNullableSimpleString(buffer, deserializationWhiteList);
BufferHelper.writeAsNullableSimpleString(buffer, deserializationAllowList);
buffer.writeBoolean(enable1xPrefixes);
@ -867,9 +867,9 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
BufferHelper.sizeOfNullableSimpleString(protocolManagerFactoryStr) +
BufferHelper.sizeOfNullableSimpleString(deserializationBlackList) +
BufferHelper.sizeOfNullableSimpleString(deserializationDenyList) +
BufferHelper.sizeOfNullableSimpleString(deserializationWhiteList) +
BufferHelper.sizeOfNullableSimpleString(deserializationAllowList) +
DataConstants.SIZE_BOOLEAN +
// enable1xPrefixes;
@ -896,22 +896,42 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
@Override
public String getDeserializationBlackList() {
return deserializationBlackList;
return deserializationDenyList;
}
@Override
public void setDeserializationBlackList(String blackList) {
this.deserializationBlackList = blackList;
public void setDeserializationBlackList(String denyList) {
this.deserializationDenyList = denyList;
}
@Override
public String getDeserializationWhiteList() {
return this.deserializationWhiteList;
return this.deserializationAllowList;
}
@Override
public void setDeserializationWhiteList(String whiteList) {
this.deserializationWhiteList = whiteList;
public void setDeserializationWhiteList(String allowList) {
this.deserializationAllowList = allowList;
}
@Override
public String getDeserializationDenyList() {
return deserializationDenyList;
}
@Override
public void setDeserializationDenyList(String denyList) {
this.deserializationDenyList = denyList;
}
@Override
public String getDeserializationAllowList() {
return this.deserializationAllowList;
}
@Override
public void setDeserializationAllowList(String allowList) {
this.deserializationAllowList = allowList;
}
@Override

View File

@ -35,13 +35,13 @@ public class TransportConfigurationEncodingSupport {
List<Pair<TransportConfiguration, TransportConfiguration>> configs = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
TransportConfiguration live = decode(buffer);
TransportConfiguration primary = decode(buffer);
boolean hasBackup = buffer.readBoolean();
TransportConfiguration backup = null;
if (hasBackup) {
backup = decode(buffer);
}
configs.add(new Pair<>(live, backup));
configs.add(new Pair<>(primary, backup));
}
return configs;

View File

@ -1217,8 +1217,8 @@ public class JMSServerManagerImpl extends CleaningActivateCallback implements JM
cf.setCompressionLevel(cfConfig.getCompressionLevel());
cf.setGroupID(cfConfig.getGroupID());
cf.setProtocolManagerFactoryStr(cfConfig.getProtocolManagerFactoryStr());
cf.setDeserializationBlackList(cfConfig.getDeserializationBlackList());
cf.setDeserializationWhiteList(cfConfig.getDeserializationWhiteList());
cf.setDeserializationDenyList(cfConfig.getDeserializationDenyList());
cf.setDeserializationAllowList(cfConfig.getDeserializationAllowList());
cf.setInitialMessagePacketSize(cfConfig.getInitialMessagePacketSize());
cf.setEnable1xPrefixes(cfConfig.isEnable1xPrefixes());
cf.setEnableSharedClientID(cfConfig.isEnableSharedClientID());

View File

@ -45,18 +45,18 @@ public interface Journal extends ActiveMQComponent {
*/
STARTED,
/**
* When a replicating server is still not synchronized with its live. So if the live stops,
* the backup may not fail-over and will stop as well.
* When a replicating server is still not synchronized with its replica. So if the replicating
* server stops, the replica may not fail-over and will stop as well.
*/
SYNCING,
/**
* Journal is being used by a replicating server which is up-to-date with its live. That means
* that if the live stops, the backup can fail-over.
* Journal is being used by a replicating server which is up-to-date with its replica. That means
* that if the replicating server stops, the replica can fail-over.
*/
SYNCING_UP_TO_DATE,
/**
* The journal is fully operational. This is the state the journal should be when its server
* is live.
* is active.
*/
LOADED;
}
@ -297,9 +297,9 @@ public interface Journal extends ActiveMQComponent {
* Reserves journal file IDs, creates the necessary files for synchronization, and places
* references to these (reserved for sync) files in the map.
* <p>
* During the synchronization between a live server and backup, we reserve in the backup the
* journal file IDs used in the live server. This call also makes sure the files are created
* empty without any kind of headers added.
* During the synchronization between a replicating server and replica, we reserve in the
* replica the journal file IDs used in the replicating server. This call also makes sure
* the files are created empty without any kind of headers added.
*
* @param fileIds IDs to reserve for synchronization
* @return map to be filled with id and journal file pairs for <b>synchronization</b>.
@ -364,16 +364,17 @@ public interface Journal extends ActiveMQComponent {
/**
* Stops any operation that may delete or modify old (stale) data.
* <p>
* Meant to be used during synchronization of data between a live server and its replicating
* (remote) backup. Old files must not be compacted or deleted during synchronization.
* Meant to be used during synchronization of data between a replicating server and its
* replica. Old files must not be compacted or deleted during synchronization.
*/
void replicationSyncPreserveOldFiles();
/**
* Restarts file reclaim and compacting on the journal.
* <p>
* Meant to be used to revert the effect of {@link #replicationSyncPreserveOldFiles()}. it should
* only be called once the synchronization of the backup and live servers is completed.
* Meant to be used to revert the effect of {@link #replicationSyncPreserveOldFiles()}.
* it should only be called once the synchronization of the replica and replicating
* servers is completed.
*/
void replicationSyncFinished();

View File

@ -100,8 +100,12 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
private boolean clustered;
@Parameter(defaultValue = "false")
@Deprecated(forRemoval = true)
private boolean slave;
@Parameter(defaultValue = "false")
private boolean backup;
@Parameter
private String staticCluster;
@ -204,8 +208,8 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
add(listCommands, "--no-web");
}
if (slave) {
add(listCommands, "--slave");
if (slave || backup) {
add(listCommands, "--backup");
}
if (replicated) {

View File

@ -105,7 +105,7 @@ public class ProtonClientProtocolManager extends ProtonProtocolManager implement
}
@Override
public boolean checkForFailover(String liveNodeID) throws ActiveMQException {
public boolean checkForFailover(String nodeID) throws ActiveMQException {
throw new UnsupportedOperationException();
}

View File

@ -223,7 +223,7 @@ public class AMQPBrokerConnectionManager implements ActiveMQComponent, ClientCon
}
@Override
public boolean checkForFailover(String liveNodeID) throws ActiveMQException {
public boolean checkForFailover(String nodeID) throws ActiveMQException {
return false;
}

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.blacklist;
package org.apache.denylist;
import java.io.Serializable;

View File

@ -67,7 +67,7 @@ public class HornetQClientProtocolManager extends ActiveMQClientProtocolManager
}
@Override
public boolean checkForFailover(String liveNodeID) throws ActiveMQException {
public boolean checkForFailover(String nodeID) throws ActiveMQException {
//HornetQ doesn't support CheckFailoverMessage packet
return true;
}

View File

@ -1021,7 +1021,7 @@ public class ActiveMQRASession implements QueueSession, TopicSession, XAQueueSes
public String getNodeId() throws JMSException {
ActiveMQSession session = (ActiveMQSession) getSessionInternal();
ClientSessionFactoryInternal factory = (ClientSessionFactoryInternal) session.getCoreSession().getSessionFactory();
return factory.getLiveNodeId();
return factory.getPrimaryNodeId();
}
/**

View File

@ -885,28 +885,56 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
raProperties.setProtocolManagerFactoryStr(protocolManagerFactoryStr);
}
@Deprecated(forRemoval = true)
public String getDeserializationBlackList() {
logger.trace("getDeserializationBlackList()");
return raProperties.getDeserializationBlackList();
}
public void setDeserializationBlackList(String deserializationBlackList) {
logger.trace("setDeserializationBlackList({})", deserializationBlackList);
@Deprecated(forRemoval = true)
public void setDeserializationBlackList(String deserializationDenyList) {
logger.trace("setDeserializationBlackList({})", deserializationDenyList);
raProperties.setDeserializationBlackList(deserializationBlackList);
raProperties.setDeserializationDenyList(deserializationDenyList);
}
@Deprecated(forRemoval = true)
public String getDeserializationWhiteList() {
logger.trace("getDeserializationWhiteList()");
return raProperties.getDeserializationWhiteList();
return raProperties.getDeserializationAllowList();
}
public void setDeserializationWhiteList(String deserializationWhiteList) {
logger.trace("setDeserializationWhiteList({})", deserializationWhiteList);
@Deprecated(forRemoval = true)
public void setDeserializationWhiteList(String deserializationAllowList) {
logger.trace("setDeserializationWhiteList({})", deserializationAllowList);
raProperties.setDeserializationWhiteList(deserializationWhiteList);
raProperties.setDeserializationAllowList(deserializationAllowList);
}
public String getDeserializationDenyList() {
logger.trace("getDeserializationDenyList()");
return raProperties.getDeserializationDenyList();
}
public void setDeserializationDenyList(String deserializationDenyList) {
logger.trace("setDeserializationDenyList({})", deserializationDenyList);
raProperties.setDeserializationBlackList(deserializationDenyList);
}
public String getDeserializationAllowList() {
logger.trace("getDeserializationAllowList()");
return raProperties.getDeserializationAllowList();
}
public void setDeserializationAllowList(String deserializationAllowList) {
logger.trace("setDeserializationAllowList({})", deserializationAllowList);
raProperties.setDeserializationAllowList(deserializationAllowList);
}
/**
@ -1756,157 +1784,165 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
}
private void setParams(final ActiveMQConnectionFactory cf, final ConnectionFactoryProperties overrideProperties) {
Boolean val = overrideProperties.isAutoGroup() != null ? overrideProperties.isAutoGroup() : raProperties.isAutoGroup();
if (val != null) {
cf.setAutoGroup(val);
Boolean booleanVal = overrideProperties.isAutoGroup() != null ? overrideProperties.isAutoGroup() : raProperties.isAutoGroup();
if (booleanVal != null) {
cf.setAutoGroup(booleanVal);
}
val = overrideProperties.isBlockOnAcknowledge() != null ? overrideProperties.isBlockOnAcknowledge() : raProperties.isBlockOnAcknowledge();
if (val != null) {
cf.setBlockOnAcknowledge(val);
booleanVal = overrideProperties.isBlockOnAcknowledge() != null ? overrideProperties.isBlockOnAcknowledge() : raProperties.isBlockOnAcknowledge();
if (booleanVal != null) {
cf.setBlockOnAcknowledge(booleanVal);
}
val = overrideProperties.isBlockOnNonDurableSend() != null ? overrideProperties.isBlockOnNonDurableSend() : raProperties.isBlockOnNonDurableSend();
if (val != null) {
cf.setBlockOnNonDurableSend(val);
booleanVal = overrideProperties.isBlockOnNonDurableSend() != null ? overrideProperties.isBlockOnNonDurableSend() : raProperties.isBlockOnNonDurableSend();
if (booleanVal != null) {
cf.setBlockOnNonDurableSend(booleanVal);
}
val = overrideProperties.isBlockOnDurableSend() != null ? overrideProperties.isBlockOnDurableSend() : raProperties.isBlockOnDurableSend();
if (val != null) {
cf.setBlockOnDurableSend(val);
booleanVal = overrideProperties.isBlockOnDurableSend() != null ? overrideProperties.isBlockOnDurableSend() : raProperties.isBlockOnDurableSend();
if (booleanVal != null) {
cf.setBlockOnDurableSend(booleanVal);
}
val = overrideProperties.isPreAcknowledge() != null ? overrideProperties.isPreAcknowledge() : raProperties.isPreAcknowledge();
if (val != null) {
cf.setPreAcknowledge(val);
booleanVal = overrideProperties.isPreAcknowledge() != null ? overrideProperties.isPreAcknowledge() : raProperties.isPreAcknowledge();
if (booleanVal != null) {
cf.setPreAcknowledge(booleanVal);
}
val = overrideProperties.isUseGlobalPools() != null ? overrideProperties.isUseGlobalPools() : raProperties.isUseGlobalPools();
if (val != null) {
cf.setUseGlobalPools(val);
booleanVal = overrideProperties.isUseGlobalPools() != null ? overrideProperties.isUseGlobalPools() : raProperties.isUseGlobalPools();
if (booleanVal != null) {
cf.setUseGlobalPools(booleanVal);
}
val = overrideProperties.isCacheLargeMessagesClient() != null ? overrideProperties.isCacheLargeMessagesClient() : raProperties.isCacheLargeMessagesClient();
if (val != null) {
cf.setCacheLargeMessagesClient(val);
booleanVal = overrideProperties.isCacheLargeMessagesClient() != null ? overrideProperties.isCacheLargeMessagesClient() : raProperties.isCacheLargeMessagesClient();
if (booleanVal != null) {
cf.setCacheLargeMessagesClient(booleanVal);
}
val = overrideProperties.isCompressLargeMessage() != null ? overrideProperties.isCompressLargeMessage() : raProperties.isCompressLargeMessage();
if (val != null) {
cf.setCompressLargeMessage(val);
booleanVal = overrideProperties.isCompressLargeMessage() != null ? overrideProperties.isCompressLargeMessage() : raProperties.isCompressLargeMessage();
if (booleanVal != null) {
cf.setCompressLargeMessage(booleanVal);
}
val = overrideProperties.isCacheDestinations() != null ? overrideProperties.isCacheDestinations() : raProperties.isCacheDestinations();
if (val != null) {
cf.setCacheDestinations(val);
booleanVal = overrideProperties.isCacheDestinations() != null ? overrideProperties.isCacheDestinations() : raProperties.isCacheDestinations();
if (booleanVal != null) {
cf.setCacheDestinations(booleanVal);
}
Integer val2 = overrideProperties.getConsumerMaxRate() != null ? overrideProperties.getConsumerMaxRate() : raProperties.getConsumerMaxRate();
if (val2 != null) {
cf.setConsumerMaxRate(val2);
Integer intVal = overrideProperties.getConsumerMaxRate() != null ? overrideProperties.getConsumerMaxRate() : raProperties.getConsumerMaxRate();
if (intVal != null) {
cf.setConsumerMaxRate(intVal);
}
val2 = overrideProperties.getConsumerWindowSize() != null ? overrideProperties.getConsumerWindowSize() : raProperties.getConsumerWindowSize();
if (val2 != null) {
cf.setConsumerWindowSize(val2);
intVal = overrideProperties.getConsumerWindowSize() != null ? overrideProperties.getConsumerWindowSize() : raProperties.getConsumerWindowSize();
if (intVal != null) {
cf.setConsumerWindowSize(intVal);
}
val2 = overrideProperties.getDupsOKBatchSize() != null ? overrideProperties.getDupsOKBatchSize() : raProperties.getDupsOKBatchSize();
if (val2 != null) {
cf.setDupsOKBatchSize(val2);
intVal = overrideProperties.getDupsOKBatchSize() != null ? overrideProperties.getDupsOKBatchSize() : raProperties.getDupsOKBatchSize();
if (intVal != null) {
cf.setDupsOKBatchSize(intVal);
}
val2 = overrideProperties.getMinLargeMessageSize() != null ? overrideProperties.getMinLargeMessageSize() : raProperties.getMinLargeMessageSize();
if (val2 != null) {
cf.setMinLargeMessageSize(val2);
intVal = overrideProperties.getMinLargeMessageSize() != null ? overrideProperties.getMinLargeMessageSize() : raProperties.getMinLargeMessageSize();
if (intVal != null) {
cf.setMinLargeMessageSize(intVal);
}
val2 = overrideProperties.getProducerMaxRate() != null ? overrideProperties.getProducerMaxRate() : raProperties.getProducerMaxRate();
if (val2 != null) {
cf.setProducerMaxRate(val2);
intVal = overrideProperties.getProducerMaxRate() != null ? overrideProperties.getProducerMaxRate() : raProperties.getProducerMaxRate();
if (intVal != null) {
cf.setProducerMaxRate(intVal);
}
val2 = overrideProperties.getProducerWindowSize() != null ? overrideProperties.getProducerWindowSize() : raProperties.getProducerWindowSize();
if (val2 != null) {
cf.setProducerWindowSize(val2);
intVal = overrideProperties.getProducerWindowSize() != null ? overrideProperties.getProducerWindowSize() : raProperties.getProducerWindowSize();
if (intVal != null) {
cf.setProducerWindowSize(intVal);
}
val2 = overrideProperties.getConfirmationWindowSize() != null ? overrideProperties.getConfirmationWindowSize() : raProperties.getConfirmationWindowSize();
if (val2 != null) {
cf.setConfirmationWindowSize(val2);
intVal = overrideProperties.getConfirmationWindowSize() != null ? overrideProperties.getConfirmationWindowSize() : raProperties.getConfirmationWindowSize();
if (intVal != null) {
cf.setConfirmationWindowSize(intVal);
}
val2 = overrideProperties.getReconnectAttempts() != null ? overrideProperties.getReconnectAttempts() : raProperties.getReconnectAttempts();
if (val2 != null) {
cf.setReconnectAttempts(val2);
intVal = overrideProperties.getReconnectAttempts() != null ? overrideProperties.getReconnectAttempts() : raProperties.getReconnectAttempts();
if (intVal != null) {
cf.setReconnectAttempts(intVal);
} else {
//the global default is 0 but we should always try to reconnect JCA
cf.setReconnectAttempts(-1);
}
val2 = overrideProperties.getThreadPoolMaxSize() != null ? overrideProperties.getThreadPoolMaxSize() : raProperties.getThreadPoolMaxSize();
if (val2 != null) {
cf.setThreadPoolMaxSize(val2);
intVal = overrideProperties.getThreadPoolMaxSize() != null ? overrideProperties.getThreadPoolMaxSize() : raProperties.getThreadPoolMaxSize();
if (intVal != null) {
cf.setThreadPoolMaxSize(intVal);
}
val2 = overrideProperties.getScheduledThreadPoolMaxSize() != null ? overrideProperties.getScheduledThreadPoolMaxSize() : raProperties.getScheduledThreadPoolMaxSize();
if (val2 != null) {
cf.setScheduledThreadPoolMaxSize(val2);
intVal = overrideProperties.getScheduledThreadPoolMaxSize() != null ? overrideProperties.getScheduledThreadPoolMaxSize() : raProperties.getScheduledThreadPoolMaxSize();
if (intVal != null) {
cf.setScheduledThreadPoolMaxSize(intVal);
}
val2 = overrideProperties.getTransactionBatchSize() != null ? overrideProperties.getTransactionBatchSize() : raProperties.getTransactionBatchSize();
if (val2 != null) {
cf.setTransactionBatchSize(val2);
intVal = overrideProperties.getTransactionBatchSize() != null ? overrideProperties.getTransactionBatchSize() : raProperties.getTransactionBatchSize();
if (intVal != null) {
cf.setTransactionBatchSize(intVal);
}
val2 = overrideProperties.getInitialConnectAttempts() != null ? overrideProperties.getInitialConnectAttempts() : raProperties.getInitialConnectAttempts();
if (val2 != null) {
cf.setInitialConnectAttempts(val2);
intVal = overrideProperties.getInitialConnectAttempts() != null ? overrideProperties.getInitialConnectAttempts() : raProperties.getInitialConnectAttempts();
if (intVal != null) {
cf.setInitialConnectAttempts(intVal);
}
val2 = overrideProperties.getInitialMessagePacketSize() != null ? overrideProperties.getInitialMessagePacketSize() : raProperties.getInitialMessagePacketSize();
if (val2 != null) {
cf.setInitialMessagePacketSize(val2);
intVal = overrideProperties.getInitialMessagePacketSize() != null ? overrideProperties.getInitialMessagePacketSize() : raProperties.getInitialMessagePacketSize();
if (intVal != null) {
cf.setInitialMessagePacketSize(intVal);
}
val2 = overrideProperties.getCompressionLevel() != null ? overrideProperties.getCompressionLevel() : raProperties.getCompressionLevel();
if (val2 != null) {
cf.setCompressionLevel(val2);
intVal = overrideProperties.getCompressionLevel() != null ? overrideProperties.getCompressionLevel() : raProperties.getCompressionLevel();
if (intVal != null) {
cf.setCompressionLevel(intVal);
}
Long val3 = overrideProperties.getClientFailureCheckPeriod() != null ? overrideProperties.getClientFailureCheckPeriod() : raProperties.getClientFailureCheckPeriod();
if (val3 != null) {
cf.setClientFailureCheckPeriod(val3);
Long longVal = overrideProperties.getClientFailureCheckPeriod() != null ? overrideProperties.getClientFailureCheckPeriod() : raProperties.getClientFailureCheckPeriod();
if (longVal != null) {
cf.setClientFailureCheckPeriod(longVal);
}
val3 = overrideProperties.getCallTimeout() != null ? overrideProperties.getCallTimeout() : raProperties.getCallTimeout();
if (val3 != null) {
cf.setCallTimeout(val3);
longVal = overrideProperties.getCallTimeout() != null ? overrideProperties.getCallTimeout() : raProperties.getCallTimeout();
if (longVal != null) {
cf.setCallTimeout(longVal);
}
val3 = overrideProperties.getCallFailoverTimeout() != null ? overrideProperties.getCallFailoverTimeout() : raProperties.getCallFailoverTimeout();
if (val3 != null) {
cf.setCallFailoverTimeout(val3);
longVal = overrideProperties.getCallFailoverTimeout() != null ? overrideProperties.getCallFailoverTimeout() : raProperties.getCallFailoverTimeout();
if (longVal != null) {
cf.setCallFailoverTimeout(longVal);
}
val3 = overrideProperties.getConnectionTTL() != null ? overrideProperties.getConnectionTTL() : raProperties.getConnectionTTL();
if (val3 != null) {
cf.setConnectionTTL(val3);
longVal = overrideProperties.getConnectionTTL() != null ? overrideProperties.getConnectionTTL() : raProperties.getConnectionTTL();
if (longVal != null) {
cf.setConnectionTTL(longVal);
}
val3 = overrideProperties.getRetryInterval() != null ? overrideProperties.getRetryInterval() : raProperties.getRetryInterval();
if (val3 != null) {
cf.setRetryInterval(val3);
longVal = overrideProperties.getRetryInterval() != null ? overrideProperties.getRetryInterval() : raProperties.getRetryInterval();
if (longVal != null) {
cf.setRetryInterval(longVal);
}
val3 = overrideProperties.getMaxRetryInterval() != null ? overrideProperties.getMaxRetryInterval() : raProperties.getMaxRetryInterval();
if (val3 != null) {
cf.setMaxRetryInterval(val3);
longVal = overrideProperties.getMaxRetryInterval() != null ? overrideProperties.getMaxRetryInterval() : raProperties.getMaxRetryInterval();
if (longVal != null) {
cf.setMaxRetryInterval(longVal);
}
Double val4 = overrideProperties.getRetryIntervalMultiplier() != null ? overrideProperties.getRetryIntervalMultiplier() : raProperties.getRetryIntervalMultiplier();
if (val4 != null) {
cf.setRetryIntervalMultiplier(val4);
Double doubleVal = overrideProperties.getRetryIntervalMultiplier() != null ? overrideProperties.getRetryIntervalMultiplier() : raProperties.getRetryIntervalMultiplier();
if (doubleVal != null) {
cf.setRetryIntervalMultiplier(doubleVal);
}
String val5 = overrideProperties.getClientID() != null ? overrideProperties.getClientID() : raProperties.getClientID();
if (val5 != null) {
cf.setClientID(val5);
String stringVal = overrideProperties.getClientID() != null ? overrideProperties.getClientID() : raProperties.getClientID();
if (stringVal != null) {
cf.setClientID(stringVal);
}
val5 = overrideProperties.getConnectionLoadBalancingPolicyClassName() != null ? overrideProperties.getConnectionLoadBalancingPolicyClassName() : raProperties.getConnectionLoadBalancingPolicyClassName();
if (val5 != null) {
cf.setConnectionLoadBalancingPolicyClassName(val5);
stringVal = overrideProperties.getConnectionLoadBalancingPolicyClassName() != null ? overrideProperties.getConnectionLoadBalancingPolicyClassName() : raProperties.getConnectionLoadBalancingPolicyClassName();
if (stringVal != null) {
cf.setConnectionLoadBalancingPolicyClassName(stringVal);
}
val5 = overrideProperties.getProtocolManagerFactoryStr() != null ? overrideProperties.getProtocolManagerFactoryStr() : raProperties.getProtocolManagerFactoryStr();
if (val5 != null) {
cf.setProtocolManagerFactoryStr(val5);
stringVal = overrideProperties.getProtocolManagerFactoryStr() != null ? overrideProperties.getProtocolManagerFactoryStr() : raProperties.getProtocolManagerFactoryStr();
if (stringVal != null) {
cf.setProtocolManagerFactoryStr(stringVal);
}
val5 = overrideProperties.getDeserializationBlackList() != null ? overrideProperties.getDeserializationBlackList() : raProperties.getDeserializationBlackList();
if (val5 != null) {
cf.setDeserializationBlackList(val5);
stringVal = overrideProperties.getDeserializationBlackList() != null ? overrideProperties.getDeserializationBlackList() : raProperties.getDeserializationBlackList();
if (stringVal != null) {
cf.setDeserializationBlackList(stringVal);
}
val5 = overrideProperties.getDeserializationWhiteList() != null ? overrideProperties.getDeserializationWhiteList() : raProperties.getDeserializationWhiteList();
if (val5 != null) {
cf.setDeserializationWhiteList(val5);
stringVal = overrideProperties.getDeserializationWhiteList() != null ? overrideProperties.getDeserializationWhiteList() : raProperties.getDeserializationWhiteList();
if (stringVal != null) {
cf.setDeserializationWhiteList(stringVal);
}
stringVal = overrideProperties.getDeserializationDenyList() != null ? overrideProperties.getDeserializationDenyList() : raProperties.getDeserializationDenyList();
if (stringVal != null) {
cf.setDeserializationDenyList(stringVal);
}
stringVal = overrideProperties.getDeserializationAllowList() != null ? overrideProperties.getDeserializationAllowList() : raProperties.getDeserializationAllowList();
if (stringVal != null) {
cf.setDeserializationAllowList(stringVal);
}
cf.setIgnoreJTA(isIgnoreJTA());

View File

@ -126,9 +126,9 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
private String protocolManagerFactoryStr;
private String deserializationBlackList;
private String deserializationDenyList;
private String deserializationWhiteList;
private String deserializationAllowList;
private Boolean enableSharedClientID;
@ -677,24 +677,50 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
}
@Override
@Deprecated(forRemoval = true)
public String getDeserializationBlackList() {
return deserializationBlackList;
return deserializationDenyList;
}
@Override
public void setDeserializationBlackList(String deserializationBlackList) {
this.deserializationBlackList = deserializationBlackList;
@Deprecated(forRemoval = true)
public void setDeserializationBlackList(String deserializationDenyList) {
this.deserializationDenyList = deserializationDenyList;
hasBeenUpdated = true;
}
@Override
@Deprecated(forRemoval = true)
public String getDeserializationWhiteList() {
return this.deserializationWhiteList;
return this.deserializationAllowList;
}
@Override
public void setDeserializationWhiteList(String deserializationWhiteList) {
this.deserializationWhiteList = deserializationWhiteList;
@Deprecated(forRemoval = true)
public void setDeserializationWhiteList(String deserializationAllowList) {
this.deserializationAllowList = deserializationAllowList;
hasBeenUpdated = true;
}
@Override
public String getDeserializationDenyList() {
return deserializationDenyList;
}
@Override
public void setDeserializationDenyList(String deserializationDenyList) {
this.deserializationDenyList = deserializationDenyList;
hasBeenUpdated = true;
}
@Override
public String getDeserializationAllowList() {
return this.deserializationAllowList;
}
@Override
public void setDeserializationAllowList(String deserializationAllowList) {
this.deserializationAllowList = deserializationAllowList;
hasBeenUpdated = true;
}
@ -933,16 +959,16 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
} else if (!connectionParameters.equals(other.connectionParameters))
return false;
if (deserializationBlackList == null) {
if (other.deserializationBlackList != null)
if (deserializationDenyList == null) {
if (other.deserializationDenyList != null)
return false;
} else if (!deserializationBlackList.equals(other.deserializationBlackList))
} else if (!deserializationDenyList.equals(other.deserializationDenyList))
return false;
if (deserializationWhiteList == null) {
if (other.deserializationWhiteList != null)
if (deserializationAllowList == null) {
if (other.deserializationAllowList != null)
return false;
} else if (!deserializationWhiteList.equals(other.deserializationWhiteList))
} else if (!deserializationAllowList.equals(other.deserializationAllowList))
return false;
if (this.enable1xPrefixes == null) {
@ -1006,8 +1032,8 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
result = prime * result + ((groupID == null) ? 0 : groupID.hashCode());
result = prime * result + ((connectorClassName == null) ? 0 : connectorClassName.hashCode());
result = prime * result + ((connectionParameters == null) ? 0 : connectionParameters.hashCode());
result = prime * result + ((deserializationBlackList == null) ? 0 : deserializationBlackList.hashCode());
result = prime * result + ((deserializationWhiteList == null) ? 0 : deserializationWhiteList.hashCode());
result = prime * result + ((deserializationDenyList == null) ? 0 : deserializationDenyList.hashCode());
result = prime * result + ((deserializationAllowList == null) ? 0 : deserializationAllowList.hashCode());
result = prime * result + ((enable1xPrefixes == null) ? 0 : enable1xPrefixes.hashCode());
result = prime * result + ((enableSharedClientID == null) ? 0 : enableSharedClientID.hashCode());
return result;

View File

@ -188,7 +188,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList
if (activation.isDeliveryTransacted() && !activation.getActivationSpec().isUseLocalTx()) {
Map<String, Object> xaResourceProperties = new HashMap<>();
xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_JNDI_NAME, ((ActiveMQResourceAdapter) spec.getResourceAdapter()).getJndiName());
xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_NODE_ID, ((ClientSessionFactoryInternal) cf).getLiveNodeId());
xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_NODE_ID, ((ClientSessionFactoryInternal) cf).getPrimaryNodeId());
xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_PRODUCT_NAME, ActiveMQResourceAdapter.PRODUCT_NAME);
xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_PRODUCT_VERSION, VersionLoader.getVersion().getFullVersion());
XAResource xaResource = ServiceUtils.wrapXAResource(session, xaResourceProperties);

View File

@ -343,7 +343,7 @@ public interface Configuration {
/**
* Returns the connection time to live. <br>
* This value overrides the connection time to live <em>sent by the client</em>. <br>
* This value overrides the connection time-to-live <em>sent by the client</em>. <br>
* Default value is {@link org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration#DEFAULT_CONNECTION_TTL_OVERRIDE}.
*/
long getConnectionTTLOverride();
@ -397,7 +397,7 @@ public interface Configuration {
* @param uri the URI of the acceptor
* @return this
* @throws Exception in case of Parsing errors on the URI
* @see <a href="https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/configuring-transports.md">Configuring the Transport</a>
* @see <a href="https://github.com/apache/activemq-artemis/blob/main/docs/user-manual/en/configuring-transports.md">Configuring the Transport</a>
*/
Configuration addAcceptorConfiguration(String name, String uri) throws Exception;

View File

@ -25,11 +25,11 @@ import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.PrimaryOnlyPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStorePrimaryPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreBackupPolicyConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
@ -38,12 +38,12 @@ import org.apache.activemq.artemis.core.server.cluster.ha.ReplicationPrimaryPoli
import org.apache.activemq.artemis.core.server.cluster.ha.BackupPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.LiveOnlyPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.PrimaryOnlyPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.ReplicaPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStorePrimaryPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreBackupPolicy;
import org.apache.activemq.artemis.uri.AcceptorTransportConfigurationParser;
import org.apache.activemq.artemis.uri.ConnectorTransportConfigurationParser;
@ -67,64 +67,65 @@ public final class ConfigurationUtils {
public static HAPolicy getHAPolicy(HAPolicyConfiguration conf,
ActiveMQServer server) throws ActiveMQIllegalStateException {
if (conf == null) {
return new LiveOnlyPolicy();
return new PrimaryOnlyPolicy();
}
switch (conf.getType()) {
case LIVE_ONLY: {
LiveOnlyPolicyConfiguration pc = (LiveOnlyPolicyConfiguration) conf;
return new LiveOnlyPolicy(getScaleDownPolicy(pc.getScaleDownConfiguration()));
case PRIMARY_ONLY: {
PrimaryOnlyPolicyConfiguration pc = (PrimaryOnlyPolicyConfiguration) conf;
return new PrimaryOnlyPolicy(getScaleDownPolicy(pc.getScaleDownConfiguration()));
}
case REPLICATED: {
ReplicatedPolicyConfiguration pc = (ReplicatedPolicyConfiguration) conf;
return new ReplicatedPolicy(pc.isCheckForLiveServer(), pc.getGroupName(), pc.getClusterName(), pc.getMaxSavedReplicatedJournalsSize(), pc.getInitialReplicationSyncTimeout(), server.getNetworkHealthCheck(), pc.getVoteOnReplicationFailure(), pc.getQuorumSize(), pc.getVoteRetries(), pc.getVoteRetryWait(), pc.getQuorumVoteWait(), pc.getRetryReplicationWait());
return new ReplicatedPolicy(pc.isCheckForActiveServer(), pc.getGroupName(), pc.getClusterName(), pc.getMaxSavedReplicatedJournalsSize(), pc.getInitialReplicationSyncTimeout(), server.getNetworkHealthCheck(), pc.getVoteOnReplicationFailure(), pc.getQuorumSize(), pc.getVoteRetries(), pc.getVoteRetryWait(), pc.getQuorumVoteWait(), pc.getRetryReplicationWait());
}
case REPLICA: {
ReplicaPolicyConfiguration pc = (ReplicaPolicyConfiguration) conf;
return new ReplicaPolicy(pc.getClusterName(), pc.getMaxSavedReplicatedJournalsSize(), pc.getGroupName(), pc.isRestartBackup(), pc.isAllowFailBack(), pc.getInitialReplicationSyncTimeout(), getScaleDownPolicy(pc.getScaleDownConfiguration()), server.getNetworkHealthCheck(), pc.getVoteOnReplicationFailure(), pc.getQuorumSize(), pc.getVoteRetries(), pc.getVoteRetryWait(), pc.getQuorumVoteWait(), pc.getRetryReplicationWait());
}
case PRIMARY:
case REPLICATION_PRIMARY: {
return ReplicationPrimaryPolicy.with((ReplicationPrimaryPolicyConfiguration) conf);
case BACKUP: {
}
case REPLICATION_BACKUP: {
return ReplicationBackupPolicy.with((ReplicationBackupPolicyConfiguration) conf);
}
case SHARED_STORE_MASTER: {
SharedStoreMasterPolicyConfiguration pc = (SharedStoreMasterPolicyConfiguration) conf;
return new SharedStoreMasterPolicy(pc.isFailoverOnServerShutdown(), pc.isWaitForActivation());
case SHARED_STORE_PRIMARY: {
SharedStorePrimaryPolicyConfiguration pc = (SharedStorePrimaryPolicyConfiguration) conf;
return new SharedStorePrimaryPolicy(pc.isFailoverOnServerShutdown(), pc.isWaitForActivation());
}
case SHARED_STORE_SLAVE: {
SharedStoreSlavePolicyConfiguration pc = (SharedStoreSlavePolicyConfiguration) conf;
return new SharedStoreSlavePolicy(pc.isFailoverOnServerShutdown(), pc.isRestartBackup(), pc.isAllowFailBack(), getScaleDownPolicy(pc.getScaleDownConfiguration()));
case SHARED_STORE_BACKUP: {
SharedStoreBackupPolicyConfiguration pc = (SharedStoreBackupPolicyConfiguration) conf;
return new SharedStoreBackupPolicy(pc.isFailoverOnServerShutdown(), pc.isRestartBackup(), pc.isAllowFailBack(), getScaleDownPolicy(pc.getScaleDownConfiguration()));
}
case COLOCATED: {
ColocatedPolicyConfiguration pc = (ColocatedPolicyConfiguration) conf;
HAPolicyConfiguration liveConf = pc.getLiveConfig();
HAPolicy livePolicy;
HAPolicyConfiguration primaryConfig = pc.getPrimaryConfig();
HAPolicy primaryPolicy;
//if null default to colocated
if (liveConf == null) {
livePolicy = new ReplicatedPolicy(server.getNetworkHealthCheck(),ActiveMQDefaultConfiguration.getDefaultQuorumVoteWait());
if (primaryConfig == null) {
primaryPolicy = new ReplicatedPolicy(server.getNetworkHealthCheck(),ActiveMQDefaultConfiguration.getDefaultQuorumVoteWait());
} else {
livePolicy = getHAPolicy(liveConf, server);
primaryPolicy = getHAPolicy(primaryConfig, server);
}
HAPolicyConfiguration backupConf = pc.getBackupConfig();
BackupPolicy backupPolicy;
if (backupConf == null) {
if (livePolicy instanceof ReplicatedPolicy) {
if (primaryPolicy instanceof ReplicatedPolicy) {
backupPolicy = new ReplicaPolicy(server.getNetworkHealthCheck(),ActiveMQDefaultConfiguration.getDefaultQuorumVoteWait());
} else if (livePolicy instanceof SharedStoreMasterPolicy) {
backupPolicy = new SharedStoreSlavePolicy();
} else if (primaryPolicy instanceof SharedStorePrimaryPolicy) {
backupPolicy = new SharedStoreBackupPolicy();
} else {
throw ActiveMQMessageBundle.BUNDLE.liveBackupMismatch();
throw ActiveMQMessageBundle.BUNDLE.primaryBackupMismatch();
}
} else {
backupPolicy = (BackupPolicy) getHAPolicy(backupConf, server);
}
if ((livePolicy instanceof ReplicatedPolicy && !(backupPolicy instanceof ReplicaPolicy)) || (livePolicy instanceof SharedStoreMasterPolicy && !(backupPolicy instanceof SharedStoreSlavePolicy))) {
throw ActiveMQMessageBundle.BUNDLE.liveBackupMismatch();
if ((primaryPolicy instanceof ReplicatedPolicy && !(backupPolicy instanceof ReplicaPolicy)) || (primaryPolicy instanceof SharedStorePrimaryPolicy && !(backupPolicy instanceof SharedStoreBackupPolicy))) {
throw ActiveMQMessageBundle.BUNDLE.primaryBackupMismatch();
}
return new ColocatedPolicy(pc.isRequestBackup(), pc.getBackupRequestRetries(), pc.getBackupRequestRetryInterval(), pc.getMaxBackups(), pc.getBackupPortOffset(), pc.getExcludedConnectors(), livePolicy, backupPolicy);
return new ColocatedPolicy(pc.isRequestBackup(), pc.getBackupRequestRetries(), pc.getBackupRequestRetryInterval(), pc.getMaxBackups(), pc.getBackupPortOffset(), pc.getExcludedConnectors(), primaryPolicy, backupPolicy);
}
}

View File

@ -21,14 +21,14 @@ import java.io.Serializable;
public interface HAPolicyConfiguration extends Serializable {
enum TYPE {
LIVE_ONLY("Live Only"),
PRIMARY_ONLY("Primary Only"),
REPLICATED("Replicated"),
REPLICA("Replica"),
SHARED_STORE_MASTER("Shared Store Master"),
SHARED_STORE_SLAVE("Shared Store Slave"),
SHARED_STORE_PRIMARY("Shared Store Primary"),
SHARED_STORE_BACKUP("Shared Store Backup"),
COLOCATED("Colocated"),
PRIMARY("Primary"),
BACKUP("Backup");
REPLICATION_PRIMARY("Replication Primary w/pluggable quorum voting"),
REPLICATION_BACKUP("Replication Backup w/pluggable quorum voting");
private String name;

View File

@ -38,7 +38,7 @@ public class ColocatedPolicyConfiguration implements HAPolicyConfiguration {
private int portOffset = ActiveMQDefaultConfiguration.getDefaultHapolicyBackupPortOffset();
private HAPolicyConfiguration liveConfig;
private HAPolicyConfiguration primaryConfig;
private HAPolicyConfiguration backupConfig;
@ -113,12 +113,12 @@ public class ColocatedPolicyConfiguration implements HAPolicyConfiguration {
return this;
}
public HAPolicyConfiguration getLiveConfig() {
return liveConfig;
public HAPolicyConfiguration getPrimaryConfig() {
return primaryConfig;
}
public ColocatedPolicyConfiguration setLiveConfig(HAPolicyConfiguration liveConfig) {
this.liveConfig = liveConfig;
public ColocatedPolicyConfiguration setPrimaryConfig(HAPolicyConfiguration primaryConfig) {
this.primaryConfig = primaryConfig;
return this;
}

View File

@ -19,18 +19,21 @@ package org.apache.activemq.artemis.core.config.ha;
import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ScaleDownConfiguration;
@Deprecated(forRemoval = true)
public class LiveOnlyPolicyConfiguration implements HAPolicyConfiguration {
@Deprecated(forRemoval = true)
public LiveOnlyPolicyConfiguration() {
}
@Deprecated(forRemoval = true)
public LiveOnlyPolicyConfiguration(ScaleDownConfiguration scaleDownConfiguration) {
this.scaleDownConfiguration = scaleDownConfiguration;
}
@Override
public TYPE getType() {
return TYPE.LIVE_ONLY;
return TYPE.PRIMARY_ONLY;
}
public ScaleDownConfiguration getScaleDownConfiguration() {

View File

@ -0,0 +1,45 @@
/*
* 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.config.ha;
import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ScaleDownConfiguration;
public class PrimaryOnlyPolicyConfiguration implements HAPolicyConfiguration {
public PrimaryOnlyPolicyConfiguration() {
}
public PrimaryOnlyPolicyConfiguration(ScaleDownConfiguration scaleDownConfiguration) {
this.scaleDownConfiguration = scaleDownConfiguration;
}
@Override
public TYPE getType() {
return TYPE.PRIMARY_ONLY;
}
public ScaleDownConfiguration getScaleDownConfiguration() {
return scaleDownConfiguration;
}
public void setScaleDownConfiguration(ScaleDownConfiguration scaleDownConfiguration) {
this.scaleDownConfiguration = scaleDownConfiguration;
}
ScaleDownConfiguration scaleDownConfiguration;
}

View File

@ -21,7 +21,7 @@ import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
public class ReplicatedPolicyConfiguration implements HAPolicyConfiguration {
private boolean checkForLiveServer = ActiveMQDefaultConfiguration.isDefaultCheckForLiveServer();
private boolean checkForPrimaryServer = ActiveMQDefaultConfiguration.isDefaultCheckForActiveServer();
private String groupName = null;
@ -52,12 +52,12 @@ public class ReplicatedPolicyConfiguration implements HAPolicyConfiguration {
return TYPE.REPLICATED;
}
public boolean isCheckForLiveServer() {
return checkForLiveServer;
public boolean isCheckForActiveServer() {
return checkForPrimaryServer;
}
public ReplicatedPolicyConfiguration setCheckForLiveServer(boolean checkForLiveServer) {
this.checkForLiveServer = checkForLiveServer;
public ReplicatedPolicyConfiguration setCheckForActiveServer(boolean checkForPrimaryServer) {
this.checkForPrimaryServer = checkForPrimaryServer;
return this;
}

View File

@ -47,7 +47,7 @@ public class ReplicationBackupPolicyConfiguration implements HAPolicyConfigurati
@Override
public HAPolicyConfiguration.TYPE getType() {
return TYPE.BACKUP;
return TYPE.REPLICATION_BACKUP;
}
public String getClusterName() {

View File

@ -44,7 +44,7 @@ public class ReplicationPrimaryPolicyConfiguration implements HAPolicyConfigurat
@Override
public TYPE getType() {
return TYPE.PRIMARY;
return TYPE.REPLICATION_PRIMARY;
}
public String getGroupName() {

View File

@ -20,7 +20,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ScaleDownConfiguration;
public class SharedStoreSlavePolicyConfiguration implements HAPolicyConfiguration {
public class SharedStoreBackupPolicyConfiguration implements HAPolicyConfiguration {
private boolean failoverOnServerShutdown = ActiveMQDefaultConfiguration.isDefaultFailoverOnServerShutdown();
@ -30,19 +30,19 @@ public class SharedStoreSlavePolicyConfiguration implements HAPolicyConfiguratio
private ScaleDownConfiguration scaleDownConfiguration;
public SharedStoreSlavePolicyConfiguration() {
public SharedStoreBackupPolicyConfiguration() {
}
@Override
public TYPE getType() {
return TYPE.SHARED_STORE_SLAVE;
return TYPE.SHARED_STORE_BACKUP;
}
public boolean isRestartBackup() {
return restartBackup;
}
public SharedStoreSlavePolicyConfiguration setRestartBackup(boolean restartBackup) {
public SharedStoreBackupPolicyConfiguration setRestartBackup(boolean restartBackup) {
this.restartBackup = restartBackup;
return this;
}
@ -51,7 +51,7 @@ public class SharedStoreSlavePolicyConfiguration implements HAPolicyConfiguratio
return scaleDownConfiguration;
}
public SharedStoreSlavePolicyConfiguration setScaleDownConfiguration(ScaleDownConfiguration scaleDownConfiguration) {
public SharedStoreBackupPolicyConfiguration setScaleDownConfiguration(ScaleDownConfiguration scaleDownConfiguration) {
this.scaleDownConfiguration = scaleDownConfiguration;
return this;
}
@ -60,7 +60,7 @@ public class SharedStoreSlavePolicyConfiguration implements HAPolicyConfiguratio
return allowFailBack;
}
public SharedStoreSlavePolicyConfiguration setAllowFailBack(boolean allowFailBack) {
public SharedStoreBackupPolicyConfiguration setAllowFailBack(boolean allowFailBack) {
this.allowFailBack = allowFailBack;
return this;
}
@ -69,7 +69,7 @@ public class SharedStoreSlavePolicyConfiguration implements HAPolicyConfiguratio
return failoverOnServerShutdown;
}
public SharedStoreSlavePolicyConfiguration setFailoverOnServerShutdown(boolean failoverOnServerShutdown) {
public SharedStoreBackupPolicyConfiguration setFailoverOnServerShutdown(boolean failoverOnServerShutdown) {
this.failoverOnServerShutdown = failoverOnServerShutdown;
return this;
}
@ -80,7 +80,7 @@ public class SharedStoreSlavePolicyConfiguration implements HAPolicyConfiguratio
}
@Deprecated
public SharedStoreSlavePolicyConfiguration setFailbackDelay(long failbackDelay) {
public SharedStoreBackupPolicyConfiguration setFailbackDelay(long failbackDelay) {
return this;
}
}

View File

@ -19,17 +19,17 @@ package org.apache.activemq.artemis.core.config.ha;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
public class SharedStoreMasterPolicyConfiguration implements HAPolicyConfiguration {
public class SharedStorePrimaryPolicyConfiguration implements HAPolicyConfiguration {
private boolean failoverOnServerShutdown = ActiveMQDefaultConfiguration.isDefaultFailoverOnServerShutdown();
private boolean waitForActivation = ActiveMQDefaultConfiguration.isDefaultWaitForActivation();
public SharedStoreMasterPolicyConfiguration() {
public SharedStorePrimaryPolicyConfiguration() {
}
@Override
public TYPE getType() {
return TYPE.SHARED_STORE_MASTER;
return TYPE.SHARED_STORE_PRIMARY;
}
@Deprecated
@ -38,7 +38,7 @@ public class SharedStoreMasterPolicyConfiguration implements HAPolicyConfigurati
}
@Deprecated
public SharedStoreMasterPolicyConfiguration setFailbackDelay(long failbackDelay) {
public SharedStorePrimaryPolicyConfiguration setFailbackDelay(long failbackDelay) {
return this;
}
@ -46,7 +46,7 @@ public class SharedStoreMasterPolicyConfiguration implements HAPolicyConfigurati
return failoverOnServerShutdown;
}
public SharedStoreMasterPolicyConfiguration setFailoverOnServerShutdown(boolean failoverOnServerShutdown) {
public SharedStorePrimaryPolicyConfiguration setFailoverOnServerShutdown(boolean failoverOnServerShutdown) {
this.failoverOnServerShutdown = failoverOnServerShutdown;
return this;
}
@ -55,7 +55,7 @@ public class SharedStoreMasterPolicyConfiguration implements HAPolicyConfigurati
return waitForActivation;
}
public SharedStoreMasterPolicyConfiguration setWaitForActivation(Boolean waitForActivation) {
public SharedStorePrimaryPolicyConfiguration setWaitForActivation(Boolean waitForActivation) {
this.waitForActivation = waitForActivation;
return this;
}

View File

@ -2339,17 +2339,17 @@ public class ConfigurationImpl implements Configuration, Serializable {
this.artemisInstance = directory;
}
public boolean isCheckForLiveServer() {
public boolean isCheckForPrimaryServer() {
if (haPolicyConfiguration instanceof ReplicaPolicyConfiguration) {
return ((ReplicatedPolicyConfiguration) haPolicyConfiguration).isCheckForLiveServer();
return ((ReplicatedPolicyConfiguration) haPolicyConfiguration).isCheckForActiveServer();
} else {
return false;
}
}
public ConfigurationImpl setCheckForLiveServer(boolean checkForLiveServer) {
public ConfigurationImpl setCheckForPrimaryServer(boolean checkForPrimaryServer) {
if (haPolicyConfiguration instanceof ReplicaPolicyConfiguration) {
((ReplicatedPolicyConfiguration) haPolicyConfiguration).setCheckForLiveServer(checkForLiveServer);
((ReplicatedPolicyConfiguration) haPolicyConfiguration).setCheckForActiveServer(checkForPrimaryServer);
}
return this;

View File

@ -72,13 +72,13 @@ import org.apache.activemq.artemis.core.config.federation.FederationTransformerC
import org.apache.activemq.artemis.core.config.federation.FederationUpstreamConfiguration;
import org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration;
import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.PrimaryOnlyPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreBackupPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStorePrimaryPolicyConfiguration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
import org.apache.activemq.artemis.core.config.routing.CacheConfiguration;
import org.apache.activemq.artemis.core.config.routing.ConnectionRouterConfiguration;
@ -422,7 +422,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
//if we aren already set then set to default
if (config.getHAPolicyConfiguration() == null) {
config.setHAPolicyConfiguration(new LiveOnlyPolicyConfiguration());
config.setHAPolicyConfiguration(new PrimaryOnlyPolicyConfiguration());
}
config.setResolveProtocols(getBoolean(e, "resolve-protocols", config.isResolveProtocols()));
@ -1648,6 +1648,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
static {
HA_LIST.add("live-only");
HA_LIST.add("primary-only");
HA_LIST.add("shared-store");
HA_LIST.add("replication");
}
@ -1679,167 +1680,164 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
if (haNodeList.getLength() > 0) {
Element haNode = (Element) haNodeList.item(0);
if (haNode.getTagName().equals("replication")) {
NodeList masterNodeList = e.getElementsByTagName("master");
if (masterNodeList.getLength() > 0) {
Element masterNode = (Element) masterNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createReplicatedHaPolicy(masterNode));
}
NodeList slaveNodeList = e.getElementsByTagName("slave");
if (slaveNodeList.getLength() > 0) {
Element slaveNode = (Element) slaveNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createReplicaHaPolicy(slaveNode));
}
// check for "colocated" first because it will contain primary/master & backup/slave elements of its own
NodeList colocatedNodeList = e.getElementsByTagName("colocated");
if (colocatedNodeList.getLength() > 0) {
Element colocatedNode = (Element) colocatedNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createColocatedHaPolicy(colocatedNode, true));
return;
}
NodeList primaryNodeList = e.getElementsByTagName("primary");
NodeList primaryNodeList = e.getElementsByTagName("master");
if (primaryNodeList.getLength() > 0) {
ActiveMQServerLogger.LOGGER.deprecatedConfigurationOption("master", "primary");
mainConfig.setHAPolicyConfiguration(createReplicationPrimaryHaPolicy((Element) primaryNodeList.item(0)));
return;
}
NodeList backupNodeList = e.getElementsByTagName("slave");
if (backupNodeList.getLength() > 0) {
ActiveMQServerLogger.LOGGER.deprecatedConfigurationOption("slave", "backup");
mainConfig.setHAPolicyConfiguration(createReplicationBackupHaPolicy((Element) backupNodeList.item(0)));
return;
}
primaryNodeList = e.getElementsByTagName("primary");
if (primaryNodeList.getLength() > 0) {
Element primaryNode = (Element) primaryNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createReplicationPrimaryHaPolicy(primaryNode, mainConfig));
if (primaryNode.getElementsByTagName("manager").item(0) != null) {
mainConfig.setHAPolicyConfiguration(createPluggableReplicationPrimaryHaPolicy(primaryNode));
return;
} else {
mainConfig.setHAPolicyConfiguration(createReplicationPrimaryHaPolicy(primaryNode));
return;
}
}
NodeList backupNodeList = e.getElementsByTagName("backup");
backupNodeList = e.getElementsByTagName("backup");
if (backupNodeList.getLength() > 0) {
Element backupNode = (Element) backupNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createReplicationBackupHaPolicy(backupNode, mainConfig));
if (backupNode.getElementsByTagName("manager").item(0) != null) {
mainConfig.setHAPolicyConfiguration(createPluggableReplicationBackupHaPolicy(backupNode));
return;
} else {
mainConfig.setHAPolicyConfiguration(createReplicationBackupHaPolicy(backupNode));
return;
}
}
} else if (haNode.getTagName().equals("shared-store")) {
NodeList masterNodeList = e.getElementsByTagName("master");
if (masterNodeList.getLength() > 0) {
Element masterNode = (Element) masterNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createSharedStoreMasterHaPolicy(masterNode));
}
NodeList slaveNodeList = e.getElementsByTagName("slave");
if (slaveNodeList.getLength() > 0) {
Element slaveNode = (Element) slaveNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createSharedStoreSlaveHaPolicy(slaveNode));
}
// check for "colocated" first because it will contain primary/master & backup/slave elements of its own
NodeList colocatedNodeList = e.getElementsByTagName("colocated");
if (colocatedNodeList.getLength() > 0) {
Element colocatedNode = (Element) colocatedNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createColocatedHaPolicy(colocatedNode, false));
return;
}
NodeList primaryNodeList = e.getElementsByTagName("master");
if (primaryNodeList.getLength() > 0) {
ActiveMQServerLogger.LOGGER.deprecatedConfigurationOption("master", "primary");
mainConfig.setHAPolicyConfiguration(createSharedStorePrimaryHaPolicy((Element) primaryNodeList.item(0)));
return;
}
NodeList backupNodeList = e.getElementsByTagName("slave");
if (backupNodeList.getLength() > 0) {
ActiveMQServerLogger.LOGGER.deprecatedConfigurationOption("slave", "backup");
mainConfig.setHAPolicyConfiguration(createSharedStoreBackupHaPolicy((Element) backupNodeList.item(0)));
return;
}
primaryNodeList = e.getElementsByTagName("primary");
if (primaryNodeList.getLength() > 0) {
mainConfig.setHAPolicyConfiguration(createSharedStorePrimaryHaPolicy((Element) primaryNodeList.item(0)));
return;
}
backupNodeList = e.getElementsByTagName("backup");
if (backupNodeList.getLength() > 0) {
mainConfig.setHAPolicyConfiguration(createSharedStoreBackupHaPolicy((Element) backupNodeList.item(0)));
return;
}
} else if (haNode.getTagName().equals("live-only")) {
NodeList noneNodeList = e.getElementsByTagName("live-only");
Element noneNode = (Element) noneNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createLiveOnlyHaPolicy(noneNode));
mainConfig.setHAPolicyConfiguration(createPrimaryOnlyHaPolicy(noneNode));
} else if (haNode.getTagName().equals("primary-only")) {
NodeList noneNodeList = e.getElementsByTagName("primary-only");
Element noneNode = (Element) noneNodeList.item(0);
mainConfig.setHAPolicyConfiguration(createPrimaryOnlyHaPolicy(noneNode));
}
}
}
}
private LiveOnlyPolicyConfiguration createLiveOnlyHaPolicy(Element policyNode) {
LiveOnlyPolicyConfiguration configuration = new LiveOnlyPolicyConfiguration();
private PrimaryOnlyPolicyConfiguration createPrimaryOnlyHaPolicy(Element policyNode) {
PrimaryOnlyPolicyConfiguration configuration = new PrimaryOnlyPolicyConfiguration();
configuration.setScaleDownConfiguration(parseScaleDownConfig(policyNode));
return configuration;
}
private ReplicatedPolicyConfiguration createReplicatedHaPolicy(Element policyNode) {
private ReplicatedPolicyConfiguration createReplicationPrimaryHaPolicy(Element policyNode) {
ReplicatedPolicyConfiguration configuration = new ReplicatedPolicyConfiguration();
configuration.setQuorumVoteWait(getInteger(policyNode, "quorum-vote-wait", ActiveMQDefaultConfiguration.getDefaultQuorumVoteWait(), GT_ZERO));
configuration.setCheckForLiveServer(getBoolean(policyNode, "check-for-live-server", configuration.isCheckForLiveServer()));
final String checkForLiveServer = "check-for-live-server";
final String checkForActiveServer = "check-for-active-server";
if (policyNode.getElementsByTagName(checkForLiveServer).getLength() > 0) {
ActiveMQServerLogger.LOGGER.deprecatedConfigurationOption(checkForLiveServer, checkForActiveServer);
configuration.setCheckForActiveServer(getBoolean(policyNode, checkForLiveServer, configuration.isCheckForActiveServer()));
} else {
configuration.setCheckForActiveServer(getBoolean(policyNode, checkForActiveServer, configuration.isCheckForActiveServer()));
}
configuration.setGroupName(getString(policyNode, "group-name", configuration.getGroupName(), NO_CHECK));
configuration.setClusterName(getString(policyNode, "cluster-name", configuration.getClusterName(), NO_CHECK));
configuration.setMaxSavedReplicatedJournalsSize(getInteger(policyNode, "max-saved-replicated-journals-size", configuration.getMaxSavedReplicatedJournalsSize(), MINUS_ONE_OR_GE_ZERO));
configuration.setInitialReplicationSyncTimeout(getLong(policyNode, "initial-replication-sync-timeout", configuration.getInitialReplicationSyncTimeout(), GT_ZERO));
configuration.setVoteOnReplicationFailure(getBoolean(policyNode, "vote-on-replication-failure", configuration.getVoteOnReplicationFailure()));
configuration.setVoteRetries(getInteger(policyNode, "vote-retries", configuration.getVoteRetries(), MINUS_ONE_OR_GE_ZERO));
configuration.setVoteRetryWait(getLong(policyNode, "vote-retry-wait", configuration.getVoteRetryWait(), GT_ZERO));
configuration.setRetryReplicationWait(getLong(policyNode, "retry-replication-wait", configuration.getVoteRetryWait(), GT_ZERO));
configuration.setQuorumSize(getInteger(policyNode, "quorum-size", configuration.getQuorumSize(), MINUS_ONE_OR_GT_ZERO));
return configuration;
}
private ReplicaPolicyConfiguration createReplicaHaPolicy(Element policyNode) {
private ReplicaPolicyConfiguration createReplicationBackupHaPolicy(Element policyNode) {
ReplicaPolicyConfiguration configuration = new ReplicaPolicyConfiguration();
configuration.setQuorumVoteWait(getInteger(policyNode, "quorum-vote-wait", ActiveMQDefaultConfiguration.getDefaultQuorumVoteWait(), GT_ZERO));
configuration.setRestartBackup(getBoolean(policyNode, "restart-backup", configuration.isRestartBackup()));
configuration.setGroupName(getString(policyNode, "group-name", configuration.getGroupName(), NO_CHECK));
configuration.setAllowFailBack(getBoolean(policyNode, "allow-failback", configuration.isAllowFailBack()));
configuration.setInitialReplicationSyncTimeout(getLong(policyNode, "initial-replication-sync-timeout", configuration.getInitialReplicationSyncTimeout(), GT_ZERO));
configuration.setClusterName(getString(policyNode, "cluster-name", configuration.getClusterName(), NO_CHECK));
configuration.setMaxSavedReplicatedJournalsSize(getInteger(policyNode, "max-saved-replicated-journals-size", configuration.getMaxSavedReplicatedJournalsSize(), MINUS_ONE_OR_GE_ZERO));
configuration.setScaleDownConfiguration(parseScaleDownConfig(policyNode));
configuration.setVoteOnReplicationFailure(getBoolean(policyNode, "vote-on-replication-failure", configuration.getVoteOnReplicationFailure()));
configuration.setVoteRetries(getInteger(policyNode, "vote-retries", configuration.getVoteRetries(), MINUS_ONE_OR_GE_ZERO));
configuration.setVoteRetryWait(getLong(policyNode, "vote-retry-wait", configuration.getVoteRetryWait(), GT_ZERO));
configuration.setRetryReplicationWait(getLong(policyNode, "retry-replication-wait", configuration.getVoteRetryWait(), GT_ZERO));
configuration.setQuorumSize(getInteger(policyNode, "quorum-size", configuration.getQuorumSize(), MINUS_ONE_OR_GT_ZERO));
return configuration;
}
private ReplicationPrimaryPolicyConfiguration createReplicationPrimaryHaPolicy(Element policyNode, Configuration config) {
private ReplicationPrimaryPolicyConfiguration createPluggableReplicationPrimaryHaPolicy(Element policyNode) {
ReplicationPrimaryPolicyConfiguration configuration = ReplicationPrimaryPolicyConfiguration.withDefault();
configuration.setGroupName(getString(policyNode, "group-name", configuration.getGroupName(), NO_CHECK));
configuration.setClusterName(getString(policyNode, "cluster-name", configuration.getClusterName(), NO_CHECK));
configuration.setInitialReplicationSyncTimeout(getLong(policyNode, "initial-replication-sync-timeout", configuration.getInitialReplicationSyncTimeout(), GT_ZERO));
configuration.setRetryReplicationWait(getLong(policyNode, "retry-replication-wait", configuration.getRetryReplicationWait(), GT_ZERO));
configuration.setDistributedManagerConfiguration(createDistributedPrimitiveManagerConfiguration(policyNode, config));
configuration.setDistributedManagerConfiguration(createDistributedPrimitiveManagerConfiguration(policyNode));
configuration.setCoordinationId(getString(policyNode, "coordination-id", configuration.getCoordinationId(), NOT_NULL_OR_EMPTY));
configuration.setMaxSavedReplicatedJournalsSize(getInteger(policyNode, "max-saved-replicated-journals-size", configuration.getMaxSavedReplicatedJournalsSize(), MINUS_ONE_OR_GE_ZERO));
return configuration;
}
private ReplicationBackupPolicyConfiguration createReplicationBackupHaPolicy(Element policyNode, Configuration config) {
private ReplicationBackupPolicyConfiguration createPluggableReplicationBackupHaPolicy(Element policyNode) {
ReplicationBackupPolicyConfiguration configuration = ReplicationBackupPolicyConfiguration.withDefault();
configuration.setGroupName(getString(policyNode, "group-name", configuration.getGroupName(), NO_CHECK));
configuration.setAllowFailBack(getBoolean(policyNode, "allow-failback", configuration.isAllowFailBack()));
configuration.setInitialReplicationSyncTimeout(getLong(policyNode, "initial-replication-sync-timeout", configuration.getInitialReplicationSyncTimeout(), GT_ZERO));
configuration.setClusterName(getString(policyNode, "cluster-name", configuration.getClusterName(), NO_CHECK));
configuration.setMaxSavedReplicatedJournalsSize(getInteger(policyNode, "max-saved-replicated-journals-size", configuration.getMaxSavedReplicatedJournalsSize(), MINUS_ONE_OR_GE_ZERO));
configuration.setRetryReplicationWait(getLong(policyNode, "retry-replication-wait", configuration.getRetryReplicationWait(), GT_ZERO));
configuration.setDistributedManagerConfiguration(createDistributedPrimitiveManagerConfiguration(policyNode, config));
configuration.setDistributedManagerConfiguration(createDistributedPrimitiveManagerConfiguration(policyNode));
return configuration;
}
private DistributedPrimitiveManagerConfiguration createDistributedPrimitiveManagerConfiguration(Element policyNode, Configuration config) {
private DistributedPrimitiveManagerConfiguration createDistributedPrimitiveManagerConfiguration(Element policyNode) {
final Element managerNode = (Element) policyNode.getElementsByTagName("manager").item(0);
final String className = getString(managerNode, "class-name",
ActiveMQDefaultConfiguration.getDefaultDistributedPrimitiveManagerClassName(),
@ -1861,8 +1859,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
return new DistributedPrimitiveManagerConfiguration(className, properties);
}
private SharedStoreMasterPolicyConfiguration createSharedStoreMasterHaPolicy(Element policyNode) {
SharedStoreMasterPolicyConfiguration configuration = new SharedStoreMasterPolicyConfiguration();
private SharedStorePrimaryPolicyConfiguration createSharedStorePrimaryHaPolicy(Element policyNode) {
SharedStorePrimaryPolicyConfiguration configuration = new SharedStorePrimaryPolicyConfiguration();
configuration.setFailoverOnServerShutdown(getBoolean(policyNode, "failover-on-shutdown", configuration.isFailoverOnServerShutdown()));
configuration.setWaitForActivation(getBoolean(policyNode, "wait-for-activation", configuration.isWaitForActivation()));
@ -1870,8 +1868,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
return configuration;
}
private SharedStoreSlavePolicyConfiguration createSharedStoreSlaveHaPolicy(Element policyNode) {
SharedStoreSlavePolicyConfiguration configuration = new SharedStoreSlavePolicyConfiguration();
private SharedStoreBackupPolicyConfiguration createSharedStoreBackupHaPolicy(Element policyNode) {
SharedStoreBackupPolicyConfiguration configuration = new SharedStoreBackupPolicyConfiguration();
configuration.setAllowFailBack(getBoolean(policyNode, "allow-failback", configuration.isAllowFailBack()));
@ -1920,15 +1918,28 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
}
}
NodeList masterNodeList = policyNode.getElementsByTagName("master");
if (masterNodeList.getLength() > 0) {
Element masterNode = (Element) masterNodeList.item(0);
configuration.setLiveConfig(replicated ? createReplicatedHaPolicy(masterNode) : createSharedStoreMasterHaPolicy(masterNode));
NodeList primaryNodeList = policyNode.getElementsByTagName("master");
if (primaryNodeList.getLength() > 0) {
ActiveMQServerLogger.LOGGER.deprecatedConfigurationOption("master", "primary");
Element primaryNode = (Element) primaryNodeList.item(0);
configuration.setPrimaryConfig(replicated ? createReplicationPrimaryHaPolicy(primaryNode) : createSharedStorePrimaryHaPolicy(primaryNode));
}
NodeList slaveNodeList = policyNode.getElementsByTagName("slave");
if (slaveNodeList.getLength() > 0) {
Element slaveNode = (Element) slaveNodeList.item(0);
configuration.setBackupConfig(replicated ? createReplicaHaPolicy(slaveNode) : createSharedStoreSlaveHaPolicy(slaveNode));
NodeList backupNodeList = policyNode.getElementsByTagName("slave");
if (backupNodeList.getLength() > 0) {
ActiveMQServerLogger.LOGGER.deprecatedConfigurationOption("slave", "backup");
Element backupNode = (Element) backupNodeList.item(0);
configuration.setBackupConfig(replicated ? createReplicationBackupHaPolicy(backupNode) : createSharedStoreBackupHaPolicy(backupNode));
}
primaryNodeList = policyNode.getElementsByTagName("primary");
if (primaryNodeList.getLength() > 0) {
Element primaryNode = (Element) primaryNodeList.item(0);
configuration.setPrimaryConfig(replicated ? createReplicationPrimaryHaPolicy(primaryNode) : createSharedStorePrimaryHaPolicy(primaryNode));
}
backupNodeList = policyNode.getElementsByTagName("backup");
if (backupNodeList.getLength() > 0) {
Element backupNode = (Element) backupNodeList.item(0);
configuration.setBackupConfig(replicated ? createReplicationBackupHaPolicy(backupNode) : createSharedStoreBackupHaPolicy(backupNode));
}
return configuration;

View File

@ -119,13 +119,13 @@ import org.apache.activemq.artemis.core.server.ServiceComponent;
import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
import org.apache.activemq.artemis.core.server.cluster.ClusterManager;
import org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.LiveOnlyPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.PrimaryOnlyPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreBackupPolicy;
import org.apache.activemq.artemis.core.server.group.GroupingHandler;
import org.apache.activemq.artemis.core.server.impl.Activation;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation;
import org.apache.activemq.artemis.core.server.impl.SharedNothingPrimaryActivation;
import org.apache.activemq.artemis.core.server.replay.ReplayManager;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
@ -407,8 +407,8 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
clearIO();
try {
HAPolicy haPolicy = server.getHAPolicy();
if (haPolicy instanceof SharedStoreSlavePolicy) {
((SharedStoreSlavePolicy) haPolicy).setFailoverOnServerShutdown(failoverOnServerShutdown);
if (haPolicy instanceof SharedStoreBackupPolicy) {
((SharedStoreBackupPolicy) haPolicy).setFailoverOnServerShutdown(failoverOnServerShutdown);
}
} finally {
blockOnIO();
@ -425,8 +425,8 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
clearIO();
try {
HAPolicy haPolicy = server.getHAPolicy();
if (haPolicy instanceof SharedStoreSlavePolicy) {
return ((SharedStoreSlavePolicy) haPolicy).isFailoverOnServerShutdown();
if (haPolicy instanceof SharedStoreBackupPolicy) {
return ((SharedStoreBackupPolicy) haPolicy).isFailoverOnServerShutdown();
} else {
return false;
}
@ -844,9 +844,9 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
}
try (AutoCloseable lock = server.managementLock()) {
Activation activation = server.getActivation();
if (activation instanceof SharedNothingLiveActivation) {
SharedNothingLiveActivation liveActivation = (SharedNothingLiveActivation) activation;
liveActivation.freezeReplication();
if (activation instanceof SharedNothingPrimaryActivation) {
SharedNothingPrimaryActivation primaryActivation = (SharedNothingPrimaryActivation) activation;
primaryActivation.freezeReplication();
return true;
}
return false;
@ -4143,17 +4143,17 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
clearIO();
HAPolicy haPolicy = server.getHAPolicy();
if (haPolicy instanceof LiveOnlyPolicy) {
LiveOnlyPolicy liveOnlyPolicy = (LiveOnlyPolicy) haPolicy;
if (haPolicy instanceof PrimaryOnlyPolicy) {
PrimaryOnlyPolicy primaryOnlyPolicy = (PrimaryOnlyPolicy) haPolicy;
if (liveOnlyPolicy.getScaleDownPolicy() == null) {
liveOnlyPolicy.setScaleDownPolicy(new ScaleDownPolicy());
if (primaryOnlyPolicy.getScaleDownPolicy() == null) {
primaryOnlyPolicy.setScaleDownPolicy(new ScaleDownPolicy());
}
liveOnlyPolicy.getScaleDownPolicy().setEnabled(true);
primaryOnlyPolicy.getScaleDownPolicy().setEnabled(true);
if (connector != null) {
liveOnlyPolicy.getScaleDownPolicy().getConnectors().add(0, connector);
primaryOnlyPolicy.getScaleDownPolicy().getConnectors().add(0, connector);
}
server.fail(true);
@ -4180,10 +4180,12 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
Collection<TopologyMemberImpl> members = topology.getMembers();
for (TopologyMemberImpl member : members) {
TransportConfiguration live = member.getLive();
if (live != null) {
TransportConfiguration primary = member.getPrimary();
if (primary != null) {
JsonObjectBuilder obj = JsonLoader.createObjectBuilder();
obj.add("nodeID", member.getNodeId()).add("live", live.getParams().get("host") + ":" + live.getParams().get("port"));
// keep "live" here for backwards compatibility
obj.add("nodeID", member.getNodeId()).add("live", primary.getParams().get("host") + ":" + primary.getParams().get("port"));
obj.add("nodeID", member.getNodeId()).add("primary", primary.getParams().get("host") + ":" + primary.getParams().get("port"));
TransportConfiguration backup = member.getBackup();
if (backup != null) {
obj.add("backup", backup.getParams().get("host") + ":" + backup.getParams().get("port"));

View File

@ -70,7 +70,7 @@ public final class PagingManagerImpl implements PagingManager {
private volatile boolean started = false;
/**
* Lock used at the start of synchronization between a live server and its backup.
* Lock used at the start of synchronization between a primary server and its backup.
* Synchronization will lock all {@link PagingStore} instances, and so any operation here that
* requires a lock on a {@link PagingStore} instance needs to take a read-lock on
* {@link #syncLock} to avoid dead-locks.

View File

@ -452,7 +452,7 @@ public interface StorageManager extends IDGenerator, ActiveMQComponent {
boolean addToPage(PagingStore store, Message msg, Transaction tx, RouteContextList listCtx) throws Exception;
/**
* Stops the replication of data from the live to the backup.
* Stops the replication of data from the primary to the backup.
* <p>
* Typical scenario is a broken connection.
*/

View File

@ -56,7 +56,7 @@ import org.apache.activemq.artemis.core.paging.PagingStore;
import org.apache.activemq.artemis.core.persistence.OperationContext;
import org.apache.activemq.artemis.core.persistence.impl.journal.codec.LargeMessagePersister;
import org.apache.activemq.artemis.core.persistence.impl.journal.codec.RefEncoding;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrimaryIsStoppingMessage;
import org.apache.activemq.artemis.core.replication.ReplicatedJournal;
import org.apache.activemq.artemis.core.replication.ReplicationManager;
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
@ -290,12 +290,12 @@ public class JournalStorageManager extends AbstractJournalStorageManager {
try {
// We cache the variable as the replicator could be changed between here and the time we call stop
// since sendLiveIsStopping may issue a close back from the channel
// since sendPrimaryIsStopping may issue a close back from the channel
// and we want to ensure a stop here just in case
ReplicationManager replicatorInUse = replicator;
if (replicatorInUse != null) {
if (sendFailover) {
final OperationContext token = replicator.sendLiveIsStopping(ReplicationLiveIsStoppingMessage.LiveStopping.FAIL_OVER);
final OperationContext token = replicator.sendPrimaryIsStopping(ReplicationPrimaryIsStoppingMessage.PrimaryStopping.FAIL_OVER);
if (token != null) {
try {
token.waitCompletion(5000);
@ -626,11 +626,11 @@ public class JournalStorageManager extends AbstractJournalStorageManager {
replicator = replicationManager;
if (!((JournalImpl) originalMessageJournal).flushAppendExecutor(10, TimeUnit.SECONDS)) {
throw new Exception("Live message journal is busy");
throw new Exception("Primary message journal is busy");
}
if (!((JournalImpl) originalBindingsJournal).flushAppendExecutor(10, TimeUnit.SECONDS)) {
throw new Exception("Live bindings journal is busy");
throw new Exception("Primary bindings journal is busy");
}
// Establishes lock

View File

@ -155,7 +155,7 @@ public class ProtocolHandler {
if (upgrade != null && upgrade.equalsIgnoreCase("websocket")) {
int stompMaxFramePayloadLength = ConfigurationHelper.getIntProperty(TransportConstants.STOMP_MAX_FRAME_PAYLOAD_LENGTH, -1, nettyAcceptor.getConfiguration());
if (stompMaxFramePayloadLength != -1) {
ActiveMQServerLogger.LOGGER.deprecatedConfigurationOption(TransportConstants.STOMP_MAX_FRAME_PAYLOAD_LENGTH);
ActiveMQServerLogger.LOGGER.deprecatedConfigurationOption(TransportConstants.STOMP_MAX_FRAME_PAYLOAD_LENGTH, TransportConstants.WEB_SOCKET_MAX_FRAME_PAYLOAD_LENGTH);
}
stompMaxFramePayloadLength = stompMaxFramePayloadLength != -1 ? stompMaxFramePayloadLength : TransportConstants.DEFAULT_WEB_SOCKET_MAX_FRAME_PAYLOAD_LENGTH;
int webSocketMaxFramePayloadLength = ConfigurationHelper.getIntProperty(TransportConstants.WEB_SOCKET_MAX_FRAME_PAYLOAD_LENGTH, -1, nettyAcceptor.getConfiguration());

View File

@ -44,7 +44,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.Replicatio
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeginMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageEndMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrimaryIsStoppingMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
@ -237,7 +237,7 @@ public class ServerPacketDecoder extends ClientPacketDecoder {
break;
}
case PacketImpl.REPLICATION_SCHEDULED_FAILOVER: {
packet = new ReplicationLiveIsStoppingMessage();
packet = new ReplicationPrimaryIsStoppingMessage();
break;
}
case CLUSTER_CONNECT: {

View File

@ -1043,10 +1043,10 @@ public class ServerSessionPacketHandler implements ChannelHandler {
// before we have transferred the connection, leaving it in a started state
session.setTransferring(true);
// Note. We do not destroy the replicating connection here. In the case the live server has really crashed
// Note. We do not destroy the replicating connection here. In the case the primary server has really crashed
// then the connection will get cleaned up anyway when the server ping timeout kicks in.
// In the case the live server is really still up, i.e. a split brain situation (or in tests), then closing
// the replicating connection will cause the outstanding responses to be be replayed on the live server,
// In the case the primary server is really still up, i.e. a split brain situation (or in tests), then closing
// the replicating connection will cause the outstanding responses to be replayed on the primary server,
// if these reach the client who then subsequently fails over, on reconnection to backup, it will have
// received responses that the backup did not know about.

View File

@ -21,7 +21,7 @@ import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
/**
* Registers a given backup-server as the replicating backup of a live server (i.e. a regular
* Registers a given backup-server as the replicating backup of a primary server (i.e. a regular
* ActiveMQ).
* <p>
* If it succeeds the backup will start synchronization of its state with the new backup node, and

View File

@ -36,9 +36,9 @@ public class ReplicationLargeMessageEndMessage extends PacketImpl {
public ReplicationLargeMessageEndMessage(final long messageId, final long pendingRecordId, final boolean isDelete) {
this();
this.messageId = messageId;
//we use negative value to indicate that this id is pre-generated by live node
//so that it won't be generated at backup.
//see https://issues.apache.org/jira/browse/ARTEMIS-1221
/* We use a negative value to indicate that this id is pre-generated by primary node so that it won't be generated
* at the backup. See https://issues.apache.org/jira/browse/ARTEMIS-1221.
*/
this.pendingRecordId = -pendingRecordId;
this.isDelete = isDelete;
}

View File

@ -21,16 +21,16 @@ import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
import org.apache.activemq.artemis.utils.DataConstants;
/**
* Message indicating that the live is stopping (a scheduled stop).
* Message indicating that the primary is stopping (a scheduled stop).
* <p>
* The backup starts the fail-over immediately after receiving this.
*/
public final class ReplicationLiveIsStoppingMessage extends PacketImpl {
public final class ReplicationPrimaryIsStoppingMessage extends PacketImpl {
public enum LiveStopping {
public enum PrimaryStopping {
/**
* Notifies the backup that its live is going to stop. The backup will then NOT fail-over if
* it gets signals from the cluster that its live sent a disconnect.
* Notifies the backup that its primary is going to stop. The backup will then NOT fail-over if
* it gets signals from the cluster that its primary sent a disconnect.
*/
STOP_CALLED(0),
/**
@ -40,24 +40,24 @@ public final class ReplicationLiveIsStoppingMessage extends PacketImpl {
FAIL_OVER(1);
private final int code;
LiveStopping(int code) {
PrimaryStopping(int code) {
this.code = code;
}
}
private int finalMessage;
private LiveStopping liveStopping;
private PrimaryStopping primaryStopping;
public ReplicationLiveIsStoppingMessage() {
public ReplicationPrimaryIsStoppingMessage() {
super(PacketImpl.REPLICATION_SCHEDULED_FAILOVER);
}
/**
* @param b
*/
public ReplicationLiveIsStoppingMessage(LiveStopping b) {
public ReplicationPrimaryIsStoppingMessage(PrimaryStopping b) {
this();
this.liveStopping = b;
this.primaryStopping = b;
}
@Override
@ -68,12 +68,12 @@ public final class ReplicationLiveIsStoppingMessage extends PacketImpl {
@Override
public void encodeRest(final ActiveMQBuffer buffer) {
buffer.writeInt(liveStopping.code);
buffer.writeInt(primaryStopping.code);
}
@Override
public void decodeRest(final ActiveMQBuffer buffer) {
liveStopping = buffer.readInt() == 0 ? LiveStopping.STOP_CALLED : LiveStopping.FAIL_OVER;
primaryStopping = buffer.readInt() == 0 ? PrimaryStopping.STOP_CALLED : PrimaryStopping.FAIL_OVER;
}
/**
@ -82,12 +82,12 @@ public final class ReplicationLiveIsStoppingMessage extends PacketImpl {
*
* @return
*/
public LiveStopping isFinalMessage() {
return liveStopping;
public PrimaryStopping isFinalMessage() {
return primaryStopping;
}
@Override
protected String getPacketString() {
return super.getPacketString() + ", liveStopping=" + liveStopping;
return super.getPacketString() + ", primaryStopping=" + primaryStopping;
}
}

View File

@ -29,7 +29,7 @@ import java.util.List;
/**
* This message may signal start or end of the replication synchronization.
* <p>
* At start, it sends all fileIDs used in a given journal live server to the backup, so the backup
* At start, it sends all fileIDs used in a given journal primary server to the backup, so the backup
* can reserve those IDs.
*/
public class ReplicationStartSyncMessage extends PacketImpl {
@ -184,7 +184,7 @@ public class ReplicationStartSyncMessage extends PacketImpl {
}
/**
* @return {@code true} if the live has finished synchronizing its data and the backup is
* @return {@code true} if the primary has finished synchronizing its data and the backup is
* therefore up-to-date, {@code false} otherwise.
*/
public boolean isSynchronizationFinished() {

View File

@ -403,7 +403,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif
}
logger.debug("Sending disconnect on live connections");
logger.debug("Sending disconnect on client connections");
HashSet<ConnectionEntry> connectionEntries = new HashSet<>(connections.values());

View File

@ -67,7 +67,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.Replicatio
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeginMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageEndMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrimaryIsStoppingMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
@ -98,9 +98,9 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
void onRemoteBackupUpToDate(String nodeId, long activationSequence);
void onLiveStopping(ReplicationLiveIsStoppingMessage.LiveStopping message) throws ActiveMQException;
void onPrimaryStopping(ReplicationPrimaryIsStoppingMessage.PrimaryStopping message) throws ActiveMQException;
void onLiveNodeId(String nodeId);
void onPrimaryNodeId(String nodeId);
}
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@ -231,7 +231,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
} else if (type == PacketImpl.REPLICATION_SYNC_FILE) {
handleReplicationSynchronization((ReplicationSyncFileMessage) packet);
} else if (type == PacketImpl.REPLICATION_SCHEDULED_FAILOVER) {
handleLiveStopping((ReplicationLiveIsStoppingMessage) packet);
handlePrimaryStopping((ReplicationPrimaryIsStoppingMessage) packet);
} else if (type == PacketImpl.BACKUP_REGISTRATION_FAILED) {
handleFatalError((BackupReplicationStartFailedMessage) packet);
} else {
@ -285,8 +285,8 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
* @param packet
* @throws ActiveMQException
*/
private void handleLiveStopping(ReplicationLiveIsStoppingMessage packet) throws ActiveMQException {
eventListener.onLiveStopping(packet.isFinalMessage());
private void handlePrimaryStopping(ReplicationPrimaryIsStoppingMessage packet) throws ActiveMQException {
eventListener.onPrimaryStopping(packet.isFinalMessage());
}
@Override
@ -336,7 +336,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
OrderedExecutorFactory.flushExecutor(executor);
// Channel may be null if there isn't a connection to a live server
// Channel may be null if there isn't a connection to a primary server
if (channel != null) {
channel.close();
}
@ -416,9 +416,9 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
}
}
private synchronized void finishSynchronization(String liveID, long activationSequence) throws Exception {
private synchronized void finishSynchronization(String primaryID, long activationSequence) throws Exception {
if (logger.isTraceEnabled()) {
logger.trace("BACKUP-SYNC-START: finishSynchronization::{} activationSequence = {}", liveID, activationSequence);
logger.trace("BACKUP-SYNC-START: finishSynchronization::{} activationSequence = {}", primaryID, activationSequence);
}
for (JournalContent jc : EnumSet.allOf(JournalContent.class)) {
Journal journal = journalsHolder.remove(jc);
@ -463,19 +463,19 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
}
}
logger.trace("setRemoteBackupUpToDate and liveIDSet for {}", liveID);
logger.trace("setRemoteBackupUpToDate and primaryIDSet for {}", primaryID);
journalsHolder = null;
eventListener.onRemoteBackupUpToDate(liveID, activationSequence);
eventListener.onRemoteBackupUpToDate(primaryID, activationSequence);
logger.trace("Backup is synchronized / BACKUP-SYNC-DONE");
ActiveMQServerLogger.LOGGER.backupServerSynchronized(server, liveID);
ActiveMQServerLogger.LOGGER.backupServerSynchronized(server, primaryID);
return;
}
/**
* Receives 'raw' journal/page/large-message data from live server for synchronization of logs.
* Receives 'raw' journal/page/large-message data from primary server for synchronization of logs.
*
* @param msg
* @throws Exception
@ -579,18 +579,21 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
FileWrapperJournal syncJournal = new FileWrapperJournal(journal);
registerJournal(journalContent.typeByte, syncJournal);
// We send a response now, to avoid a situation where we handle votes during the deactivation of the live during a failback.
/* We send a response now to avoid a situation where we handle votes during the deactivation of the primary
* during a failback.
*/
if (supportResponseBatching) {
endOfBatch();
}
channel.send(replicationResponseMessage);
replicationResponseMessage = null;
// This needs to be done after the response is sent, to avoid voting shutting it down for any reason.
// This needs to be done after the response is sent to avoid voting shutting it down for any reason.
if (packet.getNodeID() != null) {
// At the start of replication, we still do not know which is the nodeID that the live uses.
// This is the point where the backup gets this information.
eventListener.onLiveNodeId(packet.getNodeID());
/* At the start of replication we still do not know which is the nodeID that the primary uses.
* This is the point where the backup gets this information.
*/
eventListener.onPrimaryNodeId(packet.getNodeID());
}
break;

View File

@ -66,8 +66,8 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.Replicatio
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeginMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageEndMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage.LiveStopping;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrimaryIsStoppingMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrimaryIsStoppingMessage.PrimaryStopping;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
@ -91,8 +91,7 @@ import org.slf4j.LoggerFactory;
import java.lang.invoke.MethodHandles;
/**
* Manages replication tasks on the live server (that is the live server side of a "remote backup"
* use case).
* Manages replication tasks on the primary server (i.e. the active server side of a "remote backup" use case).
* <p>
* Its equivalent in the backup server is {@link ReplicationEndpoint}.
*
@ -420,8 +419,7 @@ public final class ReplicationManager implements ActiveMQComponent {
/**
* Completes any pending operations.
* <p>
* This can be necessary in case the live loses connection to the backup (network failure, or
* backup crashing).
* This can be necessary in case the primary loses the connection to the backup (network failure, or backup crashing).
*/
public void clearReplicationTokens() {
logger.trace("clearReplicationTokens initiating");
@ -872,18 +870,18 @@ public final class ReplicationManager implements ActiveMQComponent {
}
/**
* Notifies the backup that the live server is stopping.
* Notifies the backup that the primary server is stopping.
* <p>
* This notification allows the backup to skip quorum voting (or any other measure to avoid
* 'split-brain') and do a faster fail-over.
*
* @return
*/
public OperationContext sendLiveIsStopping(final LiveStopping finalMessage) {
logger.debug("LIVE IS STOPPING?!? message={} enabled={}", finalMessage, enabled);
public OperationContext sendPrimaryIsStopping(final PrimaryStopping finalMessage) {
logger.debug("PRIMARY IS STOPPING?!? message={} enabled={}", finalMessage, enabled);
if (enabled) {
logger.debug("LIVE IS STOPPING?!? message={} {}", finalMessage, enabled);
return sendReplicatePacket(new ReplicationLiveIsStoppingMessage(finalMessage));
logger.debug("PRIMARY IS STOPPING?!? message={} {}", finalMessage, enabled);
return sendReplicatePacket(new ReplicationPrimaryIsStoppingMessage(finalMessage));
}
return null;
}

View File

@ -90,7 +90,7 @@ public interface ActiveMQMessageBundle {
@Message(id = 229007, value = "unhandled error during replication")
ActiveMQInternalErrorException replicationUnhandledError(Exception e);
@Message(id = 229008, value = "Live Node contains more journals than the backup node. Probably a version match error")
@Message(id = 229008, value = "Primary node contains more journals than the backup node. Probably a version match error")
ActiveMQInternalErrorException replicationTooManyJournals();
@Message(id = 229009, value = "Unhandled file type {}")
@ -367,8 +367,8 @@ public interface ActiveMQMessageBundle {
@Message(id = 229114, value = "Replication synchronization process timed out after waiting {} milliseconds")
ActiveMQReplicationTimeooutException replicationSynchronizationTimeout(long timeout);
@Message(id = 229115, value = "Colocated Policy hasn't different type live and backup")
ActiveMQIllegalStateException liveBackupMismatch();
@Message(id = 229115, value = "Colocated Policy hasn't different type primary and backup")
ActiveMQIllegalStateException primaryBackupMismatch();
@Message(id = 229116, value = "Netty Acceptor unavailable")
IllegalStateException acceptorUnavailable();

View File

@ -437,7 +437,7 @@ public interface ActiveMQServer extends ServiceComponent {
/**
* Returns whether the initial replication synchronization process with the backup server is complete; applicable for
* either the live or backup server.
* either the primary or backup server.
*/
boolean isReplicaSync();

View File

@ -86,23 +86,23 @@ public interface ActiveMQServerLogger {
@LogMessage(id = 221005, value = "Deleting pending large message as it was not completed: {}", level = LogMessage.Level.INFO)
void deletingPendingMessage(Pair<Long, Long> msgToDelete);
@LogMessage(id = 221006, value = "Waiting to obtain live lock", level = LogMessage.Level.INFO)
void awaitingLiveLock();
@LogMessage(id = 221006, value = "Waiting to obtain primary lock", level = LogMessage.Level.INFO)
void awaitingPrimaryLock();
@LogMessage(id = 221007, value = "Server is now live", level = LogMessage.Level.INFO)
void serverIsLive();
@LogMessage(id = 221007, value = "Server is now active", level = LogMessage.Level.INFO)
void serverIsActive();
@LogMessage(id = 221008, value = "live server wants to restart, restarting server in backup", level = LogMessage.Level.INFO)
@LogMessage(id = 221008, value = "primary server wants to restart, restarting server in backup", level = LogMessage.Level.INFO)
void awaitFailBack();
@LogMessage(id = 221109, value = "Apache ActiveMQ Artemis Backup Server version {} [{}] started, waiting live to fail before it gets active", level = LogMessage.Level.INFO)
@LogMessage(id = 221109, value = "Apache ActiveMQ Artemis Backup Server version {} [{}] started; waiting for primary to fail before activating", level = LogMessage.Level.INFO)
void backupServerStarted(String version, SimpleString nodeID);
@LogMessage(id = 221010, value = "Backup Server is now live", level = LogMessage.Level.INFO)
void backupServerIsLive();
@LogMessage(id = 221010, value = "Backup Server is now active", level = LogMessage.Level.INFO)
void backupServerIsActive();
@LogMessage(id = 221011, value = "Server {} is now live", level = LogMessage.Level.INFO)
void serverIsLive(String identity);
@LogMessage(id = 221011, value = "Server {} is now active", level = LogMessage.Level.INFO)
void serverIsActive(String identity);
@LogMessage(id = 221012, value = "Using AIO Journal", level = LogMessage.Level.INFO)
void journalUseAIO();
@ -140,8 +140,8 @@ public interface ActiveMQServerLogger {
@LogMessage(id = 221023, value = "unable to stop connector service: {}", level = LogMessage.Level.INFO)
void errorStoppingConnectorService(String name, Throwable e);
@LogMessage(id = 221024, value = "Backup server {} is synchronized with live server, nodeID={}.", level = LogMessage.Level.INFO)
void backupServerSynchronized(ActiveMQServerImpl server, String liveID);
@LogMessage(id = 221024, value = "Backup server {} is synchronized with primary server, nodeID={}.", level = LogMessage.Level.INFO)
void backupServerSynchronized(ActiveMQServerImpl server, String nodeID);
@LogMessage(id = 221025, value = "Replication: sending {} (size={}) to replica.", level = LogMessage.Level.INFO)
void replicaSyncFile(SequentialFile jf, Long size);
@ -170,11 +170,11 @@ public interface ActiveMQServerLogger {
@LogMessage(id = 221033, value = "** got backup lock", level = LogMessage.Level.INFO)
void gotBackupLock();
@LogMessage(id = 221034, value = "Waiting {} to obtain live lock", level = LogMessage.Level.INFO)
void waitingToObtainLiveLock(String timeoutMessage);
@LogMessage(id = 221034, value = "Waiting {} to obtain primary lock", level = LogMessage.Level.INFO)
void waitingToObtainPrimaryLock(String timeoutMessage);
@LogMessage(id = 221035, value = "Live Server Obtained live lock", level = LogMessage.Level.INFO)
void obtainedLiveLock();
@LogMessage(id = 221035, value = "Primary Server Obtained primary lock", level = LogMessage.Level.INFO)
void obtainedPrimaryLock();
@LogMessage(id = 221036, value = "Message with duplicate ID {} was already set at {}. Move from {} being ignored and message removed from {}", level = LogMessage.Level.INFO)
void messageWithDuplicateID(Object duplicateProperty,
@ -182,13 +182,13 @@ public interface ActiveMQServerLogger {
SimpleString address,
SimpleString simpleString);
@LogMessage(id = 221037, value = "{} to become 'live'", level = LogMessage.Level.INFO)
void becomingLive(ActiveMQServer server);
@LogMessage(id = 221037, value = "{} to become 'active'", level = LogMessage.Level.INFO)
void becomingActive(ActiveMQServer server);
@LogMessage(id = 221038, value = "Configuration option '{}' is deprecated. Consult the manual for details.", level = LogMessage.Level.INFO)
void deprecatedConfigurationOption(String deprecatedOption);
@LogMessage(id = 221038, value = "Configuration option '{}' is deprecated and will be removed in a future version. Use '{}' instead. Consult the manual for details.", level = LogMessage.Level.INFO)
void deprecatedConfigurationOption(String deprecatedOption, String alternative);
@LogMessage(id = 221039, value = "Restarting as Replicating backup server after live restart", level = LogMessage.Level.INFO)
@LogMessage(id = 221039, value = "Restarting as replicating backup server after primary restart", level = LogMessage.Level.INFO)
void restartingReplicatedBackupAfterFailback();
@LogMessage(id = 221040, value = "Remote group coordinators has not started.", level = LogMessage.Level.INFO)
@ -209,7 +209,7 @@ public interface ActiveMQServerLogger {
@LogMessage(id = 221046, value = "Unblocking message production on address '{}'; {}", level = LogMessage.Level.INFO)
void unblockingMessageProduction(SimpleString addressName, String sizeInfo);
@LogMessage(id = 221047, value = "Backup Server has scaled down to live server", level = LogMessage.Level.INFO)
@LogMessage(id = 221047, value = "Backup Server has scaled down to primary server", level = LogMessage.Level.INFO)
void backupServerScaledDown();
@LogMessage(id = 221048, value = "Consumer {}:{} attached to queue '{}' from {} identified as 'slow.' Expected consumption rate: {} msgs/second; actual consumption rate: {} msgs/second.", level = LogMessage.Level.INFO)
@ -223,8 +223,8 @@ public interface ActiveMQServerLogger {
@LogMessage(id = 221049, value = "Activating Replica for node: {}", level = LogMessage.Level.INFO)
void activatingReplica(SimpleString nodeID);
@LogMessage(id = 221050, value = "Activating Shared Store Slave", level = LogMessage.Level.INFO)
void activatingSharedStoreSlave();
@LogMessage(id = 221050, value = "Activating Shared Store Backup", level = LogMessage.Level.INFO)
void activatingSharedStoreBackup();
@LogMessage(id = 221051, value = "Populating security roles from LDAP at: {}", level = LogMessage.Level.INFO)
void populatingSecurityRolesFromLDAP(String url);
@ -871,8 +871,8 @@ public interface ActiveMQServerLogger {
@LogMessage(id = 222188, value = "Unable to find target queue for node {}", level = LogMessage.Level.WARN)
void unableToFindTargetQueue(String targetNodeID);
@LogMessage(id = 222189, value = "Failed to activate shared store slave", level = LogMessage.Level.WARN)
void activateSharedStoreSlaveFailed(Throwable e);
@LogMessage(id = 222189, value = "Failed to activate shared store backup", level = LogMessage.Level.WARN)
void activateSharedStoreBackupFailed(Throwable e);
@LogMessage(id = 222191, value = "Could not find any configured role for user {}.", level = LogMessage.Level.WARN)
void cannotFindRoleForUser(String user);
@ -1374,7 +1374,7 @@ public interface ActiveMQServerLogger {
@LogMessage(id = 224055, value = "Bridge Failed to ack", level = LogMessage.Level.ERROR)
void bridgeFailedToAck(Throwable t);
@LogMessage(id = 224056, value = "Live server will not fail-back automatically", level = LogMessage.Level.ERROR)
@LogMessage(id = 224056, value = "Primary server will not fail-back automatically", level = LogMessage.Level.ERROR)
void autoFailBackDenied();
@LogMessage(id = 224057, value = "Backup server that requested fail-back was not announced. Server will not stop for fail-back.", level = LogMessage.Level.ERROR)
@ -1496,8 +1496,8 @@ public interface ActiveMQServerLogger {
@LogMessage(id = 224097, value = "Failed to start server", level = LogMessage.Level.ERROR)
void failedToStartServer(Throwable t);
@LogMessage(id = 224098, value = "Received a vote saying the backup is live with connector: {}", level = LogMessage.Level.INFO)
void quorumBackupIsLive(String liveConnector);
@LogMessage(id = 224098, value = "Received a vote saying the backup is active with connector: {}", level = LogMessage.Level.INFO)
void quorumBackupIsActive(String connector);
@LogMessage(id = 224099, value = "Message with ID {} has a header too large. More information available on debug level for class {}", level = LogMessage.Level.WARN)
void messageWithHeaderTooLarge(Long messageID, String loggerClass);

View File

@ -23,12 +23,12 @@ import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal;
/**
* A class that will locate a particular live server running in a cluster. How this live is chosen
* is a job for the implementation.
* A class that will locate a particular server running in a cluster. How this server is chosen is a job for the
* implementation.
*
* This is used for replication (which needs a QuorumManager) and scaling-down (which does not need a QuorumManager).
*/
public abstract class LiveNodeLocator implements ClusterTopologyListener {
public abstract class NodeLocator implements ClusterTopologyListener {
@FunctionalInterface
public interface BackupRegistrationListener {
@ -38,31 +38,31 @@ public abstract class LiveNodeLocator implements ClusterTopologyListener {
private final BackupRegistrationListener backupRegistrationListener;
public LiveNodeLocator(BackupRegistrationListener backupRegistrationListener) {
public NodeLocator(BackupRegistrationListener backupRegistrationListener) {
this.backupRegistrationListener = backupRegistrationListener;
}
/**
* Use this constructor when the LiveNodeLocator is used for scaling down rather than replicating
* Use this constructor when the NodeLocator is used for scaling down rather than replicating
*/
public LiveNodeLocator() {
public NodeLocator() {
this(null);
}
/**
* Locates a possible live server in a cluster with a timeout
* Locates a server in a cluster with a timeout
*/
public abstract void locateNode(long timeout) throws ActiveMQException;
/**
* Locates a possible live server in a cluster
* Locates a server in a cluster
*/
public abstract void locateNode() throws ActiveMQException;
/**
* Returns the current connector
*/
public abstract Pair<TransportConfiguration, TransportConfiguration> getLiveConfiguration();
public abstract Pair<TransportConfiguration, TransportConfiguration> getPrimaryConfiguration();
/**
* Returns the node id for the current connector
@ -70,7 +70,7 @@ public abstract class LiveNodeLocator implements ClusterTopologyListener {
public abstract String getNodeID();
/**
* tells the locator the the current connector has failed.
* tells the locator the current connector has failed.
*/
public void notifyRegistrationFailed(boolean alreadyReplicating) {
if (backupRegistrationListener != null) {

View File

@ -51,17 +51,17 @@ public abstract class NodeManager implements ActiveMQComponent {
// --------------------------------------------------------------------
public abstract void awaitLiveNode() throws NodeManagerException, InterruptedException;
public abstract void awaitPrimaryNode() throws NodeManagerException, InterruptedException;
public abstract void awaitLiveStatus() throws NodeManagerException, InterruptedException;
public abstract void awaitActiveStatus() throws NodeManagerException, InterruptedException;
public abstract void startBackup() throws NodeManagerException, InterruptedException;
public abstract ActivateCallback startLiveNode() throws NodeManagerException, InterruptedException;
public abstract ActivateCallback startPrimaryNode() throws NodeManagerException, InterruptedException;
public abstract void pauseLiveServer() throws NodeManagerException;
public abstract void pausePrimaryServer() throws NodeManagerException;
public abstract void crashLiveServer() throws NodeManagerException;
public abstract void crashPrimaryServer() throws NodeManagerException;
public abstract void releaseBackup() throws NodeManagerException;
@ -142,7 +142,7 @@ public abstract class NodeManager implements ActiveMQComponent {
public abstract boolean isAwaitingFailback() throws NodeManagerException;
public abstract boolean isBackupLive() throws NodeManagerException;
public abstract boolean isBackupActive() throws NodeManagerException;
public abstract void interrupt();

View File

@ -161,7 +161,7 @@ public class BackupManager implements ActiveMQComponent {
}
/*
* called to notify us that we have been activated as a live server so the connectors are no longer needed.
* called to notify us that we have been activated so the connectors are no longer needed.
* */
public void activated() {
for (BackupConnector backupConnector : backupConnectors) {

View File

@ -92,8 +92,8 @@ public class ClusterControl implements AutoCloseable {
* server.
* @throws ActiveMQException
*/
public void announceReplicatingBackupToLive(final boolean attemptingFailBack,
String replicationClusterName) throws ActiveMQException {
public void announceReplicatingBackupToPrimary(final boolean attemptingFailBack,
String replicationClusterName) throws ActiveMQException {
ClusterConnectionConfiguration config = ConfigurationUtils.getReplicationClusterConfiguration(server.getConfiguration(), replicationClusterName);
if (config == null) {

View File

@ -111,7 +111,7 @@ public class ColocatedHAManager implements HAManager {
}
/**
* send a request to a live server to start a backup for us
* send a request to a primary server to start a backup for us
*
* @param connectorPair the connector for the node to request a backup from
* @param backupSize the current size of the requested nodes backups
@ -156,10 +156,10 @@ public class ColocatedHAManager implements HAManager {
backup.start();
} catch (Exception e) {
backup.stop();
ActiveMQServerLogger.LOGGER.activateSharedStoreSlaveFailed(e);
ActiveMQServerLogger.LOGGER.activateSharedStoreBackupFailed(e);
return false;
}
ActiveMQServerLogger.LOGGER.activatingSharedStoreSlave();
ActiveMQServerLogger.LOGGER.activatingSharedStoreBackup();
return true;
}

View File

@ -24,9 +24,9 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.io.IOCriticalErrorListener;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.ColocatedActivation;
import org.apache.activemq.artemis.core.server.impl.LiveActivation;
import org.apache.activemq.artemis.core.server.impl.PrimaryActivation;
public class ColocatedPolicy implements HAPolicy<LiveActivation> {
public class ColocatedPolicy implements HAPolicy<PrimaryActivation> {
/*live stuff*/
private boolean requestBackup = ActiveMQDefaultConfiguration.isDefaultHapolicyRequestBackup();
@ -44,7 +44,7 @@ public class ColocatedPolicy implements HAPolicy<LiveActivation> {
private BackupPolicy backupPolicy;
private HAPolicy<LiveActivation> livePolicy;
private HAPolicy<PrimaryActivation> primaryPolicy;
public ColocatedPolicy(boolean requestBackup,
int backupRequestRetries,
@ -52,7 +52,7 @@ public class ColocatedPolicy implements HAPolicy<LiveActivation> {
int maxBackups,
int backupPortOffset,
List<String> excludedConnectors,
HAPolicy livePolicy,
HAPolicy primaryPolicy,
BackupPolicy backupPolicy) {
this.requestBackup = requestBackup;
this.backupRequestRetries = backupRequestRetries;
@ -60,17 +60,17 @@ public class ColocatedPolicy implements HAPolicy<LiveActivation> {
this.maxBackups = maxBackups;
this.backupPortOffset = backupPortOffset;
this.excludedConnectors = excludedConnectors;
this.livePolicy = livePolicy;
this.primaryPolicy = primaryPolicy;
this.backupPolicy = backupPolicy;
}
@Override
public String getBackupGroupName() {
final HAPolicy<LiveActivation> livePolicy = this.livePolicy;
if (livePolicy == null) {
final HAPolicy<PrimaryActivation> primaryPolicy = this.primaryPolicy;
if (primaryPolicy == null) {
return null;
}
return livePolicy.getBackupGroupName();
return primaryPolicy.getBackupGroupName();
}
@Override
@ -89,11 +89,11 @@ public class ColocatedPolicy implements HAPolicy<LiveActivation> {
}
@Override
public LiveActivation createActivation(ActiveMQServerImpl server,
boolean wasLive,
Map<String, Object> activationParams,
IOCriticalErrorListener ioCriticalErrorListener) throws Exception {
return new ColocatedActivation(server, this, livePolicy.createActivation(server, wasLive, activationParams, ioCriticalErrorListener));
public PrimaryActivation createActivation(ActiveMQServerImpl server,
boolean wasPrimary,
Map<String, Object> activationParams,
IOCriticalErrorListener ioCriticalErrorListener) throws Exception {
return new ColocatedActivation(server, this, primaryPolicy.createActivation(server, wasPrimary, activationParams, ioCriticalErrorListener));
}
@Override
@ -154,12 +154,12 @@ public class ColocatedPolicy implements HAPolicy<LiveActivation> {
this.excludedConnectors = excludedConnectors;
}
public HAPolicy<LiveActivation> getLivePolicy() {
return livePolicy;
public HAPolicy<PrimaryActivation> getPrimaryPolicy() {
return primaryPolicy;
}
public void setLivePolicy(HAPolicy<LiveActivation> livePolicy) {
this.livePolicy = livePolicy;
public void setPrimaryPolicy(HAPolicy<PrimaryActivation> primaryPolicy) {
this.primaryPolicy = primaryPolicy;
}
public BackupPolicy getBackupPolicy() {

View File

@ -24,7 +24,7 @@ import org.apache.activemq.artemis.core.server.impl.Activation;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
/**
* Every live server will have an HAPolicy that configures the type of server that it should be either live, backup or
* Every active server will have an HAPolicy that configures the type of server that it should be either primary, backup or
* colocated (both). It also configures how, if colocated, it should react to sending and receiving requests for backups.
*/
public interface HAPolicy<T extends Activation> {
@ -33,7 +33,7 @@ public interface HAPolicy<T extends Activation> {
* created the Activation associated with this policy.
* */
T createActivation(ActiveMQServerImpl server,
boolean wasLive,
boolean wasPrimary,
Map<String, Object> activationParams,
IOCriticalErrorListener shutdownOnCriticalIO) throws Exception;

View File

@ -21,25 +21,25 @@ import java.util.Map;
import org.apache.activemq.artemis.core.io.IOCriticalErrorListener;
import org.apache.activemq.artemis.core.server.impl.Activation;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation;
import org.apache.activemq.artemis.core.server.impl.PrimaryOnlyActivation;
public class LiveOnlyPolicy implements HAPolicy<Activation> {
public class PrimaryOnlyPolicy implements HAPolicy<Activation> {
private ScaleDownPolicy scaleDownPolicy;
public LiveOnlyPolicy() {
public PrimaryOnlyPolicy() {
}
public LiveOnlyPolicy(ScaleDownPolicy scaleDownPolicy) {
public PrimaryOnlyPolicy(ScaleDownPolicy scaleDownPolicy) {
this.scaleDownPolicy = scaleDownPolicy;
}
@Override
public Activation createActivation(ActiveMQServerImpl server,
boolean wasLive,
boolean wasPrimary,
Map<String, Object> activationParams,
IOCriticalErrorListener ioCriticalErrorListener) {
return new LiveOnlyActivation(server, this);
return new PrimaryOnlyActivation(server, this);
}
@Override

View File

@ -46,7 +46,7 @@ public class ReplicaPolicy extends BackupPolicy {
private int quorumSize;
/*
* whether or not this live broker should vote to remain live
* whether this broker should vote to remain active
* */
private boolean voteOnReplicationFailure;
@ -210,10 +210,10 @@ public class ReplicaPolicy extends BackupPolicy {
@Override
public Activation createActivation(ActiveMQServerImpl server,
boolean wasLive,
boolean wasPrimary,
Map<String, Object> activationParams,
IOCriticalErrorListener ioCriticalErrorListener) throws Exception {
SharedNothingBackupActivation backupActivation = new SharedNothingBackupActivation(server, wasLive, activationParams, ioCriticalErrorListener, this, networkHealthCheck);
SharedNothingBackupActivation backupActivation = new SharedNothingBackupActivation(server, wasPrimary, activationParams, ioCriticalErrorListener, this, networkHealthCheck);
backupActivation.init();
return backupActivation;
}

Some files were not shown because too many files have changed in this diff Show More