ARTEMIS-2121 reload logging config at runtime Many thanks to James Perkins who supplied the guts of the reload logic.
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/cbace51d Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/cbace51d Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/cbace51d Branch: refs/heads/master Commit: cbace51d6ce067ab6fa745cd19ec8d14e1c80df1 Parents: 3cb5883 Author: Justin Bertram <[email protected]> Authored: Fri Sep 28 21:37:58 2018 -0500 Committer: Clebert Suconic <[email protected]> Committed: Thu Oct 11 11:28:25 2018 -0400 ---------------------------------------------------------------------- .../apache/activemq/artemis/utils/UTF8Util.java | 7 +- .../artemis/jms/bridge/impl/JMSBridgeImpl.java | 140 +++--- .../artemis/ra/ActiveMQRABytesMessage.java | 61 ++- .../ra/ActiveMQRAConnectionFactoryImpl.java | 59 ++- .../artemis/ra/ActiveMQRAConnectionManager.java | 10 +- .../ra/ActiveMQRAConnectionMetaData.java | 21 +- .../ra/ActiveMQRAConnectionRequestInfo.java | 33 +- .../artemis/ra/ActiveMQRACredential.java | 22 +- .../artemis/ra/ActiveMQRALocalTransaction.java | 13 +- .../artemis/ra/ActiveMQRAMCFProperties.java | 18 +- .../ra/ActiveMQRAManagedConnectionFactory.java | 52 +-- .../artemis/ra/ActiveMQRAMapMessage.java | 57 ++- .../activemq/artemis/ra/ActiveMQRAMessage.java | 111 +++-- .../artemis/ra/ActiveMQRAMessageConsumer.java | 33 +- .../artemis/ra/ActiveMQRAMessageListener.java | 9 +- .../artemis/ra/ActiveMQRAMessageProducer.java | 59 ++- .../activemq/artemis/ra/ActiveMQRAMetaData.java | 15 +- .../artemis/ra/ActiveMQRAObjectMessage.java | 11 +- .../artemis/ra/ActiveMQRAProperties.java | 19 +- .../artemis/ra/ActiveMQRAQueueReceiver.java | 9 +- .../artemis/ra/ActiveMQRAQueueSender.java | 17 +- .../activemq/artemis/ra/ActiveMQRASession.java | 175 ++++---- .../ra/ActiveMQRASessionFactoryImpl.java | 75 ++-- .../artemis/ra/ActiveMQRAStreamMessage.java | 55 ++- .../artemis/ra/ActiveMQRATextMessage.java | 11 +- .../artemis/ra/ActiveMQRATopicPublisher.java | 25 +- .../artemis/ra/ActiveMQRATopicSubscriber.java | 11 +- .../artemis/ra/ActiveMQRAXAResource.java | 27 +- .../artemis/ra/ConnectionFactoryProperties.java | 133 +++--- artemis-server/pom.xml | 1 - .../core/server/ActiveMQServerLogger.java | 12 +- .../LoggingConfigurationFileReloader.java | 86 ++++ .../server/LoggingConfigurationUpdater.java | 447 +++++++++++++++++++ .../core/server/impl/ActiveMQServerImpl.java | 11 + .../LoggingConfigurationFileReloaderTest.java | 117 +++++ .../test/resources/reload-logging-1.properties | 21 + .../test/resources/reload-logging-2.properties | 21 + .../xa/recovery/ActiveMQXAResourceRecovery.java | 4 +- 38 files changed, 1295 insertions(+), 713 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java ---------------------------------------------------------------------- diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java index afee81c..ec1c1b6 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java @@ -32,9 +32,6 @@ import org.apache.activemq.artemis.logs.ActiveMQUtilLogger; */ public final class UTF8Util { - - private static final boolean isTrace = ActiveMQUtilLogger.LOGGER.isTraceEnabled(); - private static final ThreadLocal<SoftReference<StringUtilBuffer>> currentBuffer = new ThreadLocal<>(); private UTF8Util() { @@ -88,7 +85,7 @@ public final class UTF8Util { final int stringLength = str.length(); - if (UTF8Util.isTrace) { + if (ActiveMQUtilLogger.LOGGER.isTraceEnabled()) { // This message is too verbose for debug, that's why we are using trace here ActiveMQUtilLogger.LOGGER.trace("Saving string with utfSize=" + len + " stringSize=" + stringLength); } @@ -186,7 +183,7 @@ public final class UTF8Util { final int size = input.readUnsignedShort(); - if (UTF8Util.isTrace) { + if (ActiveMQUtilLogger.LOGGER.isTraceEnabled()) { // This message is too verbose for debug, that's why we are using trace here ActiveMQUtilLogger.LOGGER.trace("Reading string with utfSize=" + size); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java ---------------------------------------------------------------------- diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java index 034af0e..da37079 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java @@ -75,8 +75,6 @@ public final class JMSBridgeImpl implements JMSBridge { private static final String[] RESOURCE_RECOVERY_CLASS_NAMES = new String[]{"org.jboss.as.messaging.jms.AS7RecoveryRegistry"}; - private static boolean trace = ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled(); - private static final int TEN_YEARS = 60 * 60 * 24 * 365 * 10; // in ms private static final long DEFAULT_FAILOVER_TIMEOUT = 60 * 1000; @@ -315,7 +313,7 @@ public final class JMSBridgeImpl implements JMSBridge { } } - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Created " + this); } } @@ -353,7 +351,7 @@ public final class JMSBridgeImpl implements JMSBridge { return; } - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Starting " + this); } @@ -416,7 +414,7 @@ public final class JMSBridgeImpl implements JMSBridge { started = true; if (maxBatchTime != -1) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Starting time checker thread"); } @@ -425,14 +423,14 @@ public final class JMSBridgeImpl implements JMSBridge { executor.execute(timeChecker); batchExpiryTime = System.currentTimeMillis() + maxBatchTime; - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Started time checker thread"); } } executor.execute(new SourceReceiver()); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Started " + this); } } @@ -460,7 +458,7 @@ public final class JMSBridgeImpl implements JMSBridge { } synchronized (this) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Stopping " + this); } if (!connectedSource && sourceConn != null) { @@ -483,7 +481,7 @@ public final class JMSBridgeImpl implements JMSBridge { if (tx != null) { // Terminate any transaction - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Rolling back remaining tx"); } @@ -493,12 +491,12 @@ public final class JMSBridgeImpl implements JMSBridge { tx.rollback(); abortedMessageCount += messages.size(); } catch (Exception ignore) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to rollback", ignore); } } - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Rolled back remaining tx"); } } @@ -506,7 +504,7 @@ public final class JMSBridgeImpl implements JMSBridge { try { sourceConn.close(); } catch (Exception ignore) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to close source conn", ignore); } } @@ -515,13 +513,13 @@ public final class JMSBridgeImpl implements JMSBridge { try { targetConn.close(); } catch (Exception ignore) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to close target conn", ignore); } } } - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Stopped " + this); } } @@ -554,7 +552,7 @@ public final class JMSBridgeImpl implements JMSBridge { @Override public synchronized void pause() throws Exception { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Pausing " + this); } @@ -564,14 +562,14 @@ public final class JMSBridgeImpl implements JMSBridge { sourceConn.stop(); } - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Paused " + this); } } @Override public synchronized void resume() throws Exception { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Resuming " + this); } @@ -581,7 +579,7 @@ public final class JMSBridgeImpl implements JMSBridge { sourceConn.start(); } - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Resumed " + this); } } @@ -872,7 +870,7 @@ public final class JMSBridgeImpl implements JMSBridge { } private void enlistResources(final Transaction tx) throws Exception { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Enlisting resources in tx"); } @@ -884,13 +882,13 @@ public final class JMSBridgeImpl implements JMSBridge { tx.enlistResource(resDest); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Enlisted resources in tx"); } } private void delistResources(final Transaction tx) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Delisting resources from tx"); } @@ -899,7 +897,7 @@ public final class JMSBridgeImpl implements JMSBridge { try { tx.delistResource(resSource, XAResource.TMSUCCESS); } catch (Exception e) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to delist source resource", e); } } @@ -909,18 +907,18 @@ public final class JMSBridgeImpl implements JMSBridge { try { tx.delistResource(resDest, XAResource.TMSUCCESS); } catch (Exception e) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to delist target resource", e); } } - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Delisted resources from tx"); } } private Transaction startTx() throws Exception { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Starting JTA transaction"); } @@ -941,7 +939,7 @@ public final class JMSBridgeImpl implements JMSBridge { tm.suspend(); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Started JTA transaction"); } @@ -970,24 +968,24 @@ public final class JMSBridgeImpl implements JMSBridge { if (username == null) { if (isXA) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating an XA connection"); } conn = ((XAConnectionFactory) cf).createXAConnection(); } else { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating a non XA connection"); } conn = ((ConnectionFactory) cf).createConnection(); } } else { if (isXA) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating an XA connection"); } conn = ((XAConnectionFactory) cf).createXAConnection(username, password); } else { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating a non XA connection"); } conn = ((ConnectionFactory) cf).createConnection(username, password); @@ -1092,14 +1090,14 @@ public final class JMSBridgeImpl implements JMSBridge { // QoS = ONCE_AND_ONLY_ONCE if (forwardMode == JMSBridgeImpl.FORWARD_MODE_XA) { // Create an XASession for consuming from the source - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating XA source session"); } sourceConn = createConnection(sourceUsername, sourcePassword, sourceCff, clientID, true, true); sourceSession = ((XAConnection) sourceConn).createXASession(); } else { // QoS = DUPLICATES_OK || AT_MOST_ONCE - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating non XA source session"); } @@ -1136,7 +1134,7 @@ public final class JMSBridgeImpl implements JMSBridge { } else { // bridging across different servers // QoS = ONCE_AND_ONLY_ONCE if (forwardMode == JMSBridgeImpl.FORWARD_MODE_XA) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating XA dest session"); } @@ -1146,7 +1144,7 @@ public final class JMSBridgeImpl implements JMSBridge { targetSession = ((XAConnection) targetConn).createXASession(); } else { // QoS = DUPLICATES_OK || AT_MOST_ONCE - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Creating non XA dest session"); } @@ -1163,7 +1161,7 @@ public final class JMSBridgeImpl implements JMSBridge { } if (forwardMode == JMSBridgeImpl.FORWARD_MODE_XA) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Starting JTA transaction"); } @@ -1194,7 +1192,7 @@ public final class JMSBridgeImpl implements JMSBridge { try { sourceConn.stop(); } catch (Throwable ignore) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to stop source connection", ignore); } } @@ -1203,7 +1201,7 @@ public final class JMSBridgeImpl implements JMSBridge { try { delistResources(tx); } catch (Throwable ignore) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to delist resources", ignore); } } @@ -1212,7 +1210,7 @@ public final class JMSBridgeImpl implements JMSBridge { tx.rollback(); abortedMessageCount += messages.size(); } catch (Throwable ignore) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to rollback", ignore); } } @@ -1222,7 +1220,7 @@ public final class JMSBridgeImpl implements JMSBridge { try { sourceConn.close(); } catch (Throwable ignore) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to close source connection", ignore); } } @@ -1231,7 +1229,7 @@ public final class JMSBridgeImpl implements JMSBridge { targetConn.close(); } } catch (Throwable ignore) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failed to close target connection", ignore); } } @@ -1248,7 +1246,7 @@ public final class JMSBridgeImpl implements JMSBridge { } private boolean setupJMSObjectsWithRetry() { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Setting up connections"); } @@ -1277,13 +1275,13 @@ public final class JMSBridgeImpl implements JMSBridge { } private void sendBatch() { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Sending batch of " + messages.size() + " messages"); } if (paused) { // Don't send now - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Paused, so not sending now"); } @@ -1304,13 +1302,13 @@ public final class JMSBridgeImpl implements JMSBridge { if (qualityOfServiceMode == QualityOfServiceMode.ONCE_AND_ONLY_ONCE || (qualityOfServiceMode == QualityOfServiceMode.AT_MOST_ONCE && maxBatchSize > 1)) { // We client ack before sending - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Client acking source session"); } messages.getLast().acknowledge(); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Client acked source session"); } } @@ -1331,13 +1329,13 @@ public final class JMSBridgeImpl implements JMSBridge { if (maxBatchSize > 1) { // The sending session is transacted - we need to commit it - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Committing target session"); } targetSession.commit(); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Committed target session"); } } @@ -1348,13 +1346,13 @@ public final class JMSBridgeImpl implements JMSBridge { // Note we could actually use Session.DUPS_OK_ACKNOWLEDGE here // For a slightly less strong delivery guarantee - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Client acking source session"); } messages.getLast().acknowledge(); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Client acked source session"); } } @@ -1387,13 +1385,13 @@ public final class JMSBridgeImpl implements JMSBridge { // Commit the JTA transaction and start another delistResources(tx); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Committing JTA transaction"); } tx.commit(); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Committed JTA transaction"); } } catch (Exception e) { @@ -1431,13 +1429,13 @@ public final class JMSBridgeImpl implements JMSBridge { try { sendMessages(); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Committing source session"); } sourceSession.commit(); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Committed source session"); } @@ -1471,7 +1469,7 @@ public final class JMSBridgeImpl implements JMSBridge { addMessageIDInHeader(msg); } - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Sending message " + msg); } @@ -1490,7 +1488,7 @@ public final class JMSBridgeImpl implements JMSBridge { targetProducer.send(targetDestination, msg, msg.getJMSDeliveryMode(), msg.getJMSPriority(), timeToLive); messageCount++; - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Sent message " + msg); } } @@ -1521,7 +1519,7 @@ public final class JMSBridgeImpl implements JMSBridge { // Each bridge (if there are more than one) in the chain can concatenate the message id // So in the case of multiple bridges having routed the message this can be used in a multi-hop // distributed request/response - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Adding old message id in Message header"); } @@ -1654,7 +1652,7 @@ public final class JMSBridgeImpl implements JMSBridge { ((ActiveMQMessage) msg).checkBuffer(); } } catch (JMSException jmse) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " exception while receiving a message", jmse); } } @@ -1663,7 +1661,7 @@ public final class JMSBridgeImpl implements JMSBridge { try { lock.wait(500); } catch (InterruptedException e) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " thread was interrupted"); } if (stopping) { @@ -1674,7 +1672,7 @@ public final class JMSBridgeImpl implements JMSBridge { continue; } - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " received message " + msg); } @@ -1682,18 +1680,18 @@ public final class JMSBridgeImpl implements JMSBridge { batchExpiryTime = System.currentTimeMillis() + maxBatchTime; - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " rescheduled batchExpiryTime to " + batchExpiryTime); } if (maxBatchSize != -1 && messages.size() >= maxBatchSize) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " maxBatchSize has been reached so sending batch"); } sendBatch(); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " sent batch"); } } @@ -1739,7 +1737,7 @@ public final class JMSBridgeImpl implements JMSBridge { @Override public void run() { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failure handler running"); } @@ -1803,7 +1801,7 @@ public final class JMSBridgeImpl implements JMSBridge { @Override public void run() { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " running"); } @@ -1812,19 +1810,19 @@ public final class JMSBridgeImpl implements JMSBridge { long toWait = batchExpiryTime - System.currentTimeMillis(); if (toWait <= 0) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " waited enough"); } synchronized (lock) { if (!failed && !messages.isEmpty()) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " got some messages so sending batch"); } sendBatch(); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " sent batch"); } } @@ -1833,17 +1831,17 @@ public final class JMSBridgeImpl implements JMSBridge { batchExpiryTime = System.currentTimeMillis() + maxBatchTime; } else { try { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " waiting for " + toWait); } lock.wait(toWait); - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " woke up"); } } catch (InterruptedException e) { - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace(this + " thread was interrupted"); } if (stopping) { @@ -1888,7 +1886,7 @@ public final class JMSBridgeImpl implements JMSBridge { } if (failed) { // The failure has already been detected and is being handled - if (JMSBridgeImpl.trace) { + if (ActiveMQJMSBridgeLogger.LOGGER.isTraceEnabled()) { ActiveMQJMSBridgeLogger.LOGGER.trace("Failure recovery already in progress"); } } else { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java index 6e38088..f18e1fa 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRABytesMessage.java @@ -26,11 +26,6 @@ import java.util.Arrays; public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMessage { /** - * Whether trace is enabled - */ - private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled(); - - /** * Create a new wrapper * * @param message the message @@ -39,7 +34,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe public ActiveMQRABytesMessage(final BytesMessage message, final ActiveMQRASession session) { super(message, session); - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor(" + message + ", " + session + ")"); } } @@ -52,7 +47,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public long getBodyLength() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getBodyLength()"); } @@ -67,7 +62,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public boolean readBoolean() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readBoolean()"); } @@ -82,7 +77,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public byte readByte() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readByte()"); } @@ -99,7 +94,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public int readBytes(final byte[] value, final int length) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readBytes(" + Arrays.toString(value) + ", " + length + ")"); } @@ -115,7 +110,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public int readBytes(final byte[] value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readBytes(" + Arrays.toString(value) + ")"); } @@ -130,7 +125,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public char readChar() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readChar()"); } @@ -145,7 +140,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public double readDouble() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readDouble()"); } @@ -160,7 +155,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public float readFloat() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readFloat()"); } @@ -175,7 +170,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public int readInt() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readInt()"); } @@ -190,7 +185,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public long readLong() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readLong()"); } @@ -205,7 +200,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public short readShort() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readShort()"); } @@ -220,7 +215,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public int readUnsignedByte() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readUnsignedByte()"); } @@ -235,7 +230,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public int readUnsignedShort() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readUnsignedShort()"); } @@ -250,7 +245,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public String readUTF() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("readUTF()"); } @@ -264,7 +259,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void reset() throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("reset()"); } @@ -279,7 +274,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeBoolean(final boolean value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeBoolean(" + value + ")"); } @@ -294,7 +289,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeByte(final byte value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeByte(" + value + ")"); } @@ -311,7 +306,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeBytes(final byte[] value, final int offset, final int length) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeBytes(" + Arrays.toString(value) + ", " + offset + ", " + length + ")"); } @@ -326,7 +321,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeBytes(final byte[] value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeBytes(" + Arrays.toString(value) + ")"); } @@ -341,7 +336,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeChar(final char value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeChar(" + value + ")"); } @@ -356,7 +351,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeDouble(final double value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeDouble(" + value + ")"); } @@ -371,7 +366,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeFloat(final float value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeFloat(" + value + ")"); } @@ -386,7 +381,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeInt(final int value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeInt(" + value + ")"); } @@ -401,7 +396,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeLong(final long value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeLong(" + value + ")"); } @@ -416,7 +411,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeObject(final Object value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeObject(" + value + ")"); } @@ -431,7 +426,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeShort(final short value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeShort(" + value + ")"); } @@ -446,7 +441,7 @@ public class ActiveMQRABytesMessage extends ActiveMQRAMessage implements BytesMe */ @Override public void writeUTF(final String value) throws JMSException { - if (ActiveMQRABytesMessage.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("writeUTF(" + value + ")"); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java index e3c4c9d..00ac5a9 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionFactoryImpl.java @@ -47,7 +47,6 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact * Serial version UID */ static final long serialVersionUID = 7981708919479859360L; - private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled(); /** * The managed connection factory @@ -71,7 +70,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact * @param cm The connection manager */ public ActiveMQRAConnectionFactoryImpl(final ActiveMQRAManagedConnectionFactory mcf, final ConnectionManager cm) { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor(" + mcf + ", " + cm + ")"); } @@ -80,14 +79,14 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact if (cm == null) { // This is standalone usage, no appserver this.cm = new ActiveMQRAConnectionManager(); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created new ConnectionManager=" + this.cm); } } else { this.cm = cm; } - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Using ManagedConnectionFactory=" + mcf + ", ConnectionManager=" + cm); } } @@ -99,7 +98,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public void setReference(final Reference reference) { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setReference(" + reference + ")"); } @@ -113,7 +112,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public Reference getReference() { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getReference()"); } if (reference == null) { @@ -136,13 +135,13 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public QueueConnection createQueueConnection() throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createQueueConnection()"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.QUEUE_CONNECTION); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s); } @@ -159,7 +158,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public QueueConnection createQueueConnection(final String userName, final String password) throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createQueueConnection(" + userName + ", ****)"); } @@ -169,7 +168,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact validateUser(s); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s); } @@ -184,13 +183,13 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public TopicConnection createTopicConnection() throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createTopicConnection()"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.TOPIC_CONNECTION); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created topic connection: " + s); } @@ -207,7 +206,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public TopicConnection createTopicConnection(final String userName, final String password) throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createTopicConnection(" + userName + ", ****)"); } @@ -216,7 +215,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact s.setPassword(password); validateUser(s); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created topic connection: " + s); } @@ -231,13 +230,13 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public Connection createConnection() throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createConnection()"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.CONNECTION); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created connection: " + s); } @@ -254,7 +253,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public Connection createConnection(final String userName, final String password) throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createConnection(" + userName + ", ****)"); } @@ -264,7 +263,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact validateUser(s); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created connection: " + s); } @@ -279,13 +278,13 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public XAQueueConnection createXAQueueConnection() throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createXAQueueConnection()"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s); } @@ -302,7 +301,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public XAQueueConnection createXAQueueConnection(final String userName, final String password) throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createXAQueueConnection(" + userName + ", ****)"); } @@ -311,7 +310,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact s.setPassword(password); validateUser(s); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s); } @@ -326,13 +325,13 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public XATopicConnection createXATopicConnection() throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createXATopicConnection()"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created topic connection: " + s); } @@ -349,7 +348,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public XATopicConnection createXATopicConnection(final String userName, final String password) throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createXATopicConnection(" + userName + ", ****)"); } @@ -358,7 +357,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact s.setPassword(password); validateUser(s); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created topic connection: " + s); } @@ -373,13 +372,13 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public XAConnection createXAConnection() throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createXAConnection()"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.XA_CONNECTION); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created connection: " + s); } @@ -396,7 +395,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact */ @Override public XAConnection createXAConnection(final String userName, final String password) throws JMSException { - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createXAConnection(" + userName + ", ****)"); } @@ -405,7 +404,7 @@ public class ActiveMQRAConnectionFactoryImpl implements ActiveMQRAConnectionFact s.setPassword(password); validateUser(s); - if (ActiveMQRAConnectionFactoryImpl.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created connection: " + s); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java index bfdd0c9..b82c911 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java @@ -33,16 +33,12 @@ public class ActiveMQRAConnectionManager implements ConnectionManager { * Serial version UID */ static final long serialVersionUID = 4409118162975011014L; - /** - * Trace enabled - */ - private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled(); /** * Constructor */ public ActiveMQRAConnectionManager() { - if (ActiveMQRAConnectionManager.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor()"); } } @@ -60,14 +56,14 @@ public class ActiveMQRAConnectionManager implements ConnectionManager { @Override public Object allocateConnection(final ManagedConnectionFactory mcf, final ConnectionRequestInfo cxRequestInfo) throws ResourceException { - if (ActiveMQRAConnectionManager.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("allocateConnection(" + mcf + ", " + cxRequestInfo + ")"); } ManagedConnection mc = mcf.createManagedConnection(null, cxRequestInfo); Object c = mc.getConnection(null, cxRequestInfo); - if (ActiveMQRAConnectionManager.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Allocated connection: " + c + ", with managed connection: " + mc); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java index 88da41c..901ecf4 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java @@ -26,15 +26,10 @@ import java.util.Vector; public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { /** - * Trace enabled - */ - private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled(); - - /** * Constructor */ public ActiveMQRAConnectionMetaData() { - if (ActiveMQRAConnectionMetaData.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor()"); } } @@ -46,7 +41,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { */ @Override public String getJMSVersion() { - if (ActiveMQRAConnectionMetaData.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getJMSVersion()"); } @@ -60,7 +55,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { */ @Override public int getJMSMajorVersion() { - if (ActiveMQRAConnectionMetaData.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getJMSMajorVersion()"); } @@ -74,7 +69,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { */ @Override public int getJMSMinorVersion() { - if (ActiveMQRAConnectionMetaData.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getJMSMinorVersion()"); } @@ -88,7 +83,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { */ @Override public String getJMSProviderName() { - if (ActiveMQRAConnectionMetaData.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getJMSProviderName()"); } @@ -102,7 +97,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { */ @Override public String getProviderVersion() { - if (ActiveMQRAConnectionMetaData.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getJMSProviderName()"); } @@ -116,7 +111,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { */ @Override public int getProviderMajorVersion() { - if (ActiveMQRAConnectionMetaData.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getProviderMajorVersion()"); } @@ -130,7 +125,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { */ @Override public int getProviderMinorVersion() { - if (ActiveMQRAConnectionMetaData.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getProviderMinorVersion()"); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java index 29a4c2d..9ed7a45 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionRequestInfo.java @@ -25,11 +25,6 @@ import javax.resource.spi.ConnectionRequestInfo; public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { /** - * Trace enabled - */ - private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled(); - - /** * The user name */ private String userName; @@ -66,7 +61,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @param type The connection type */ public ActiveMQRAConnectionRequestInfo(final ActiveMQRAProperties prop, final int type) { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor(" + prop + ")"); } @@ -86,7 +81,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @param type The connection type */ public ActiveMQRAConnectionRequestInfo(final boolean transacted, final int acknowledgeMode, final int type) { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor(" + transacted + ", " + acknowledgeMode + @@ -106,7 +101,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @param prop The resource adapter properties */ public void setDefaults(final ActiveMQRAProperties prop) { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setDefaults(" + prop + ")"); } @@ -127,7 +122,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @return The value */ public String getUserName() { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getUserName()"); } @@ -140,7 +135,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @param userName The value */ public void setUserName(final String userName) { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setUserName(" + userName + ")"); } @@ -153,7 +148,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @return The value */ public String getPassword() { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getPassword()"); } @@ -166,7 +161,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @param password The value */ public void setPassword(final String password) { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setPassword(****)"); } @@ -179,7 +174,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @return The value */ public String getClientID() { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getClientID()"); } @@ -192,7 +187,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @param clientID The value */ public void setClientID(final String clientID) { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setClientID(" + clientID + ")"); } @@ -205,7 +200,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @return The type */ public int getType() { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getType()"); } @@ -218,7 +213,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @return True if transacted; otherwise false */ public boolean isTransacted() { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("isTransacted() " + transacted); } @@ -231,7 +226,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { * @return The mode */ public int getAcknowledgeMode() { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getAcknowledgeMode()"); } @@ -246,7 +241,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { */ @Override public boolean equals(final Object obj) { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("equals(" + obj + ")"); } @@ -273,7 +268,7 @@ public class ActiveMQRAConnectionRequestInfo implements ConnectionRequestInfo { */ @Override public int hashCode() { - if (ActiveMQRAConnectionRequestInfo.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("hashCode()"); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java index ee04949..f016d7a 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRACredential.java @@ -36,8 +36,6 @@ public class ActiveMQRACredential implements Serializable { */ static final long serialVersionUID = 210476602237497193L; - private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled(); - /** * The user name */ @@ -52,7 +50,7 @@ public class ActiveMQRACredential implements Serializable { * Private constructor */ private ActiveMQRACredential() { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor()"); } } @@ -63,7 +61,7 @@ public class ActiveMQRACredential implements Serializable { * @return The value */ public String getUserName() { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getUserName()"); } @@ -76,7 +74,7 @@ public class ActiveMQRACredential implements Serializable { * @param userName The value */ private void setUserName(final String userName) { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setUserName(" + userName + ")"); } @@ -89,7 +87,7 @@ public class ActiveMQRACredential implements Serializable { * @return The value */ public String getPassword() { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getPassword()"); } @@ -102,7 +100,7 @@ public class ActiveMQRACredential implements Serializable { * @param password The value */ private void setPassword(final String password) { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setPassword(****)"); } @@ -121,7 +119,7 @@ public class ActiveMQRACredential implements Serializable { public static ActiveMQRACredential getCredential(final ManagedConnectionFactory mcf, final Subject subject, final ConnectionRequestInfo info) throws SecurityException { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getCredential(" + mcf + ", " + subject + ", " + info + ")"); } @@ -152,7 +150,7 @@ public class ActiveMQRACredential implements Serializable { */ @Override public String toString() { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("toString()"); } @@ -181,7 +179,7 @@ public class ActiveMQRACredential implements Serializable { * @param mcf The managed connection factory */ GetCredentialAction(final Subject subject, final ManagedConnectionFactory mcf) { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor(" + subject + ", " + mcf + ")"); } @@ -196,7 +194,7 @@ public class ActiveMQRACredential implements Serializable { */ @Override public PasswordCredential run() { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("run()"); } @@ -220,7 +218,7 @@ public class ActiveMQRACredential implements Serializable { * @return The credential */ static PasswordCredential getCredential(final Subject subject, final ManagedConnectionFactory mcf) { - if (ActiveMQRACredential.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getCredential(" + subject + ", " + mcf + ")"); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java index 342a27f..ceab94a 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALocalTransaction.java @@ -26,11 +26,6 @@ import javax.resource.spi.LocalTransaction; public class ActiveMQRALocalTransaction implements LocalTransaction { /** - * Trace enabled - */ - private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled(); - - /** * The managed connection */ private final ActiveMQRAManagedConnection mc; @@ -41,7 +36,7 @@ public class ActiveMQRALocalTransaction implements LocalTransaction { * @param mc The managed connection */ public ActiveMQRALocalTransaction(final ActiveMQRAManagedConnection mc) { - if (ActiveMQRALocalTransaction.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor(" + mc + ")"); } @@ -55,7 +50,7 @@ public class ActiveMQRALocalTransaction implements LocalTransaction { */ @Override public void begin() throws ResourceException { - if (ActiveMQRALocalTransaction.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("begin()"); } @@ -69,7 +64,7 @@ public class ActiveMQRALocalTransaction implements LocalTransaction { */ @Override public void commit() throws ResourceException { - if (ActiveMQRALocalTransaction.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("commit()"); } @@ -93,7 +88,7 @@ public class ActiveMQRALocalTransaction implements LocalTransaction { */ @Override public void rollback() throws ResourceException { - if (ActiveMQRALocalTransaction.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("rollback()"); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java index 30923fd..f6dc92b 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMCFProperties.java @@ -29,10 +29,6 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme * Serial version UID */ static final long serialVersionUID = -5951352236582886862L; - /** - * Trace enabled - */ - private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled(); /** * The queue type @@ -63,7 +59,7 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme * Constructor */ public ActiveMQRAMCFProperties() { - if (ActiveMQRAMCFProperties.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor()"); } @@ -76,7 +72,7 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme * @return The type */ public int getType() { - if (ActiveMQRAMCFProperties.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getType()"); } @@ -88,7 +84,7 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme } public void setConnectorClassName(final String connectorClassName) { - if (ActiveMQRAMCFProperties.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setConnectorClassName(" + connectorClassName + ")"); } @@ -115,7 +111,7 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme * @param defaultType either javax.jms.Topic or javax.jms.Queue */ public void setSessionDefaultType(final String defaultType) { - if (ActiveMQRAMCFProperties.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setSessionDefaultType(" + type + ")"); } @@ -134,7 +130,7 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme * @return The default session type */ public String getSessionDefaultType() { - if (ActiveMQRAMCFProperties.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getSessionDefaultType()"); } @@ -153,7 +149,7 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme * @return the useTryLock. */ public Integer getUseTryLock() { - if (ActiveMQRAMCFProperties.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getUseTryLock()"); } @@ -166,7 +162,7 @@ public class ActiveMQRAMCFProperties extends ConnectionFactoryProperties impleme * @param useTryLock the useTryLock. */ public void setUseTryLock(final Integer useTryLock) { - if (ActiveMQRAMCFProperties.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setUseTryLock(" + useTryLock + ")"); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cbace51d/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java ---------------------------------------------------------------------- diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java index af3dcfb..a93965c 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java @@ -42,10 +42,6 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * Serial version UID */ static final long serialVersionUID = -1452379518562456741L; - /** - * Trace enabled - */ - private static boolean trace = ActiveMQRALogger.LOGGER.isTraceEnabled(); /** * The resource adapter @@ -76,7 +72,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * Constructor */ public ActiveMQRAManagedConnectionFactory() { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("constructor()"); } @@ -93,7 +89,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti */ @Override public Object createConnectionFactory() throws ResourceException { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.debug("createConnectionFactory()"); } @@ -109,7 +105,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti */ @Override public Object createConnectionFactory(final ConnectionManager cxManager) throws ResourceException { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createConnectionFactory(" + cxManager + ")"); } @@ -117,7 +113,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti ActiveMQRAConnectionFactory cf = new ActiveMQRAConnectionFactoryImpl(this, cm); - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created connection factory: " + cf + ", using connection manager: " + cm); @@ -136,7 +132,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti @Override public ManagedConnection createManagedConnection(final Subject subject, final ConnectionRequestInfo cxRequestInfo) throws ResourceException { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createManagedConnection(" + subject + ", " + cxRequestInfo + ")"); } @@ -144,13 +140,13 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti ActiveMQRACredential credential = ActiveMQRACredential.getCredential(this, subject, cri); - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("jms credential: " + credential); } ActiveMQRAManagedConnection mc = new ActiveMQRAManagedConnection(this, cri, ra, credential.getUserName(), credential.getPassword()); - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("created new managed connection: " + mc); } @@ -186,7 +182,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti public ManagedConnection matchManagedConnections(final Set connectionSet, final Subject subject, final ConnectionRequestInfo cxRequestInfo) throws ResourceException { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("matchManagedConnections(" + connectionSet + ", " + subject + @@ -198,7 +194,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti ActiveMQRAConnectionRequestInfo cri = getCRI((ActiveMQRAConnectionRequestInfo) cxRequestInfo); ActiveMQRACredential credential = ActiveMQRACredential.getCredential(this, subject, cri); - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Looking for connection matching credentials: " + credential); } @@ -209,7 +205,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti if ((mc.getUserName() == null || mc.getUserName() != null && mc.getUserName().equals(credential.getUserName())) && mcf.equals(this)) { if (cri.equals(mc.getCRI())) { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Found matching connection: " + mc); } @@ -219,7 +215,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti } } - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("No matching connection was found"); } @@ -234,7 +230,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti */ @Override public void setLogWriter(final PrintWriter out) throws ResourceException { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setLogWriter(" + out + ")"); } } @@ -247,7 +243,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti */ @Override public PrintWriter getLogWriter() throws ResourceException { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getLogWriter()"); } @@ -261,7 +257,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti */ @Override public ResourceAdapter getResourceAdapter() { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getResourceAdapter()"); } @@ -282,7 +278,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti */ @Override public void setResourceAdapter(final ResourceAdapter ra) throws ResourceException { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setResourceAdapter(" + ra + ")"); } @@ -302,7 +298,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti */ @Override public boolean equals(final Object obj) { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("equals(" + obj + ")"); } @@ -326,7 +322,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti */ @Override public int hashCode() { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("hashCode()"); } @@ -342,7 +338,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * @return The value */ public String getSessionDefaultType() { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getSessionDefaultType()"); } @@ -355,7 +351,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * @param type either javax.jms.Topic or javax.jms.Queue */ public void setSessionDefaultType(final String type) { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setSessionDefaultType(" + type + ")"); } @@ -639,7 +635,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * @return the useTryLock. */ public Integer getUseTryLock() { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getUseTryLock()"); } @@ -652,7 +648,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * @param useTryLock the useTryLock. */ public void setUseTryLock(final Integer useTryLock) { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("setUseTryLock(" + useTryLock + ")"); } @@ -665,7 +661,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * @return The metadata */ public ConnectionMetaData getMetaData() { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getMetadata()"); } @@ -678,7 +674,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * @return The properties */ protected ActiveMQRAMCFProperties getProperties() { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getProperties()"); } @@ -692,7 +688,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti * @return The instance */ private ActiveMQRAConnectionRequestInfo getCRI(final ActiveMQRAConnectionRequestInfo info) { - if (ActiveMQRAManagedConnectionFactory.trace) { + if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getCRI(" + info + ")"); }
