Author: ritchiem
Date: Wed Feb  7 07:43:33 2007
New Revision: 504596

URL: http://svn.apache.org/viewvc?view=rev&rev=504596
Log:
Added guards to debug and trace statements noted during debuging.

Modified:
    
incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
    
incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/util/FlowControllingBlockingQueue.java
    incubator/qpid/branches/perftesting/qpid/java/distribution/pom.xml

Modified: 
incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?view=diff&rev=504596&r1=504595&r2=504596
==============================================================================
--- 
incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
 (original)
+++ 
incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
 Wed Feb  7 07:43:33 2007
@@ -228,7 +228,10 @@
 
                     int errorCode = message.bounceBody.replyCode;
                     String reason = message.bounceBody.replyText;
-                    _logger.debug("Message returned with error code " + 
errorCode + " (" + reason + ")");
+                    if (_logger.isDebugEnabled())
+                    {
+                        _logger.debug("Message returned with error code " + 
errorCode + " (" + reason + ")");
+                    }
 
                     //@TODO should this be moved to an exception handler of 
sorts. Somewhere errors are converted to correct execeptions.
                     if (errorCode == AMQConstant.NO_CONSUMERS.getCode())
@@ -275,6 +278,8 @@
 
                 _queue.clear();
 
+                _logger.trace("Queue cleared");
+
                 for (BasicMessageConsumer consumer : _consumers.values())
                 {
                     consumer.rollback();
@@ -325,7 +330,10 @@
                                                           {
                                                               if 
(_acknowledgeMode == NO_ACKNOWLEDGE)
                                                               {
-                                                                  
_logger.warn("Above threshold(" + _defaultPrefetchHighMark + ") so suspending 
channel. Current value is " + currentValue);
+                                                                  if 
(_logger.isDebugEnabled())
+                                                                  {
+                                                                      
_logger.debug("Above threshold(" + _defaultPrefetchHighMark + ") so suspending 
channel. Current value is " + currentValue);
+                                                                  }
 
                                                                   new 
Thread(new SuspenderRunner(true)).start();
                                                               }
@@ -335,7 +343,10 @@
                                                           {
                                                               if 
(_acknowledgeMode == NO_ACKNOWLEDGE)
                                                               {
-                                                                  
_logger.warn("Below threshold(" + _defaultPrefetchLowMark + ") so unsuspending 
channel. Current value is " + currentValue);
+                                                                  if 
(_logger.isDebugEnabled())
+                                                                  {
+                                                                      
_logger.debug("Below threshold(" + _defaultPrefetchLowMark + ") so unsuspending 
channel. Current value is " + currentValue);
+                                                                  }
 
                                                                   new 
Thread(new SuspenderRunner(false)).start();
                                                               }
@@ -1815,10 +1826,13 @@
     {
         synchronized (_suspensionLock)
         {
-            _logger.warn("Setting channel flow : " + (suspend ? "suspended" : 
"unsuspended"));
+            if (_logger.isDebugEnabled())
+            {
+                _logger.debug("Setting channel flow : " + (suspend ? 
"suspended" : "unsuspended"));
+            }
 
             _suspended = suspend;
-            
+
             // AMQP version change: Hardwire the version to 0-8 (major=8, 
minor=0)
             // TODO: Connect this to the session version obtained from 
ProtocolInitiation for this session.
             // Be aware of possible changes to parameter order as versions 
change.

Modified: 
incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/util/FlowControllingBlockingQueue.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/util/FlowControllingBlockingQueue.java?view=diff&rev=504596&r1=504595&r2=504596
==============================================================================
--- 
incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/util/FlowControllingBlockingQueue.java
 (original)
+++ 
incubator/qpid/branches/perftesting/qpid/java/client/src/main/java/org/apache/qpid/client/util/FlowControllingBlockingQueue.java
 Wed Feb  7 07:43:33 2007
@@ -20,7 +20,7 @@
  */
 package org.apache.qpid.client.util;
 
-import org.apache.qpid.AMQException;
+import org.apache.log4j.Logger;
 
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
@@ -33,6 +33,8 @@
  */
 public class FlowControllingBlockingQueue
 {
+    private static final Logger _logger = 
Logger.getLogger(FlowControllingBlockingQueue.class);
+
     /** This queue is bounded and is used to store messages before being 
dispatched to the consumer */
     private final BlockingQueue _queue = new LinkedBlockingQueue();
 
@@ -71,6 +73,12 @@
     public Object take() throws InterruptedException
     {
         Object o = _queue.take();
+
+        if (_logger.isTraceEnabled())
+        {
+            _logger.trace("Object taken from queue:" + o);
+        }
+
         if (_listener != null)
         {
             synchronized (_listener)
@@ -87,6 +95,12 @@
     public void add(Object o)
     {
         _queue.add(o);
+
+        if (_logger.isTraceEnabled())
+        {
+            _logger.trace("Object added to queue:" + o);
+        }
+        
         if (_listener != null)
         {
             synchronized (_listener)

Modified: incubator/qpid/branches/perftesting/qpid/java/distribution/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/perftesting/qpid/java/distribution/pom.xml?view=diff&rev=504596&r1=504595&r2=504596
==============================================================================
--- incubator/qpid/branches/perftesting/qpid/java/distribution/pom.xml 
(original)
+++ incubator/qpid/branches/perftesting/qpid/java/distribution/pom.xml Wed Feb  
7 07:43:33 2007
@@ -38,7 +38,7 @@
         <java.source.version>1.5</java.source.version>
         <qpid.version>${pom.version}</qpid.version>
         <qpid.targetDir>${project.build.directory}</qpid.targetDir>
-               <release.revision>-r504143</release.revision>
+               <release.revision>-r504596</release.revision>
     </properties>
    
     <repositories>


Reply via email to