You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2009/04/08 00:16:53 UTC

svn commit: r762996 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network: ConduitBridge.java DemandForwardingBridge.java DemandForwardingBridgeSupport.java

Author: gtully
Date: Tue Apr  7 22:16:53 2009
New Revision: 762996

URL: http://svn.apache.org/viewvc?rev=762996&view=rev
Log:
tidy up logging for network connectors, make debug level usefull

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/ConduitBridge.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/ConduitBridge.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/ConduitBridge.java?rev=762996&r1=762995&r2=762996&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/ConduitBridge.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/ConduitBridge.java Tue Apr  7 22:16:53 2009
@@ -88,8 +88,8 @@
             DemandSubscription ds = i.next();
             subscriptionMapByLocalId.remove(ds.getRemoteInfo().getConsumerId());
             removeSubscription(ds);
-            if (LOG.isTraceEnabled()) {
-                LOG.trace("removing sub on " + localBroker + " from " + remoteBrokerName + " :  " + ds.getRemoteInfo());
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(configuration.getBrokerName() + " removing sub on " + localBroker + " from " + remoteBrokerName + " :  " + ds.getRemoteInfo());
             }
         }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java?rev=762996&r1=762995&r2=762996&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java Tue Apr  7 22:16:53 2009
@@ -55,12 +55,15 @@
             remoteBrokerName = remoteBrokerInfo.getBrokerName();
             if (localBrokerId != null) {
                 if (localBrokerId.equals(remoteBrokerId)) {
-                    LOG.info(configuration.getBrokerName() + " disconnecting remote loop back connection: " + remoteBrokerName);
-                    // waitStarted();
+                    if (LOG.isTraceEnabled()) {
+                        LOG.trace(configuration.getBrokerName() + " disconnecting remote loop back connection: " + remoteBrokerName);
+                    }
                     ServiceSupport.dispose(this);
                 }
             }
-            LOG.debug("counting down remoteBrokerNameKnownLatch with: " + command);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("counting down remoteBrokerNameKnownLatch with: " + command);
+            }
             remoteBrokerNameKnownLatch.countDown();
         }
     }
@@ -75,7 +78,9 @@
             localBrokerPath[0] = localBrokerId;
             if (remoteBrokerId != null) {
                 if (remoteBrokerId.equals(localBrokerId)) {
-                    LOG.info(configuration.getBrokerName() + " disconnecting local loop back connection.");
+                    if (LOG.isTraceEnabled()) {
+                        LOG.trace(configuration.getBrokerName() + " disconnecting local loop back connection.");
+                    }
                     waitStarted();
                     ServiceSupport.dispose(this);
                 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java?rev=762996&r1=762995&r2=762996&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java Tue Apr  7 22:16:53 2009
@@ -273,7 +273,9 @@
     protected void startLocalBridge() throws Exception {
         if (localBridgeStarted.compareAndSet(false, true)) {
             synchronized (this) {
-                LOG.debug("starting local Bridge, localBroker=" + localBroker);
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace(configuration.getBrokerName() + " starting local Bridge, localBroker=" + localBroker);
+                }
                 remoteBrokerNameKnownLatch.await();
 
                 localConnectionInfo = new ConnectionInfo();
@@ -298,7 +300,9 @@
 
     protected void startRemoteBridge() throws Exception {
         if (remoteBridgeStarted.compareAndSet(false, true)) {
-            LOG.debug("starting remote Bridge, localBroker=" + localBroker);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace(configuration.getBrokerName() + " starting remote Bridge, localBroker=" + localBroker);
+            }
             synchronized (this) {
                 if (!isCreatedByDuplex()) {
                     BrokerInfo brokerInfo = new BrokerInfo();
@@ -543,7 +547,7 @@
                 }
                 if (addConsumerInfo(info)) {
                     if (LOG.isDebugEnabled()) {
-                        LOG.debug(configuration.getBrokerName() + " Forwarding sub on " + localBroker + " from " + remoteBrokerName + " : " + info);
+                        LOG.debug(configuration.getBrokerName() + " bridging sub on " + localBroker + " from " + remoteBrokerName + " : " + info);
                     }
                 } else {
                     if (LOG.isDebugEnabled()) {
@@ -558,7 +562,7 @@
             BrokerId[] path = destInfo.getBrokerPath();
             if (path != null && path.length >= networkTTL) {
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Ignoring destination " + destInfo + " restricted to " + networkTTL + " network hops only");
+                    LOG.debug(configuration.getBrokerName() + " Ignoring destination " + destInfo + " restricted to " + networkTTL + " network hops only");
                 }
                 return;
             }
@@ -566,7 +570,7 @@
                 // Ignore this consumer as it's a consumer we locally sent to
                 // the broker.
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Ignoring destination " + destInfo + " already routed through this broker once");
+                    LOG.debug(configuration.getBrokerName() + " Ignoring destination " + destInfo + " already routed through this broker once");
                 }
                 return;
             }
@@ -577,7 +581,9 @@
                 tempDest.setConnectionId(localSessionInfo.getSessionId().getConnectionId());
             }
             destInfo.setBrokerPath(appendToBrokerPath(destInfo.getBrokerPath(), getRemoteBrokerPath()));
-            LOG.debug("Replying destination control command: " + destInfo);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("bridging destination control command: " + destInfo);
+            }
             localBroker.oneway(destInfo);
         } else if (data.getClass() == RemoveInfo.class) {
             ConsumerId id = (ConsumerId)((RemoveInfo)data).getObjectId();
@@ -634,7 +640,6 @@
 
     protected void serviceLocalCommand(Command command) {
         if (!disposed) {
-            final boolean trace = LOG.isTraceEnabled();
             try {
                 if (command.isMessageDispatch()) {
                     enqueueCounter.incrementAndGet();
@@ -653,9 +658,8 @@
                     	    cameFromRemote = contains( ((ConsumerInfo)consumerInfo).getBrokerPath(),remoteBrokerInfo.getBrokerId());                    	                           
                                             	                     	
                         Message message = configureMessage(md);
-                        if (trace) {
-                            LOG.trace("bridging " + configuration.getBrokerName() + " -> " + remoteBrokerName + ": " + message);
-                            LOG.trace("cameFromRemote = "+cameFromRemote + ", repsonseRequired = " + message.isResponseRequired());    
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug("bridging " + configuration.getBrokerName() + " -> " + remoteBrokerName + ": " + message);
                         }
 
                         if (!message.isResponseRequired()) {
@@ -702,8 +706,8 @@
                         }
 
                     } else {
-                        if (trace) {
-                            LOG.trace("No subscription registered with this network bridge for consumerId " + md.getConsumerId() + " for message: " + md.getMessage());
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug("No subscription registered with this network bridge for consumerId " + md.getConsumerId() + " for message: " + md.getMessage());
                         }
                     }
                 } else if (command.isBrokerInfo()) {
@@ -920,7 +924,7 @@
                     LOG.error("Failed to add static destination " + dest, e);
                 }
                 if (LOG.isTraceEnabled()) {
-                    LOG.trace("Forwarding messages for static destination: " + dest);
+                    LOG.trace("bridging messages for static destination: " + dest);
                 }
             }
         }
@@ -961,7 +965,7 @@
             if (!networkConsumers.isEmpty()) {
                 if (matchFound(candidateConsumers, networkConsumers)) {
                     if (LOG.isDebugEnabled()) {
-                        LOG.debug("subscription: " + consumerInfo + " is duplicated by network subscription: " 
+                        LOG.debug(configuration.getBrokerName() + " subscription: " + consumerInfo + " is duplicated by network subscription: " 
                                 + sub.getConsumerInfo()  + ", networkComsumerIds: " + networkConsumers);
                     }
                     isDuplicate = true;
@@ -1013,6 +1017,9 @@
                 // The longer the path to the consumer, the less it's consumer
                 // priority.
                 priority -= info.getBrokerPath().length + 1;
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug(configuration.getBrokerName() + " using priority :" + priority + " for subscription: " + info);
+                }
             }
             result.getLocalInfo().setPriority(priority);
         }
@@ -1055,8 +1062,8 @@
         DemandSubscription sub = subscriptionMapByRemoteId.remove(id);
         if (sub != null) {
             removeSubscription(sub);
-            if (LOG.isTraceEnabled()) {
-                LOG.trace("removing sub on " + localBroker + " from " + remoteBrokerName + " :  " + sub.getRemoteInfo());
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(configuration.getBrokerName() + " removing sub on " + localBroker + " from " + remoteBrokerName + " :  " + sub.getRemoteInfo());
             }
         }
     }