You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2007/01/22 22:12:46 UTC

svn commit: r498804 - in /incubator/qpid/branches/qpid.0-9/java: client/src/main/java/org/apache/qpid/client/ client/src/test/java/org/apache/qpid/test/unit/basic/ common/src/main/java/org/apache/qpid/framing/

Author: rajith
Date: Mon Jan 22 13:12:45 2007
New Revision: 498804

URL: http://svn.apache.org/viewvc?view=rev&rev=498804
Log:
Synchronized the toString method in the Content class
Removed commented code from the BasicMessageProducer


Modified:
    incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
    incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java
    incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java?view=diff&rev=498804&r1=498803&r2=498804
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java Mon Jan 22 13:12:45 2007
@@ -564,10 +564,21 @@
         int size = (payload != null) ? payload.limit() : 0;
         final long framePayloadMax = _session.getAMQConnection().getMaximumFrameSize();
         
+        if(_logger.isDebugEnabled()){
+        	_logger.debug("framePayloadMax " + framePayloadMax);
+        	_logger.debug("size " + size);
+        	_logger.debug("payload capacity" + payload.capacity());
+        	_logger.debug("payload limit" + payload.limit());
+        	_logger.debug("payload remaining" + payload.remaining());
+        	_logger.debug("payload position" + payload.position());
+        }
+        
         if (size < framePayloadMax){
         	// Inline message case
         	_logger.debug("Inline case, sending data inline with the transfer method");
-        	Content data = new Content(Content.ContentTypeEnum.CONTENT_TYPE_INLINE,payload); 
+
+        	Content data = new Content(Content.ContentTypeEnum.CONTENT_TYPE_INLINE,payload);
+
         	doMessageTransfer(messageHeaders,destination,data,message,deliveryMode,priority,timeToLive,immediate);
         } else {
         	// Reference message case

Modified: incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java?view=diff&rev=498804&r1=498803&r2=498804
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/client/src/test/java/org/apache/qpid/test/unit/basic/PubSubTwoConnectionTest.java Mon Jan 22 13:12:45 2007
@@ -64,4 +64,15 @@
         assertNotNull(tm1);
         assertEquals("Hello", tm1.getText());
     }
+    
+    public static void main(String[] args){
+    	PubSubTwoConnectionTest test = new PubSubTwoConnectionTest();
+    	try {
+			test.setUp();
+			test.testTwoConnections();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+    }
 }

Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java?view=diff&rev=498804&r1=498803&r2=498804
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java Mon Jan 22 13:12:45 2007
@@ -129,8 +129,13 @@
         content.limit(length);
     }
     
-    public String toString()
+    public synchronized String toString()
     {
-        return content.toString();
+    	int position = content.position();
+    	content.flip();
+        String tmp = content.toString();
+        content.position(position);
+        
+        return tmp;
     }
 }