You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ar...@apache.org on 2007/09/28 17:48:18 UTC

svn commit: r580394 - in /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client: AMQSession.java AMQSession_0_10.java BasicMessageProducer_0_10.java message/FiledTableSupport.java

Author: arnaudsimon
Date: Fri Sep 28 08:48:17 2007
New Revision: 580394

URL: http://svn.apache.org/viewvc?rev=580394&view=rev
Log:
fixed several 0_10 issues

Modified:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/FiledTableSupport.java

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?rev=580394&r1=580393&r2=580394&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Fri Sep 28 08:48:17 2007
@@ -2101,7 +2101,7 @@
         return getProtocolHandler().getProtocolMinorVersion();
     }
 
-    private boolean hasMessageListeners()
+    protected boolean hasMessageListeners()
     {
         return _hasMessageListeners;
     }
@@ -2342,7 +2342,7 @@
      *
      * @todo Be aware of possible changes to parameter order as versions change.
      */
-    private void suspendChannel(boolean suspend) throws AMQException // , FailoverException
+    protected  void suspendChannel(boolean suspend) throws AMQException // , FailoverException
     {
         synchronized (_suspensionLock)
         {

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java?rev=580394&r1=580393&r2=580394&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java Fri Sep 28 08:48:17 2007
@@ -22,6 +22,8 @@
 import org.apache.qpid.AMQException;
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.client.failover.FailoverException;
+import org.apache.qpid.client.failover.FailoverNoopSupport;
+import org.apache.qpid.client.failover.FailoverProtectedOperation;
 import org.apache.qpid.client.protocol.AMQProtocolHandler;
 import org.apache.qpid.client.message.MessageFactoryRegistry;
 import org.apache.qpidity.nclient.Session;
@@ -403,6 +405,9 @@
             {
                 getQpidSession().messageFlow(consumer.getConsumerTag().toString(), Session.MESSAGE_FLOW_UNIT_MESSAGE,
                                              MAX_PREFETCH);
+                // todo this 
+                getQpidSession().messageFlow(consumer.getConsumerTag().toString(), Session.MESSAGE_FLOW_UNIT_BYTE,
+                                             0xFFFFFFFF);
             }
         }
         // We need to sync so that we get notify of an error.
@@ -456,4 +461,41 @@
         }
     }
 
+    protected AMQShortString declareQueue(final AMQDestination amqd, final AMQProtocolHandler protocolHandler)
+              throws AMQException
+      {
+          /*return new FailoverRetrySupport<AMQShortString, AMQException>(*/
+          return new FailoverNoopSupport<AMQShortString, AMQException>(
+                  new FailoverProtectedOperation<AMQShortString, AMQException>()
+                  {
+                      public AMQShortString execute() throws AMQException, FailoverException
+                      {
+                          // Generate the queue name if the destination indicates that a client generated name is to be used.
+                          if (amqd.isNameRequired())
+                          {
+
+                                   //TODO this is for 0_10 only to be changed
+                                   amqd.setQueueName(new AMQShortString("tmp_" +System.currentTimeMillis()));
+
+                          }
+
+                          sendQueueDeclare(amqd,protocolHandler);
+
+                          return amqd.getAMQQueueName();
+                      }
+                  }, _connection).execute();
+      }
+
+
+      void start() throws AMQException
+    {
+
+           super.suspendChannel(false);
+
+        // If the event dispatcher is not running then start it too.
+        if (hasMessageListeners())
+        {
+            startDistpatcherIfNecessary();
+        }
+    }
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java?rev=580394&r1=580393&r2=580394&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java Fri Sep 28 08:48:17 2007
@@ -116,10 +116,10 @@
             qpidityMessage.getMessageProperties()
                     .setReplyTo(new ReplyTo(dest.getExchangeName().toString(), dest.getRoutingKey().toString()));
         }
-
-        if (contentHeaderProperties.getHeaders() != null)
+         //JMS_QPID_DESTTYPE   is always set but useles so this is a temporary fix
+        // TODO remove second test
+        if (contentHeaderProperties.getHeaders() != null && contentHeaderProperties.getHeaders().size() > 1)
         {
-            // todo use the new fieldTable
             qpidityMessage.getMessageProperties().setApplicationHeaders(FiledTableSupport.convertToMap(contentHeaderProperties.getHeaders()));
 
             for(String key:qpidityMessage.getMessageProperties().getApplicationHeaders().keySet())

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/FiledTableSupport.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/FiledTableSupport.java?rev=580394&r1=580393&r2=580394&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/FiledTableSupport.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/FiledTableSupport.java Fri Sep 28 08:48:17 2007
@@ -23,9 +23,8 @@
   public static Map<String,Object> convertToMap(FieldTable ft)
   {
      Map<String,Object> map = new HashMap<String,Object>();
-     for (Enumeration keys = ft.getPropertyNames(); keys.hasMoreElements();)
+     for (AMQShortString key: ft.keySet() )
      {
-         AMQShortString key = (AMQShortString)keys.nextElement();
          map.put(key.asString(), ft.getObject(key));
      }