From 9a986848468cc996e1900605d533380e21cdf317 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Wed, 21 Oct 2015 16:43:10 -0400 Subject: [PATCH] ARTEMIS-197 fixing examples by using proper location on folders --- .../core/server/cluster/ha/ColocatedHAManager.java | 12 ++++++------ .../example/ColocatedFailoverScaleDownExample.java | 6 ++++-- .../src/main/resources/activemq/server0/broker.xml | 8 ++++---- .../src/main/resources/activemq/server1/broker.xml | 8 ++++---- .../jms/example/ColocatedFailoverExample.java | 6 ++++-- .../src/main/resources/activemq/server0/broker.xml | 8 ++++---- .../src/main/resources/activemq/server1/broker.xml | 8 ++++---- examples/features/ha/pom.xml | 10 ++-------- 8 files changed, 32 insertions(+), 34 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java index f3b6f225d9..d35bccbee8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java @@ -16,6 +16,11 @@ */ package org.apache.activemq.artemis.core.server.cluster.ha; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.apache.activemq.artemis.api.core.Pair; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; @@ -27,11 +32,6 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.cluster.ClusterControl; import org.apache.activemq.artemis.core.server.cluster.ClusterController; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - public class ColocatedHAManager implements HAManager { private final ColocatedPolicy haPolicy; @@ -129,7 +129,7 @@ public class ColocatedHAManager implements HAManager { return clusterControl.requestReplicatedBackup(backupSize, server.getNodeID()); } else { - return clusterControl.requestSharedStoreBackup(backupSize, server.getConfiguration().getJournalDirectory(), server.getConfiguration().getBindingsDirectory(), server.getConfiguration().getLargeMessagesDirectory(), server.getConfiguration().getPagingDirectory()); + return clusterControl.requestSharedStoreBackup(backupSize, server.getConfiguration().getJournalLocation().getAbsolutePath(), server.getConfiguration().getBindingsLocation().getAbsolutePath(), server.getConfiguration().getLargeMessagesLocation().getAbsolutePath(), server.getConfiguration().getPagingLocation().getAbsolutePath()); } } diff --git a/examples/features/ha/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java b/examples/features/ha/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java index c3a87ec7b3..08683ab97e 100644 --- a/examples/features/ha/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java +++ b/examples/features/ha/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import org.apache.activemq.artemis.util.ServerUtil; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -28,6 +26,8 @@ import javax.jms.TextMessage; import javax.naming.InitialContext; import java.util.Hashtable; +import org.apache.activemq.artemis.util.ServerUtil; + /** * A simple example that demonstrates server side load-balancing of messages between the queue instances on different * nodes of the cluster. @@ -51,6 +51,8 @@ public class ColocatedFailoverScaleDownExample { server0 = ServerUtil.startServer(args[0], ColocatedFailoverScaleDownExample.class.getSimpleName() + "0", 0, 5000); server1 = ServerUtil.startServer(args[1], ColocatedFailoverScaleDownExample.class.getSimpleName() + "1", 1, 5000); + Thread.sleep(3000); + // Step 1. Get an initial context for looking up JNDI for both servers Hashtable properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); diff --git a/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml index 60201cadee..d5fcbf88b8 100644 --- a/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml @@ -29,13 +29,13 @@ under the License. - ${data.dir:../data}/bindings + ./data/bindings - ${data.dir:../data}/journal + ./data/journal - ${data.dir:../data}/largemessages + ./data/largemessages - ${data.dir:../data}/paging + ./data/paging diff --git a/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml index 7892fc142e..d849b10378 100644 --- a/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. - ${data.dir:../data}/bindings + ./data/bindings - ${data.dir:../data}/journal + ./data/journal - ${data.dir:../data}/largemessages + ./data/largemessages - ${data.dir:../data}/paging + ./data/paging diff --git a/examples/features/ha/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java b/examples/features/ha/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java index 3e0d07ee38..ac882381ab 100644 --- a/examples/features/ha/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java +++ b/examples/features/ha/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import org.apache.activemq.artemis.util.ServerUtil; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -28,6 +26,8 @@ import javax.jms.TextMessage; import javax.naming.InitialContext; import java.util.Hashtable; +import org.apache.activemq.artemis.util.ServerUtil; + /** * A simple example that demonstrates a colocated server */ @@ -50,6 +50,8 @@ public class ColocatedFailoverExample { server0 = ServerUtil.startServer(args[0], ColocatedFailoverExample.class.getSimpleName() + "0", 0, 5000); server1 = ServerUtil.startServer(args[1], ColocatedFailoverExample.class.getSimpleName() + "1", 1, 5000); + Thread.sleep(3000); + // Step 1. Get an initial context for looking up JNDI for both servers Hashtable properties = new Hashtable(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); diff --git a/examples/features/ha/colocated-failover/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/colocated-failover/src/main/resources/activemq/server0/broker.xml index 0a4103fe52..f569d39cec 100644 --- a/examples/features/ha/colocated-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/colocated-failover/src/main/resources/activemq/server0/broker.xml @@ -29,13 +29,13 @@ under the License. - ${data.dir:../data}/bindings + ./data/bindings - ${data.dir:../data}/journal + ./data/journal - ${data.dir:../data}/largemessages + ./data/largemessages - ${data.dir:../data}/paging + ./data/paging diff --git a/examples/features/ha/colocated-failover/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/colocated-failover/src/main/resources/activemq/server1/broker.xml index 8083f2760b..71015e5189 100644 --- a/examples/features/ha/colocated-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/colocated-failover/src/main/resources/activemq/server1/broker.xml @@ -29,13 +29,13 @@ under the License. - ${data.dir:../data}/bindings + ./data/bindings - ${data.dir:../data}/journal + ./data/journal - ${data.dir:../data}/largemessages + ./data/largemessages - ${data.dir:../data}/paging + ./data/paging diff --git a/examples/features/ha/pom.xml b/examples/features/ha/pom.xml index 4d4904e652..e607a1ffba 100644 --- a/examples/features/ha/pom.xml +++ b/examples/features/ha/pom.xml @@ -69,20 +69,14 @@ under the License. application-layer-failover client-side-failoverlistener - - - + colocated-failover-scale-down ha-policy-autobackup multiple-failover multiple-failover-failback non-transaction-failover - - - + replicated-failback-static replicated-multiple-failover replicated-transaction-failover scale-down