From 44ef96e6d31d819340a7214c60fb51de82d6c875 Mon Sep 17 00:00:00 2001 From: Bosanac Dejan Date: Mon, 1 Aug 2011 13:14:55 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-3431 - guard debug logging git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1152757 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/broker/TransactionBroker.java | 4 +++- .../org/apache/activemq/broker/region/Queue.java | 16 ++++++++++++---- .../activemq/broker/region/RegionBroker.java | 8 ++++++-- .../apache/activemq/broker/region/TempQueue.java | 4 +++- .../apache/activemq/broker/region/TempTopic.java | 4 +++- .../activemq/broker/region/TopicRegion.java | 4 +++- 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/TransactionBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/TransactionBroker.java index e8bd2a2b6e..60ce0e32ed 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/TransactionBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/TransactionBroker.java @@ -108,7 +108,9 @@ public class TransactionBroker extends BrokerFilter { } transaction.setState(Transaction.PREPARED_STATE); registerMBean(transaction); - LOG.debug("recovered prepared transaction: " + transaction.getTransactionId()); + if (LOG.isDebugEnabled()) { + LOG.debug("recovered prepared transaction: " + transaction.getTransactionId()); + } } catch (Throwable e) { throw new WrappedException(e); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java index 979b2d870f..0efa4516b7 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java @@ -475,7 +475,9 @@ public class Queue extends BaseDestination implements Task, UsageListener { if (ref.getMessageId().getBrokerSequenceId() == lastDeiveredSequenceId) { lastDeliveredRef = ref; markAsRedelivered = true; - LOG.debug("found lastDeliveredSeqID: " + lastDeiveredSequenceId + ", message reference: " + ref.getMessageId()); + if (LOG.isDebugEnabled()) { + LOG.debug("found lastDeliveredSeqID: " + lastDeiveredSequenceId + ", message reference: " + ref.getMessageId()); + } break; } } @@ -984,7 +986,9 @@ public class Queue extends BaseDestination implements Task, UsageListener { for (MessageReference ref : toExpire) { pagedInPendingDispatch.remove(ref); if (broker.isExpired(ref)) { - LOG.debug("expiring from pagedInPending: " + ref); + if (LOG.isDebugEnabled()) { + LOG.debug("expiring from pagedInPending: " + ref); + } messageExpired(connectionContext, ref); } } @@ -1000,7 +1004,9 @@ public class Queue extends BaseDestination implements Task, UsageListener { } for (MessageReference ref : toExpire) { if (broker.isExpired(ref)) { - LOG.debug("expiring from pagedInMessages: " + ref); + if (LOG.isDebugEnabled()) { + LOG.debug("expiring from pagedInMessages: " + ref); + } messageExpired(connectionContext, ref); } else { pagedInMessagesLock.writeLock().lock(); @@ -1021,7 +1027,9 @@ public class Queue extends BaseDestination implements Task, UsageListener { MessageReference node = messages.next(); if (node.isExpired()) { if (broker.isExpired(node)) { - LOG.debug("expiring from messages: " + node); + if (LOG.isDebugEnabled()) { + LOG.debug("expiring from messages: " + node); + } messageExpired(connectionContext, createMessageReference(node.getMessage())); } messages.remove(); diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java index 451e493d0f..07a6be27b6 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java @@ -669,7 +669,9 @@ public class RegionBroker extends EmptyBroker { brokerInfos.put(info.getBrokerId(), existing); } existing.incrementRefCount(); - LOG.debug(getBrokerName() + " addBroker:" + info.getBrokerName() + " brokerInfo size : " + brokerInfos.size()); + if (LOG.isDebugEnabled()) { + LOG.debug(getBrokerName() + " addBroker:" + info.getBrokerName() + " brokerInfo size : " + brokerInfos.size()); + } addBrokerInClusterUpdate(); } @@ -680,7 +682,9 @@ public class RegionBroker extends EmptyBroker { if (existing != null && existing.decrementRefCount() == 0) { brokerInfos.remove(info.getBrokerId()); } - LOG.debug(getBrokerName() + " removeBroker:" + info.getBrokerName() + " brokerInfo size : " + brokerInfos.size()); + if (LOG.isDebugEnabled()) { + LOG.debug(getBrokerName() + " removeBroker:" + info.getBrokerName() + " brokerInfo size : " + brokerInfos.size()); + } removeBrokerInClusterUpdate(); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueue.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueue.java index dfbdf86ded..a9b354b8e8 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueue.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueue.java @@ -76,7 +76,9 @@ public class TempQueue extends Queue{ .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); - LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); + if (LOG.isDebugEnabled()) { + LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); + } } super.addSubscription(context, sub); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopic.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopic.java index 746eea0680..9bf4658e93 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopic.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopic.java @@ -61,7 +61,9 @@ public class TempTopic extends Topic implements Task{ .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); - LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); + if (LOG.isDebugEnabled()) { + LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); + } } super.addSubscription(context, sub); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java index f160c8e7a7..e6348a94ef 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicRegion.java @@ -214,7 +214,9 @@ public class TopicRegion extends AbstractRegion { for (int i = 0; i < infos.length; i++) { SubscriptionInfo info = infos[i]; - LOG.debug("Restoring durable subscription: " + info); + if (LOG.isDebugEnabled()) { + LOG.debug("Restoring durable subscription: " + info); + } SubscriptionKey key = new SubscriptionKey(info); // A single durable sub may be subscribing to multiple topics.