Repository: activemq-artemis Updated Branches: refs/heads/master 664636dbd -> d728fe771
Individualizing traces and debug on client Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/ec526935 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ec526935 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ec526935 Branch: refs/heads/master Commit: ec52693513b2f3a4a63f9cf4089bb8213ac8468c Parents: 664636d Author: Clebert Suconic <[email protected]> Authored: Tue May 17 14:36:59 2016 -0400 Committer: Clebert Suconic <[email protected]> Committed: Tue May 17 14:36:59 2016 -0400 ---------------------------------------------------------------------- .../core/ChannelBroadcastEndpointFactory.java | 7 +- .../api/core/JGroupsBroadcastEndpoint.java | 7 +- .../api/core/jgroups/JChannelManager.java | 5 +- .../api/core/jgroups/JChannelWrapper.java | 17 ++--- .../api/core/jgroups/JGroupsReceiver.java | 7 +- .../core/client/impl/ClientConsumerImpl.java | 51 +++++++------ .../client/impl/ClientSessionFactoryImpl.java | 80 +++++++++----------- .../core/client/impl/ClientSessionImpl.java | 49 ++++++------ .../core/client/impl/ServerLocatorImpl.java | 43 ++++++----- .../artemis/core/client/impl/Topology.java | 62 +++++++-------- .../artemis/core/cluster/DiscoveryGroup.java | 13 ++-- .../impl/ActiveMQClientProtocolManager.java | 8 +- .../core/impl/ActiveMQSessionContext.java | 7 +- .../core/protocol/core/impl/ChannelImpl.java | 44 +++++------ .../core/impl/RemotingConnectionImpl.java | 15 +--- .../remoting/impl/netty/NettyConnector.java | 10 ++- .../protocol/AbstractRemotingConnection.java | 5 +- .../artemis/utils/OrderedExecutorFactory.java | 5 +- .../artemis/utils/SoftValueHashMap.java | 8 +- .../apache/activemq/artemis/utils/XMLUtil.java | 5 +- 20 files changed, 228 insertions(+), 220 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java index d7086a5..af0df2e 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/ChannelBroadcastEndpointFactory.java @@ -31,7 +31,6 @@ import org.jgroups.JChannel; public class ChannelBroadcastEndpointFactory implements BroadcastEndpointFactory { private static final Logger logger = Logger.getLogger(ChannelBroadcastEndpointFactory.class); - private static final boolean isTrace = logger.isTraceEnabled(); private final JChannel channel; @@ -47,14 +46,14 @@ public class ChannelBroadcastEndpointFactory implements BroadcastEndpointFactory // private static JChannelManager recoverManager(JChannel channel) { // JChannelManager manager = managers.get(channel); // if (manager == null) { -// if (isTrace) { +// if (logger.isTraceEnabled()) { // logger.trace("Creating a new JChannelManager for " + channel, new Exception("trace")); // } // manager = new JChannelManager(); // managers.put(channel, manager); // } // else { -// if (isTrace) { +// if (logger.isTraceEnabled()) { // logger.trace("Recover an already existent channelManager for " + channel, new Exception("trace")); // } // @@ -69,7 +68,7 @@ public class ChannelBroadcastEndpointFactory implements BroadcastEndpointFactory } private ChannelBroadcastEndpointFactory(JChannelManager manager, JChannel channel, String channelName) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace("new ChannelBroadcastEndpointFactory(" + manager + ", " + channel + ", " + channelName, new Exception("trace")); } this.manager = manager; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java index 7657b0b..79c7e14 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java @@ -30,7 +30,6 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint { private static final Logger logger = Logger.getLogger(JGroupsBroadcastEndpoint.class); - private static final boolean isTrace = logger.isTraceEnabled(); private final String channelName; private boolean clientOpened; @@ -50,7 +49,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint { @Override public void broadcast(final byte[] data) throws Exception { - if (isTrace) logger.trace("Broadcasting: BroadCastOpened=" + broadcastOpened + ", channelOPen=" + channel.getChannel().isOpen()); + if (logger.isTraceEnabled()) logger.trace("Broadcasting: BroadCastOpened=" + broadcastOpened + ", channelOPen=" + channel.getChannel().isOpen()); if (broadcastOpened) { org.jgroups.Message msg = new org.jgroups.Message(); @@ -62,7 +61,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint { @Override public byte[] receiveBroadcast() throws Exception { - if (isTrace) logger.trace("Receiving Broadcast: clientOpened=" + clientOpened + ", channelOPen=" + channel.getChannel().isOpen()); + if (logger.isTraceEnabled()) logger.trace("Receiving Broadcast: clientOpened=" + clientOpened + ", channelOPen=" + channel.getChannel().isOpen()); if (clientOpened) { return receiver.receiveBroadcast(); } @@ -73,7 +72,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint { @Override public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception { - if (isTrace) logger.trace("Receiving Broadcast2: clientOpened=" + clientOpened + ", channelOPen=" + channel.getChannel().isOpen()); + if (logger.isTraceEnabled()) logger.trace("Receiving Broadcast2: clientOpened=" + clientOpened + ", channelOPen=" + channel.getChannel().isOpen()); if (clientOpened) { return receiver.receiveBroadcast(time, unit); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java index 296dc8a..f594c07 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelManager.java @@ -33,7 +33,6 @@ import org.jboss.logging.Logger; public class JChannelManager { private static final Logger logger = Logger.getLogger(JChannelManager.class); - private static final boolean isTrace = logger.isTraceEnabled(); private Map<String, JChannelWrapper> channels; @@ -46,11 +45,11 @@ public class JChannelManager { if (wrapper == null) { wrapper = new JChannelWrapper(this, channelName, endpoint.createChannel()); channels.put(channelName, wrapper); - if (isTrace) + if (logger.isTraceEnabled()) logger.trace("Put Channel " + channelName); return wrapper; } - if (isTrace) + if (logger.isTraceEnabled()) logger.trace("Add Ref Count " + channelName); return wrapper.addRef(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java index 7851c9a..7d64dd4 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JChannelWrapper.java @@ -31,7 +31,6 @@ import org.jgroups.ReceiverAdapter; */ public class JChannelWrapper { private static final Logger logger = Logger.getLogger(JChannelWrapper.class); - private static final boolean isTrace = logger.isTraceEnabled(); private boolean connected = false; int refCount = 1; @@ -47,7 +46,7 @@ public class JChannelWrapper { this.manager = manager; - if (isTrace && channel.getReceiver() != null) { + if (logger.isTraceEnabled() && channel.getReceiver() != null) { logger.trace(this + "The channel already had a receiver previously!!!! == " + channel.getReceiver(), new Exception("trace")); } @@ -61,7 +60,7 @@ public class JChannelWrapper { @Override public void receive(org.jgroups.Message msg) { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace(this + ":: Wrapper received " + msg + " on channel " + channelName); } synchronized (receivers) { @@ -83,7 +82,7 @@ public class JChannelWrapper { public synchronized void close(boolean closeWrappedChannel) { refCount--; - if (isTrace) logger.trace(this + "::RefCount-- " + refCount + " on channel " + channelName, new Exception("Trace")); + if (logger.isTraceEnabled()) logger.trace(this + "::RefCount-- " + refCount + " on channel " + channelName, new Exception("Trace")); if (refCount == 0) { if (closeWrappedChannel) { connected = false; @@ -96,14 +95,14 @@ public class JChannelWrapper { } public void removeReceiver(JGroupsReceiver receiver) { - if (isTrace) logger.trace(this + "::removeReceiver: " + receiver + " on " + channelName, new Exception("Trace")); + if (logger.isTraceEnabled()) logger.trace(this + "::removeReceiver: " + receiver + " on " + channelName, new Exception("Trace")); synchronized (receivers) { receivers.remove(receiver); } } public synchronized void connect() throws Exception { - if (isTrace) { + if (logger.isTraceEnabled()) { logger.trace(this + ":: Connecting " + channelName, new Exception("Trace")); } @@ -121,19 +120,19 @@ public class JChannelWrapper { public void addReceiver(JGroupsReceiver jGroupsReceiver) { synchronized (receivers) { - if (isTrace) logger.trace(this + "::Add Receiver: " + jGroupsReceiver + " on " + channelName); + if (logger.isTraceEnabled()) logger.trace(this + "::Add Receiver: " + jGroupsReceiver + " on " + channelName); receivers.add(jGroupsReceiver); } } public void send(org.jgroups.Message msg) throws Exception { - if (isTrace) logger.trace(this + "::Sending JGroups Message: Open=" + channel.isOpen() + " on channel " + channelName + " msg=" + msg); + if (logger.isTraceEnabled()) logger.trace(this + "::Sending JGroups Message: Open=" + channel.isOpen() + " on channel " + channelName + " msg=" + msg); channel.send(msg); } public JChannelWrapper addRef() { this.refCount++; - if (isTrace) logger.trace(this + "::RefCount++ = " + refCount + " on channel " + channelName); + if (logger.isTraceEnabled()) logger.trace(this + "::RefCount++ = " + refCount + " on channel " + channelName); return this; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JGroupsReceiver.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JGroupsReceiver.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JGroupsReceiver.java index c931661..c49caf0 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JGroupsReceiver.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/jgroups/JGroupsReceiver.java @@ -31,19 +31,18 @@ import org.jgroups.ReceiverAdapter; public class JGroupsReceiver extends ReceiverAdapter { private static final Logger logger = Logger.getLogger(JGroupsReceiver.class); - private static final boolean isTrace = logger.isTraceEnabled(); private final BlockingQueue<byte[]> dequeue = new LinkedBlockingDeque<>(); @Override public void receive(org.jgroups.Message msg) { - if (isTrace) logger.trace("sending message " + msg); + if (logger.isTraceEnabled()) logger.trace("sending message " + msg); dequeue.add(msg.getBuffer()); } public byte[] receiveBroadcast() throws Exception { byte[] bytes = dequeue.take(); - if (isTrace) { + if (logger.isTraceEnabled()) { logBytes("receiveBroadcast()", bytes); } @@ -62,7 +61,7 @@ public class JGroupsReceiver extends ReceiverAdapter { public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception { byte[] bytes = dequeue.poll(time, unit); - if (isTrace) { + if (logger.isTraceEnabled()) { logBytes("receiveBroadcast(long time, TimeUnit unit)", bytes); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java index 8013b72..7b72188 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java @@ -43,12 +43,13 @@ import org.apache.activemq.artemis.utils.PriorityLinkedList; import org.apache.activemq.artemis.utils.PriorityLinkedListImpl; import org.apache.activemq.artemis.utils.ReusableLatch; import org.apache.activemq.artemis.utils.TokenBucketLimiter; +import org.jboss.logging.Logger; public final class ClientConsumerImpl implements ClientConsumerInternal { // Constants // ------------------------------------------------------------------------------------ - private static final boolean isTrace = ActiveMQClientLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(ClientConsumerImpl.class); private static final long CLOSE_TIMEOUT_MILLISECONDS = 10000; @@ -267,8 +268,8 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { } if (callForceDelivery) { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Forcing delivery"); + if (logger.isTraceEnabled()) { + logger.trace("Forcing delivery"); } // JBPAPP-6030 - Calling forceDelivery outside of the lock to avoid distributed dead locks sessionContext.forceDelivery(this, forceDeliveryCount++); @@ -289,15 +290,15 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { // forced delivery messages are discarded, nothing has been delivered by the queue resetIfSlowConsumer(); - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("There was nothing on the queue, leaving it now:: returning null"); + if (logger.isTraceEnabled()) { + logger.trace("There was nothing on the queue, leaving it now:: returning null"); } return null; } else { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Ignored force delivery answer as it belonged to another call"); + if (logger.isTraceEnabled()) { + logger.trace("Ignored force delivery answer as it belonged to another call"); } // Ignore the message continue; @@ -329,15 +330,15 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { largeMessageReceived = m; } - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Returning " + m); + if (logger.isTraceEnabled()) { + logger.trace("Returning " + m); } return m; } else { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Returning null"); + if (logger.isTraceEnabled()) { + logger.trace("Returning null"); } resetIfSlowConsumer(); return null; @@ -645,8 +646,8 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { return; } if (currentLargeMessageController == null) { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Sending back credits for largeController = null " + flowControlSize); + if (logger.isTraceEnabled()) { + logger.trace("Sending back credits for largeController = null " + flowControlSize); } flowControl(flowControlSize, false); } @@ -761,8 +762,8 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { if (creditsToSend >= clientWindowSize) { if (clientWindowSize == 0 && discountSlowConsumer) { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("FlowControl::Sending " + creditsToSend + " -1, for slow consumer"); + if (logger.isTraceEnabled()) { + logger.trace("FlowControl::Sending " + creditsToSend + " -1, for slow consumer"); } // sending the credits - 1 initially send to fire the slow consumer, or the slow consumer would be @@ -776,8 +777,8 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { } } else { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug("Sending " + messageBytes + " from flow-control"); + if (logger.isDebugEnabled()) { + logger.debug("Sending " + messageBytes + " from flow-control"); } final int credits = creditsToSend; @@ -808,8 +809,8 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { * Sending an initial credit for slow consumers */ private void startSlowConsumer() { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Sending 1 credit to start delivering of one message to slow consumer"); + if (logger.isTraceEnabled()) { + logger.trace("Sending 1 credit to start delivering of one message to slow consumer"); } sendCredits(1); try { @@ -853,8 +854,8 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { } private void queueExecutor() { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Adding Runner on Executor for delivery"); + if (logger.isTraceEnabled()) { + logger.trace("Adding Runner on Executor for delivery"); } sessionExecutor.execute(runner); @@ -944,8 +945,8 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { flowControlBeforeConsumption(message); if (!expired) { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Calling handler.onMessage"); + if (logger.isTraceEnabled()) { + logger.trace("Calling handler.onMessage"); } final ClassLoader originalLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override @@ -979,8 +980,8 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { onMessageThread = null; } - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Handler.onMessage done"); + if (logger.isTraceEnabled()) { + logger.trace("Handler.onMessage done"); } if (message.isLargeMessage()) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java index 9d9d593..96b4059 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java @@ -66,17 +66,11 @@ import org.apache.activemq.artemis.utils.ConfirmationWindowWarning; import org.apache.activemq.artemis.utils.ExecutorFactory; import org.apache.activemq.artemis.utils.OrderedExecutorFactory; import org.apache.activemq.artemis.utils.UUIDGenerator; +import org.jboss.logging.Logger; public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, ClientConnectionLifeCycleListener { - // Constants - // ------------------------------------------------------------------------------------ - private static final boolean isTrace = ActiveMQClientLogger.LOGGER.isTraceEnabled(); - - private static final boolean isDebug = ActiveMQClientLogger.LOGGER.isDebugEnabled(); - - // Attributes - // ----------------------------------------------------------------------------------- + private static final Logger logger = Logger.getLogger(ClientSessionFactoryImpl.class); private final ServerLocatorInternal serverLocator; @@ -270,14 +264,14 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C } if (localConnector.isEquivalent(live.getParams()) && backUp != null && !localConnector.isEquivalent(backUp.getParams())) { - if (ClientSessionFactoryImpl.isDebug) { - ActiveMQClientLogger.LOGGER.debug("Setting up backup config = " + backUp + " for live = " + live); + if (logger.isDebugEnabled()) { + logger.debug("Setting up backup config = " + backUp + " for live = " + live); } backupConfig = backUp; } else { - if (ClientSessionFactoryImpl.isDebug) { - ActiveMQClientLogger.LOGGER.debug("ClientSessionFactoryImpl received backup update for live/backup pair = " + live + + if (logger.isDebugEnabled()) { + logger.debug("ClientSessionFactoryImpl received backup update for live/backup pair = " + live + " / " + backUp + " but it didn't belong to " + @@ -514,7 +508,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C } catch (ActiveMQInterruptedException e1) { // this is just a debug, since an interrupt is an expected event (in case of a shutdown) - ActiveMQClientLogger.LOGGER.debug(e1.getMessage(), e1); + logger.debug(e1.getMessage(), e1); } catch (Throwable t) { //for anything else just close so clients are un blocked @@ -548,8 +542,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C return; } - if (ClientSessionFactoryImpl.isTrace) { - ActiveMQClientLogger.LOGGER.trace("Client Connection failed, calling failure listeners and trying to reconnect, reconnectAttempts=" + reconnectAttempts); + if (ClientSessionFactoryImpl.logger.isTraceEnabled()) { + logger.trace("Client Connection failed, calling failure listeners and trying to reconnect, reconnectAttempts=" + reconnectAttempts); } callFailoverListeners(FailoverEventType.FAILURE_DETECTED); @@ -782,8 +776,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C private void getConnectionWithRetry(final int reconnectAttempts) { if (!clientProtocolManager.isAlive()) return; - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("getConnectionWithRetry::" + reconnectAttempts + + if (logger.isTraceEnabled()) { + logger.trace("getConnectionWithRetry::" + reconnectAttempts + " with retryInterval = " + retryInterval + " multiplier = " + @@ -795,13 +789,13 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C int count = 0; while (clientProtocolManager.isAlive()) { - if (ClientSessionFactoryImpl.isDebug) { - ActiveMQClientLogger.LOGGER.debug("Trying reconnection attempt " + count + "/" + reconnectAttempts); + if (logger.isDebugEnabled()) { + logger.debug("Trying reconnection attempt " + count + "/" + reconnectAttempts); } if (getConnection() != null) { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug("Reconnection successful"); + if (logger.isDebugEnabled()) { + logger.debug("Reconnection successful"); } return; } @@ -819,7 +813,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C return; } - if (ClientSessionFactoryImpl.isTrace) { + if (ClientSessionFactoryImpl.logger.isTraceEnabled()) { ActiveMQClientLogger.LOGGER.waitingForRetry(interval, retryInterval, retryIntervalMultiplier); } @@ -842,7 +836,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C interval = newInterval; } else { - ActiveMQClientLogger.LOGGER.debug("Could not connect to any server. Didn't have reconnection configured on the ClientSessionFactory"); + logger.debug("Could not connect to any server. Didn't have reconnection configured on the ClientSessionFactory"); return; } } @@ -929,14 +923,14 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C if (serverLocator.getTopology() != null) { if (connection != null) { - if (ClientSessionFactoryImpl.isTrace) { - ActiveMQClientLogger.LOGGER.trace(this + "::Subscribing Topology"); + if (ClientSessionFactoryImpl.logger.isTraceEnabled()) { + logger.trace(this + "::Subscribing Topology"); } clientProtocolManager.sendSubscribeTopology(serverLocator.isClusterConnection()); } } else { - ActiveMQClientLogger.LOGGER.debug("serverLocator@" + System.identityHashCode(serverLocator + " had no topology")); + logger.debug("serverLocator@" + System.identityHashCode(serverLocator + " had no topology")); } return connection; @@ -1050,8 +1044,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C Connection transportConnection = connector.createConnection(); if (transportConnection == null) { - if (ClientSessionFactoryImpl.isDebug) { - ActiveMQClientLogger.LOGGER.debug("Connector towards " + connector + " failed"); + if (logger.isDebugEnabled()) { + logger.debug("Connector towards " + connector + " failed"); } try { @@ -1081,8 +1075,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C Connection transportConnection = null; try { - if (ClientSessionFactoryImpl.isDebug) { - ActiveMQClientLogger.LOGGER.debug("Trying to connect with connector = " + connectorFactory + + if (logger.isDebugEnabled()) { + logger.debug("Trying to connect with connector = " + connectorFactory + ", parameters = " + connectorConfig.getParams() + " connector = " + @@ -1096,8 +1090,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C connector = liveConnector; } else if (backupConfig != null) { - if (ClientSessionFactoryImpl.isDebug) { - ActiveMQClientLogger.LOGGER.debug("Trying backup config = " + backupConfig); + if (logger.isDebugEnabled()) { + logger.debug("Trying backup config = " + backupConfig); } ConnectorFactory backupConnectorFactory = instantiateConnectorFactory(backupConfig.getFactoryClassName()); @@ -1109,8 +1103,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C if (transportConnection != null) { /*looks like the backup is now live, let's use that*/ - if (ClientSessionFactoryImpl.isDebug) { - ActiveMQClientLogger.LOGGER.debug("Connected to the backup at " + backupConfig); + if (logger.isDebugEnabled()) { + logger.debug("Connected to the backup at " + backupConfig); } // Switching backup as live @@ -1120,8 +1114,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C connectorFactory = backupConnectorFactory; } else { - if (ClientSessionFactoryImpl.isDebug) { - ActiveMQClientLogger.LOGGER.debug("Backup is not active."); + if (logger.isDebugEnabled()) { + logger.debug("Backup is not active."); } } @@ -1166,7 +1160,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C theConn.bufferReceived(connectionID, buffer); } else { - ActiveMQClientLogger.LOGGER.debug("TheConn == null on ClientSessionFactoryImpl::DelegatingBufferHandler, ignoring packet"); + logger.debug("TheConn == null on ClientSessionFactoryImpl::DelegatingBufferHandler, ignoring packet"); } } } @@ -1279,8 +1273,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C Connection transportConnection = createTransportConnection(); if (transportConnection == null) { - if (ClientSessionFactoryImpl.isTrace) { - ActiveMQClientLogger.LOGGER.trace("Neither backup or live were active, will just give up now"); + if (ClientSessionFactoryImpl.logger.isTraceEnabled()) { + logger.trace("Neither backup or live were active, will just give up now"); } return null; } @@ -1291,8 +1285,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C schedulePing(); - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("returning " + newConnection); + if (logger.isTraceEnabled()) { + logger.trace("returning " + newConnection); } return newConnection; @@ -1320,8 +1314,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C @Override public void nodeDisconnected(RemotingConnection conn, String nodeID, String scaleDownTargetNodeID) { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Disconnect being called on client:" + + if (logger.isTraceEnabled()) { + logger.trace("Disconnect being called on client:" + " server locator = " + serverLocator + " notifying node " + http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java index 145d963..ae8966c 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java @@ -51,9 +51,12 @@ import org.apache.activemq.artemis.utils.ConfirmationWindowWarning; import org.apache.activemq.artemis.utils.TokenBucketLimiterImpl; import org.apache.activemq.artemis.utils.UUIDGenerator; import org.apache.activemq.artemis.utils.XidCodecSupport; +import org.jboss.logging.Logger; public final class ClientSessionImpl implements ClientSessionInternal, FailureListener { + private static final Logger logger = Logger.getLogger(ClientSessionImpl.class); + private final Map<String, String> metadata = new HashMap<>(); private final ClientSessionFactoryInternal sessionFactory; @@ -486,8 +489,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi public void commit() throws ActiveMQException { checkClosed(); - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Sending commit"); + if (logger.isTraceEnabled()) { + logger.trace("Sending commit"); } /* @@ -547,8 +550,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi public void rollback(final boolean isLastMessageAsDelivered, final boolean waitConsumers) throws ActiveMQException { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("calling rollback(isLastMessageAsDelivered=" + isLastMessageAsDelivered + ")"); + if (logger.isTraceEnabled()) { + logger.trace("calling rollback(isLastMessageAsDelivered=" + isLastMessageAsDelivered + ")"); } checkClosed(); @@ -745,8 +748,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi } checkClosed(); - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug("client ack messageID = " + message.getMessageID()); + if (logger.isDebugEnabled()) { + logger.debug("client ack messageID = " + message.getMessageID()); } startCall(); @@ -870,12 +873,12 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void close() throws ActiveMQException { if (closed) { - ActiveMQClientLogger.LOGGER.debug("Session was already closed, giving up now, this=" + this); + logger.debug("Session was already closed, giving up now, this=" + this); return; } - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug("Calling close on session " + this); + if (logger.isDebugEnabled()) { + logger.debug("Calling close on session " + this); } try { @@ -891,7 +894,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi // Session close should always return without exception // Note - we only log at trace - ActiveMQClientLogger.LOGGER.trace("Failed to close session", e); + logger.trace("Failed to close session", e); } doCleanup(false); @@ -1128,8 +1131,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void commit(final Xid xid, final boolean onePhase) throws XAException { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("call commit(xid=" + convert(xid)); + if (logger.isTraceEnabled()) { + logger.trace("call commit(xid=" + convert(xid)); } checkXA(); @@ -1178,8 +1181,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void end(final Xid xid, final int flags) throws XAException { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Calling end:: " + convert(xid) + ", flags=" + convertTXFlag(flags)); + if (logger.isTraceEnabled()) { + logger.trace("Calling end:: " + convert(xid) + ", flags=" + convertTXFlag(flags)); } checkXA(); @@ -1190,7 +1193,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi rollback(false, false); } catch (Throwable ignored) { - ActiveMQClientLogger.LOGGER.debug("Error on rollback during end call!", ignored); + logger.debug("Error on rollback during end call!", ignored); } throw new XAException(XAException.XAER_RMFAIL); } @@ -1315,8 +1318,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public int prepare(final Xid xid) throws XAException { checkXA(); - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Calling prepare:: " + convert(xid)); + if (logger.isTraceEnabled()) { + logger.trace("Calling prepare:: " + convert(xid)); } if (rollbackOnly) { @@ -1402,8 +1405,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi public void rollback(final Xid xid) throws XAException { checkXA(); - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Calling rollback:: " + convert(xid)); + if (logger.isTraceEnabled()) { + logger.trace("Calling rollback:: " + convert(xid)); } try { @@ -1455,8 +1458,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void start(final Xid xid, final int flags) throws XAException { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Calling start:: " + convert(xid) + " clientXID=" + xid + " flags = " + convertTXFlag(flags)); + if (logger.isTraceEnabled()) { + logger.trace("Calling start:: " + convert(xid) + " clientXID=" + xid + " flags = " + convertTXFlag(flags)); } checkXA(); @@ -1633,8 +1636,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi } private void doCleanup(boolean failingOver) { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug("calling cleanup on " + this); + if (logger.isDebugEnabled()) { + logger.debug("calling cleanup on " + this); } synchronized (this) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java index d9f641a..8c71002 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java @@ -68,6 +68,7 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadPoolExecutor; import org.apache.activemq.artemis.utils.ClassloadingUtil; import org.apache.activemq.artemis.utils.UUIDGenerator; import org.apache.activemq.artemis.utils.uri.FluentPropertyBeanIntrospectorWithIgnores; +import org.jboss.logging.Logger; /** * This is the implementation of {@link org.apache.activemq.artemis.api.core.client.ServerLocator} and all @@ -75,6 +76,8 @@ import org.apache.activemq.artemis.utils.uri.FluentPropertyBeanIntrospectorWithI */ public final class ServerLocatorImpl implements ServerLocatorInternal, DiscoveryListener { + private static final Logger logger = Logger.getLogger(ServerLocatorImpl.class); + private enum STATE { INITIALIZED, CLOSED, CLOSING } @@ -536,8 +539,8 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery synchronized (this) { // if the topologyArray is null, we will use the initialConnectors if (usedTopology != null) { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Selecting connector from toplogy."); + if (logger.isTraceEnabled()) { + logger.trace("Selecting connector from toplogy."); } int pos = loadBalancingPolicy.select(usedTopology.length); Pair<TransportConfiguration, TransportConfiguration> pair = usedTopology[pos]; @@ -546,8 +549,8 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery } else { // Get from initialconnectors - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Selecting connector from initial connectors."); + if (logger.isTraceEnabled()) { + logger.trace("Selecting connector from initial connectors."); } int pos = loadBalancingPolicy.select(initialConnectors.length); @@ -651,8 +654,8 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery public ClientSessionFactory createSessionFactory(String nodeID) throws Exception { TopologyMember topologyMember = topology.getMember(nodeID); - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Creating connection factory towards " + nodeID + " = " + topologyMember + ", topology=" + topology.describe()); + if (logger.isTraceEnabled()) { + logger.trace("Creating connection factory towards " + nodeID + " = " + topologyMember + ", topology=" + topology.describe()); } if (topologyMember == null) { @@ -1323,8 +1326,8 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery private void doClose(final boolean sendClose) { synchronized (stateGuard) { if (state == STATE.CLOSED) { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug(this + " is already closed when calling closed"); + if (logger.isDebugEnabled()) { + logger.debug(this + " is already closed when calling closed"); } return; } @@ -1428,8 +1431,8 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery return; } - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("nodeDown " + this + " nodeID=" + nodeID + " as being down", new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace("nodeDown " + this + " nodeID=" + nodeID + " as being down", new Exception("trace")); } topology.removeMember(eventTime, nodeID); @@ -1462,8 +1465,8 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery final String scaleDownGroupName, final Pair<TransportConfiguration, TransportConfiguration> connectorPair, final boolean last) { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("NodeUp " + this + "::nodeID=" + nodeID + ", connectorPair=" + connectorPair, new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace("NodeUp " + this + "::nodeID=" + nodeID + ", connectorPair=" + connectorPair, new Exception("trace")); } TopologyMemberImpl member = new TopologyMemberImpl(nodeID, backupGroupName, scaleDownGroupName, connectorPair.getA(), connectorPair.getB()); @@ -1654,8 +1657,8 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery while (csf == null && !isClosed()) { retryNumber++; for (Connector conn : connectors) { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug(this + "::Submitting connect towards " + conn); + if (logger.isDebugEnabled()) { + logger.debug(this + "::Submitting connect towards " + conn); } csf = conn.tryConnect(); @@ -1690,8 +1693,8 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery } }); - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug("Returning " + csf + + if (logger.isDebugEnabled()) { + logger.debug("Returning " + csf + " after " + retryNumber + " retries on StaticConnector " + @@ -1714,7 +1717,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery catch (RejectedExecutionException e) { if (isClosed() || skipWarnings) return null; - ActiveMQClientLogger.LOGGER.debug("Rejected execution", e); + logger.debug("Rejected execution", e); throw e; } catch (Exception e) { @@ -1787,8 +1790,8 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery } public ClientSessionFactory tryConnect() throws ActiveMQException { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug(this + "::Trying to connect to " + factory); + if (logger.isDebugEnabled()) { + logger.debug(this + "::Trying to connect to " + factory); } try { ClientSessionFactoryInternal factoryToUse = factory; @@ -1805,7 +1808,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery return factoryToUse; } catch (ActiveMQException e) { - ActiveMQClientLogger.LOGGER.debug(this + "::Exception on establish connector initial connection", e); + logger.debug(this + "::Exception on establish connector initial connection", e); return null; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/Topology.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/Topology.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/Topology.java index 0573b2d..4e9230b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/Topology.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/Topology.java @@ -30,8 +30,10 @@ import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener; import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; import org.apache.activemq.artemis.spi.core.remoting.Connector; +import org.jboss.logging.Logger; public final class Topology { + private static final Logger logger = Logger.getLogger(Topology.class); private final Set<ClusterTopologyListener> topologyListeners; @@ -76,8 +78,8 @@ public final class Topology { } this.executor = executor; this.owner = owner; - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("Topology@" + Integer.toHexString(System.identityHashCode(this)) + " CREATE", new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace("Topology@" + Integer.toHexString(System.identityHashCode(this)) + " CREATE", new Exception("trace")); } } @@ -89,8 +91,8 @@ public final class Topology { } public void addClusterTopologyListener(final ClusterTopologyListener listener) { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace(this + "::Adding topology listener " + listener, new Exception("Trace")); + if (logger.isTraceEnabled()) { + logger.trace(this + "::Adding topology listener " + listener, new Exception("Trace")); } synchronized (topologyListeners) { topologyListeners.add(listener); @@ -99,8 +101,8 @@ public final class Topology { } public void removeClusterTopologyListener(final ClusterTopologyListener listener) { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace(this + "::Removing topology listener " + listener, new Exception("Trace")); + if (logger.isTraceEnabled()) { + logger.trace(this + "::Removing topology listener " + listener, new Exception("Trace")); } synchronized (topologyListeners) { topologyListeners.remove(listener); @@ -112,8 +114,8 @@ public final class Topology { */ public void updateAsLive(final String nodeId, final TopologyMemberImpl memberInput) { synchronized (this) { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug(this + "::node " + nodeId + "=" + memberInput); + if (logger.isDebugEnabled()) { + logger.debug(this + "::node " + nodeId + "=" + memberInput); } memberInput.setUniqueEventID(System.currentTimeMillis()); topology.remove(nodeId); @@ -142,15 +144,15 @@ public final class Topology { */ public TopologyMemberImpl updateBackup(final TopologyMemberImpl memberInput) { final String nodeId = memberInput.getNodeId(); - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace(this + "::updateBackup::" + nodeId + ", memberInput=" + memberInput); + if (logger.isTraceEnabled()) { + logger.trace(this + "::updateBackup::" + nodeId + ", memberInput=" + memberInput); } synchronized (this) { TopologyMemberImpl currentMember = getMember(nodeId); if (currentMember == null) { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("There's no live to be updated on backup update, node=" + nodeId + " memberInput=" + memberInput, new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace("There's no live to be updated on backup update, node=" + nodeId + " memberInput=" + memberInput, new Exception("trace")); } currentMember = memberInput; @@ -178,7 +180,7 @@ public final class Topology { Long deleteTme = getMapDelete().get(nodeId); if (deleteTme != null && uniqueEventID != 0 && uniqueEventID < deleteTme) { - ActiveMQClientLogger.LOGGER.debug("Update uniqueEvent=" + uniqueEventID + + logger.debug("Update uniqueEvent=" + uniqueEventID + ", nodeId=" + nodeId + ", memberInput=" + @@ -191,8 +193,8 @@ public final class Topology { TopologyMemberImpl currentMember = topology.get(nodeId); if (currentMember == null) { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace(this + "::NewMemberAdd nodeId=" + nodeId + " member = " + memberInput, new Exception("trace")); + if (logger.isTraceEnabled()) { + logger.trace(this + "::NewMemberAdd nodeId=" + nodeId + " member = " + memberInput, new Exception("trace")); } memberInput.setUniqueEventID(uniqueEventID); topology.put(nodeId, memberInput); @@ -210,8 +212,8 @@ public final class Topology { newMember.setBackup(currentMember.getBackup()); } - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace(this + "::updated currentMember=nodeID=" + nodeId + ", currentMember=" + + if (logger.isTraceEnabled()) { + logger.trace(this + "::updated currentMember=nodeID=" + nodeId + ", currentMember=" + currentMember + ", memberInput=" + memberInput + "newMember=" + newMember, new Exception("trace")); } @@ -241,8 +243,8 @@ public final class Topology { private void sendMemberUp(final String nodeId, final TopologyMemberImpl memberToSend) { final ArrayList<ClusterTopologyListener> copy = copyListeners(); - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace(this + "::prepare to send " + nodeId + " to " + copy.size() + " elements"); + if (logger.isTraceEnabled()) { + logger.trace(this + "::prepare to send " + nodeId + " to " + copy.size() + " elements"); } if (copy.size() > 0) { @@ -250,8 +252,8 @@ public final class Topology { @Override public void run() { for (ClusterTopologyListener listener : copy) { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace(Topology.this + " informing " + + if (logger.isTraceEnabled()) { + logger.trace(Topology.this + " informing " + listener + " about node up = " + nodeId + @@ -289,7 +291,7 @@ public final class Topology { member = topology.get(nodeId); if (member != null) { if (member.getUniqueEventID() > uniqueEventID) { - ActiveMQClientLogger.LOGGER.debug("The removeMember was issued before the node " + nodeId + " was started, ignoring call"); + logger.debug("The removeMember was issued before the node " + nodeId + " was started, ignoring call"); member = null; } else { @@ -299,8 +301,8 @@ public final class Topology { } } - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("removeMember " + this + + if (logger.isTraceEnabled()) { + logger.trace("removeMember " + this + " removing nodeID=" + nodeId + ", result=" + @@ -316,8 +318,8 @@ public final class Topology { @Override public void run() { for (ClusterTopologyListener listener : copy) { - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace(this + " informing " + listener + " about node down = " + nodeId); + if (logger.isTraceEnabled()) { + logger.trace(this + " informing " + listener + " about node down = " + nodeId); } try { listener.nodeDown(uniqueEventID, nodeId); @@ -333,8 +335,8 @@ public final class Topology { } public synchronized void sendTopology(final ClusterTopologyListener listener) { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug(this + " is sending topology to " + listener); + if (logger.isDebugEnabled()) { + logger.debug(this + " is sending topology to " + listener); } executor.execute(new Runnable() { @@ -349,8 +351,8 @@ public final class Topology { } for (Map.Entry<String, TopologyMemberImpl> entry : copy.entrySet()) { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug(Topology.this + " sending " + + if (logger.isDebugEnabled()) { + logger.debug(Topology.this + " sending " + entry.getKey() + " / " + entry.getValue().getConnector() + http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java index 40b48a6..4c3fdb9 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java @@ -36,6 +36,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQComponent; import org.apache.activemq.artemis.core.server.management.Notification; import org.apache.activemq.artemis.core.server.management.NotificationService; import org.apache.activemq.artemis.utils.TypedProperties; +import org.jboss.logging.Logger; /** * This class is used to search for members on the cluster through the opaque interface {@link BroadcastEndpoint}. @@ -47,7 +48,7 @@ import org.apache.activemq.artemis.utils.TypedProperties; */ public final class DiscoveryGroup implements ActiveMQComponent { - private static final boolean isTrace = ActiveMQClientLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(DiscoveryGroup.class); private final List<DiscoveryListener> listeners = new ArrayList<>(); @@ -317,10 +318,10 @@ public final class DiscoveryGroup implements ActiveMQComponent { //only call the listeners if we have changed //also make sure that we aren't stopping to avoid deadlock if (changed && started) { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Connectors changed on Discovery:"); + if (logger.isTraceEnabled()) { + logger.trace("Connectors changed on Discovery:"); for (DiscoveryEntry connector : connectors.values()) { - ActiveMQClientLogger.LOGGER.trace(connector); + logger.trace(connector); } } callListeners(); @@ -376,8 +377,8 @@ public final class DiscoveryGroup implements ActiveMQComponent { Map.Entry<String, DiscoveryEntry> entry = iter.next(); if (entry.getValue().getLastUpdate() + timeout <= now) { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Timed out node on discovery:" + entry.getValue()); + if (logger.isTraceEnabled()) { + logger.trace("Timed out node on discovery:" + entry.getValue()); } iter.remove(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java index 0dbda12..30a0b7a 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java @@ -32,7 +32,6 @@ import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; -import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; import org.apache.activemq.artemis.core.client.ActiveMQClientMessageBundle; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal; import org.apache.activemq.artemis.core.protocol.ClientPacketDecoder; @@ -59,6 +58,7 @@ import org.apache.activemq.artemis.spi.core.remoting.Connection; import org.apache.activemq.artemis.spi.core.remoting.TopologyResponseHandler; import org.apache.activemq.artemis.spi.core.remoting.SessionContext; import org.apache.activemq.artemis.utils.VersionLoader; +import org.jboss.logging.Logger; /** * This class will return specific packets for different types of actions happening on a messaging protocol. @@ -74,6 +74,8 @@ import org.apache.activemq.artemis.utils.VersionLoader; public class ActiveMQClientProtocolManager implements ClientProtocolManager { + private static final Logger logger = Logger.getLogger(ActiveMQClientProtocolManager.class); + private static final String handshake = "ARTEMIS"; private final int versionID = VersionLoader.getVersion().getIncrementingVersion(); @@ -504,8 +506,8 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager { } if (topMessage.isExit()) { - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { - ActiveMQClientLogger.LOGGER.debug("Notifying " + topMessage.getNodeID() + " going down"); + if (logger.isDebugEnabled()) { + logger.debug("Notifying " + topMessage.getNodeID() + " going down"); } if (topologyResponseHandler != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java index 7ec18f5..794df52 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java @@ -101,6 +101,7 @@ import org.apache.activemq.artemis.spi.core.remoting.ReadyListener; import org.apache.activemq.artemis.spi.core.remoting.SessionContext; import org.apache.activemq.artemis.utils.TokenBucketLimiterImpl; import org.apache.activemq.artemis.utils.VersionLoader; +import org.jboss.logging.Logger; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DISCONNECT_CONSUMER; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.EXCEPTION; @@ -110,6 +111,8 @@ import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SES public class ActiveMQSessionContext extends SessionContext { + private static final Logger logger = Logger.getLogger(ActiveMQSessionContext.class); + private final Channel sessionChannel; private final int serverVersion; private int confirmationWindow; @@ -340,8 +343,8 @@ public class ActiveMQSessionContext extends SessionContext { throw new XAException(response.getResponseCode()); } - if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { - ActiveMQClientLogger.LOGGER.trace("finished commit on " + ClientSessionImpl.convert(xid) + " with response = " + response); + if (logger.isTraceEnabled()) { + logger.trace("finished commit on " + ClientSessionImpl.convert(xid) + " with response = " + response); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java index 5dc4bc5..957a3a9 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java @@ -39,8 +39,10 @@ import org.apache.activemq.artemis.core.protocol.core.Packet; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.PacketsConfirmedMessage; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; +import org.jboss.logging.Logger; public final class ChannelImpl implements Channel { + private static final Logger logger = Logger.getLogger(ChannelImpl.class); public enum CHANNEL_ID { /** @@ -79,8 +81,6 @@ public final class ChannelImpl implements Channel { } } - private static final boolean isTrace = ActiveMQClientLogger.LOGGER.isTraceEnabled(); - private volatile long id; /** This is used in */ @@ -242,8 +242,8 @@ public final class ChannelImpl implements Channel { synchronized (sendLock) { packet.setChannelID(id); - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Sending packet nonblocking " + packet + " on channeID=" + id); + if (logger.isTraceEnabled()) { + logger.trace("Sending packet nonblocking " + packet + " on channeID=" + id); } ActiveMQBuffer buffer = packet.encode(connection); @@ -258,7 +258,7 @@ public final class ChannelImpl implements Channel { } else { if (!failoverCondition.await(connection.getBlockingCallFailoverTimeout(), TimeUnit.MILLISECONDS)) { - ActiveMQClientLogger.LOGGER.debug("timed-out waiting for fail-over condition on non-blocking send"); + logger.debug("timed-out waiting for fail-over condition on non-blocking send"); } } } @@ -280,8 +280,8 @@ public final class ChannelImpl implements Channel { lock.unlock(); } - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Writing buffer for channelID=" + id); + if (logger.isTraceEnabled()) { + logger.trace("Writing buffer for channelID=" + id); } checkReconnectID(reconnectID); @@ -346,7 +346,7 @@ public final class ChannelImpl implements Channel { } else { if (!failoverCondition.await(connection.getBlockingCallFailoverTimeout(), TimeUnit.MILLISECONDS)) { - ActiveMQClientLogger.LOGGER.debug("timed-out waiting for fail-over condition on blocking send"); + logger.debug("timed-out waiting for fail-over condition on blocking send"); } } } @@ -427,12 +427,12 @@ public final class ChannelImpl implements Channel { try { boolean callNext = interceptor.intercept(packet, connection); - if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { + if (logger.isDebugEnabled()) { // use a StringBuilder for speed since this may be executed a lot StringBuilder msg = new StringBuilder(); msg.append("Invocation of interceptor ").append(interceptor.getClass().getName()).append(" on "). append(packet).append(" returned ").append(callNext); - ActiveMQClientLogger.LOGGER.debug(msg.toString()); + logger.debug(msg.toString()); } if (!callNext) { @@ -505,8 +505,8 @@ public final class ChannelImpl implements Channel { @Override public void replayCommands(final int otherLastConfirmedCommandID) { if (resendCache != null) { - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Replaying commands on channelID=" + id); + if (logger.isTraceEnabled()) { + logger.trace("Replaying commands on channelID=" + id); } clearUpTo(otherLastConfirmedCommandID); @@ -553,8 +553,8 @@ public final class ChannelImpl implements Channel { confirmed.setChannelID(id); - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("ChannelImpl::flushConfirmation flushing confirmation " + confirmed); + if (logger.isTraceEnabled()) { + logger.trace("ChannelImpl::flushConfirmation flushing confirmation " + confirmed); } doWrite(confirmed); @@ -566,8 +566,8 @@ public final class ChannelImpl implements Channel { if (resendCache != null && packet.isRequiresConfirmations()) { lastConfirmedCommandID.incrementAndGet(); - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("ChannelImpl::confirming packet " + packet + " last commandID=" + lastConfirmedCommandID); + if (logger.isTraceEnabled()) { + logger.trace("ChannelImpl::confirming packet " + packet + " last commandID=" + lastConfirmedCommandID); } receivedBytes += packet.getPacketSize(); @@ -639,16 +639,16 @@ public final class ChannelImpl implements Channel { private void addResendPacket(Packet packet) { resendCache.add(packet); - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("ChannelImpl::addResendPacket adding packet " + packet + " stored commandID=" + firstStoredCommandID + " possible commandIDr=" + (firstStoredCommandID + resendCache.size())); + if (logger.isTraceEnabled()) { + logger.trace("ChannelImpl::addResendPacket adding packet " + packet + " stored commandID=" + firstStoredCommandID + " possible commandIDr=" + (firstStoredCommandID + resendCache.size())); } } private void clearUpTo(final int lastReceivedCommandID) { final int numberToClear = 1 + lastReceivedCommandID - firstStoredCommandID; - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("ChannelImpl::clearUpTo lastReceived commandID=" + lastReceivedCommandID + + if (logger.isTraceEnabled()) { + logger.trace("ChannelImpl::clearUpTo lastReceived commandID=" + lastReceivedCommandID + " first commandID=" + firstStoredCommandID + " number to clear " + numberToClear); } @@ -662,8 +662,8 @@ public final class ChannelImpl implements Channel { return; } - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("ChannelImpl::clearUpTo confirming " + packet + " towards " + commandConfirmationHandler); + if (logger.isTraceEnabled()) { + logger.trace("ChannelImpl::clearUpTo confirming " + packet + " towards " + commandConfirmationHandler); } if (commandConfirmationHandler != null) { commandConfirmationHandler.commandConfirmed(packet); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java index 1cb4f2a..b051519 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java @@ -38,18 +38,11 @@ import org.apache.activemq.artemis.core.security.ActiveMQPrincipal; import org.apache.activemq.artemis.spi.core.protocol.AbstractRemotingConnection; import org.apache.activemq.artemis.spi.core.remoting.Connection; import org.apache.activemq.artemis.utils.SimpleIDGenerator; +import org.jboss.logging.Logger; public class RemotingConnectionImpl extends AbstractRemotingConnection implements CoreRemotingConnection { - // Constants - // ------------------------------------------------------------------------------------ + private static final Logger logger = Logger.getLogger(RemotingConnectionImpl.class); - private static final boolean isTrace = ActiveMQClientLogger.LOGGER.isTraceEnabled(); - - // Static - // --------------------------------------------------------------------------------------- - - // Attributes - // ----------------------------------------------------------------------------------- private final PacketDecoder packetDecoder; private final Map<Long, Channel> channels = new ConcurrentHashMap<>(); @@ -342,8 +335,8 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement try { final Packet packet = packetDecoder.decode(buffer); - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("handling packet " + packet); + if (logger.isTraceEnabled()) { + logger.trace("handling packet " + packet); } dataReceived = true; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java index 6853b79..b209f89 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java @@ -101,10 +101,12 @@ import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManager; import org.apache.activemq.artemis.spi.core.remoting.Connection; import org.apache.activemq.artemis.utils.ConfigurationHelper; import org.apache.activemq.artemis.utils.FutureLatch; +import org.jboss.logging.Logger; import static org.apache.activemq.artemis.utils.Base64.encodeBytes; public class NettyConnector extends AbstractConnector { + private static final Logger logger = Logger.getLogger(NettyConnector.class); // Constants ----------------------------------------------------- public static final String JAVAX_KEYSTORE_PATH_PROP_NAME = "javax.net.ssl.keyStore"; @@ -528,7 +530,7 @@ public class NettyConnector extends AbstractConnector { batchFlusherFuture = scheduledThreadPool.scheduleWithFixedDelay(flusher, batchDelay, batchDelay, TimeUnit.MILLISECONDS); } - ActiveMQClientLogger.LOGGER.debug("Started Netty Connector version " + TransportConstants.NETTY_VERSION); + logger.debug("Started Netty Connector version " + TransportConstants.NETTY_VERSION); } @Override @@ -589,7 +591,7 @@ public class NettyConnector extends AbstractConnector { } } - ActiveMQClientLogger.LOGGER.debug("Remote destination: " + remoteDestination); + logger.debug("Remote destination: " + remoteDestination); ChannelFuture future; //port 0 does not work so only use local address if set @@ -659,7 +661,7 @@ public class NettyConnector extends AbstractConnector { request.headers().set(SEC_ACTIVEMQ_REMOTING_KEY, key); ch.attr(REMOTING_KEY).set(key); - ActiveMQClientLogger.LOGGER.debugf("Sending HTTP request %s", request); + logger.debugf("Sending HTTP request %s", request); // Send the HTTP request. ch.writeAndFlush(request); @@ -985,7 +987,7 @@ public class NettyConnector extends AbstractConnector { InetAddress inetAddr2 = InetAddress.getByName(this.host); String ip1 = inetAddr1.getHostAddress(); String ip2 = inetAddr2.getHostAddress(); - ActiveMQClientLogger.LOGGER.debug(this + " host 1: " + host + " ip address: " + ip1 + " host 2: " + this.host + " ip address: " + ip2); + logger.debug(this + " host 1: " + host + " ip address: " + ip1 + " host 2: " + this.host + " ip address: " + ip2); result = ip1.equals(ip2); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java index ee2449b..b7c0d17 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java @@ -30,9 +30,12 @@ import org.apache.activemq.artemis.core.remoting.CloseListener; import org.apache.activemq.artemis.core.remoting.FailureListener; import org.apache.activemq.artemis.spi.core.remoting.Connection; import org.apache.activemq.artemis.spi.core.remoting.ReadyListener; +import org.jboss.logging.Logger; public abstract class AbstractRemotingConnection implements RemotingConnection { + private static final Logger logger = Logger.getLogger(AbstractRemotingConnection.class); + protected final List<FailureListener> failureListeners = new CopyOnWriteArrayList<>(); protected final List<CloseListener> closeListeners = new CopyOnWriteArrayList<>(); protected final Connection transportConnection; @@ -65,7 +68,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { } catch (ActiveMQInterruptedException interrupted) { // this is an expected behaviour.. no warn or error here - ActiveMQClientLogger.LOGGER.debug("thread interrupted", interrupted); + logger.debug("thread interrupted", interrupted); } catch (final Throwable t) { // Failure of one listener to execute shouldn't prevent others http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java index b1e9d88..b0b13ae 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java @@ -23,12 +23,15 @@ import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; +import org.jboss.logging.Logger; /** * A factory for producing executors that run all tasks in order, which delegate to a single common executor instance. */ public final class OrderedExecutorFactory implements ExecutorFactory { + private static final Logger logger = Logger.getLogger(OrderedExecutorFactory.class); + private final Executor parent; /** @@ -101,7 +104,7 @@ public final class OrderedExecutorFactory implements ExecutorFactory { } catch (ActiveMQInterruptedException e) { // This could happen during shutdowns. Nothing to be concerned about here - ActiveMQClientLogger.LOGGER.debug("Interrupted Thread", e); + logger.debug("Interrupted Thread", e); } catch (Throwable t) { ActiveMQClientLogger.LOGGER.caughtunexpectedThrowable(t); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java index 4cfbfa4..6428c8a 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java @@ -28,11 +28,11 @@ import java.util.Set; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicLong; -import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; +import org.jboss.logging.Logger; public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implements Map<K, V> { - private final boolean isTrace = ActiveMQClientLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(SoftValueHashMap.class); // The soft references that are already good. // too bad there's no way to override the queue method on ReferenceQueue, so I wouldn't need this @@ -170,8 +170,8 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen if (ref.used > 0) { Object removed = mapDelegate.remove(ref.key); - if (isTrace) { - ActiveMQClientLogger.LOGGER.trace("Removing " + removed + " with id = " + ref.key + " from SoftValueHashMap"); + if (logger.isTraceEnabled()) { + logger.trace("Removing " + removed + " with id = " + ref.key + " from SoftValueHashMap"); } if (mapDelegate.size() <= maxElements) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec526935/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java index bd96a71..ca51c08 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java @@ -34,6 +34,7 @@ import java.util.List; import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; import org.apache.activemq.artemis.core.client.ActiveMQClientMessageBundle; +import org.jboss.logging.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -44,6 +45,8 @@ import org.xml.sax.SAXException; public final class XMLUtil { + private static final Logger logger = Logger.getLogger(XMLUtil.class); + private XMLUtil() { // Utility class } @@ -288,7 +291,7 @@ public final class XMLUtil { val = parts[1].trim(); } String sysProp = System.getProperty(prop, val); - ActiveMQClientLogger.LOGGER.debug("replacing " + subString + " with " + sysProp); + logger.debug("replacing " + subString + " with " + sysProp); xml = xml.replace(subString, sysProp); }
