ARTEMIS-1053 use creds for active server check
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a9360f55 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a9360f55 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a9360f55 Branch: refs/heads/master Commit: a9360f559955c24feb61beefa15f454085a0f7d3 Parents: 1282daf Author: Justin Bertram <[email protected]> Authored: Tue Mar 21 10:20:18 2017 -0500 Committer: Andy Taylor <[email protected]> Committed: Tue Mar 21 17:21:56 2017 +0000 ---------------------------------------------------------------------- .../server/impl/SharedNothingLiveActivation.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9360f55/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java index b36326c..7e8eb5d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java @@ -317,7 +317,7 @@ public class SharedNothingLiveActivation extends LiveActivation { ClusterConnectionConfiguration config = ConfigurationUtils.getReplicationClusterConfiguration(activeMQServer.getConfiguration(), replicatedPolicy.getClusterName()); - NodeIdListener listener = new NodeIdListener(nodeId0); + NodeIdListener listener = new NodeIdListener(nodeId0, activeMQServer.getConfiguration().getClusterUser(), activeMQServer.getConfiguration().getClusterPassword()); try (ServerLocatorInternal locator = getLocator(config)) { locator.addClusterTopologyListener(listener); @@ -396,10 +396,14 @@ public class SharedNothingLiveActivation extends LiveActivation { volatile boolean isNodePresent = false; private final SimpleString nodeId; + private final String user; + private final String password; private final CountDownLatch latch = new CountDownLatch(1); - NodeIdListener(SimpleString nodeId) { + NodeIdListener(SimpleString nodeId, String user, String password) { this.nodeId = nodeId; + this.user = user; + this.password = password; } @Override @@ -427,11 +431,13 @@ public class SharedNothingLiveActivation extends LiveActivation { boolean result = false; try (ServerLocator serverLocator = ActiveMQClient.createServerLocator(false, transportConfiguration); - ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory(); - ClientSession clientSession = clientSessionFactory.createSession();) { + ClientSessionFactory clientSessionFactory = serverLocator.createSessionFactory(); + ClientSession clientSession = clientSessionFactory.createSession(user, password, false, false, false, false, 0)) { result = true; } catch (Exception e) { - // ignore + if (logger.isDebugEnabled()) { + logger.debug("isActive check failed", e); + } } return result;
