qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arnaudsi...@apache.org
Subject svn commit: r576491 - in /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client: ./ message/ url/
Date Mon, 17 Sep 2007 15:58:21 GMT
Author: arnaudsimon
Date: Mon Sep 17 08:58:20 2007
New Revision: 576491

URL: http://svn.apache.org/viewvc?rev=576491&view=rev
Log:
fixed several bugs after running samples against 0_10 

Modified:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_8.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/AbstractJMSMessageFactory.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/url/URLParser_0_10.java

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=576491&r1=576490&r2=576491&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
Mon Sep 17 08:58:20 2007
@@ -689,8 +689,8 @@
 
                     // adjust timeout
                     timeout = adjustTimeout(timeout, startCloseTime);
-
-                    _protocolHandler.closeConnection(timeout);
+                    _delegate.closeConneciton(timeout);
+                    //_protocolHandler.closeConnection(timeout);
 
                 }
                 catch (AMQException e)
@@ -702,6 +702,8 @@
             }
         }
     }
+
+
 
     /**
      * Marks all sessions and their children as closed without sending any protocol messages.
Useful when you need to

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate.java?rev=576491&r1=576490&r2=576491&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate.java
Mon Sep 17 08:58:20 2007
@@ -36,4 +36,6 @@
             final int prefetchHigh, final int prefetchLow) throws JMSException;
 
     public void resubscribeSessions() throws JMSException, AMQException, FailoverException;
+
+    public void closeConneciton(long timeout) throws JMSException, AMQException;
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java?rev=576491&r1=576490&r2=576491&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
Mon Sep 17 08:58:20 2007
@@ -49,8 +49,9 @@
         int channelId = _conn._idFactory.incrementAndGet();
         AMQSession session;
         try
-        {         
-            session = new AMQSession_0_10(_qpidConnection, _conn, channelId, transacted,
acknowledgeMode, prefetchHigh, prefetchLow);
+        {
+            session = new AMQSession_0_10(_qpidConnection, _conn, channelId, transacted,
acknowledgeMode, prefetchHigh,
+                                          prefetchLow);
             _conn.registerSession(channelId, session);
             if (_conn._started)
             {
@@ -100,4 +101,17 @@
         throw new FailoverException("failing to reconnect during failover, operation not
supported.");
     }
 
+
+    public void closeConneciton(long timeout) throws JMSException, AMQException
+    {
+        try
+        {
+            _qpidConnection.close();
+        }
+        catch (QpidException e)
+        {
+            throw new AMQException(AMQConstant.CHANNEL_ERROR, "cannot close connection",
e);
+        }
+
+    }
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_8.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_8.java?rev=576491&r1=576490&r2=576491&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_8.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_8.java
Mon Sep 17 08:58:20 2007
@@ -51,6 +51,13 @@
     private static final Logger _logger = LoggerFactory.getLogger(AMQConnectionDelegate_0_8.class);
     private AMQConnection _conn;
 
+
+    public void closeConneciton(long timeout) throws JMSException, AMQException
+    {
+        _conn.getProtocolHandler().closeConnection(timeout);
+
+    }
+
     public AMQConnectionDelegate_0_8(AMQConnection conn)
     {
         _conn = conn;

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=576491&r1=576490&r2=576491&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
Mon Sep 17 08:58:20 2007
@@ -22,6 +22,7 @@
 import org.apache.qpid.framing.AMQFrame;
 import org.apache.qpid.framing.ExchangeDeclareBody;
 import org.apache.qpid.framing.BasicContentHeaderProperties;
+import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.url.AMQBindingURL;
 import org.apache.qpid.url.URLSyntaxException;
 import org.apache.qpidity.jms.ExceptionHelper;
@@ -48,20 +49,11 @@
 
     public void declareDestination(AMQDestination destination)
     {
-        // Declare the exchange
-        // Note that the durable and internal arguments are ignored since passive is set
to false
-        AMQFrame declare = ExchangeDeclareBody.createAMQFrame(_channelId, _protocolHandler.getProtocolMajorVersion(),
-                                                              _protocolHandler.getProtocolMinorVersion(),
null,
-                                                              // arguments
-                                                              false, // autoDelete
-                                                              false, // durable
-                                                              destination.getExchangeName(),
// exchange
-                                                              false, // internal
-                                                              true, // nowait
-                                                              false, // passive
-                                                              _session.getTicket(), // ticket
-                                                              destination.getExchangeClass());
// type
-        _protocolHandler.writeFrame(declare);
+        ((AMQSession_0_10) getSession()).getQpidSession().exchangeDeclare(destination.getExchangeName().toString(),
+                                                                          destination.getExchangeClass().toString(),
+                                                                          null,
+                                                                          null
+                                                                          );
     }
 
     //--- Overwritten methods
@@ -105,7 +97,11 @@
         BasicContentHeaderProperties contentHeaderProperties = message.getContentHeaderProperties();
         // set the application properties
         qpidityMessage.getMessageProperties().setContentType(contentHeaderProperties.getContentType().toString());
-        qpidityMessage.getMessageProperties().setCorrelationId(contentHeaderProperties.getCorrelationId().toString());
+        AMQShortString correlationID = contentHeaderProperties.getCorrelationId();
+        if( correlationID != null )
+        {
+            qpidityMessage.getMessageProperties().setCorrelationId(correlationID.toString());
+        }
         String replyToURL = contentHeaderProperties.getReplyToAsString();
         if (replyToURL != null)
         {

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java?rev=576491&r1=576490&r2=576491&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java
Mon Sep 17 08:58:20 2007
@@ -126,7 +126,11 @@
         DeliveryProperties devprop = (DeliveryProperties) contentHeader[1];
         props.setContentType(mprop.getContentType());
         props.setCorrelationId(mprop.getCorrelationId());
-        props.setEncoding(mprop.getContentEncoding());
+        String encoding = mprop.getContentEncoding();
+        if (!encoding.equals(""))
+        {
+            props.setEncoding(encoding);
+        }
         props.setExpiration(devprop.getExpiration());
         // todo update when fieldtable is used props.setHeaders(mprop.getApplicationHeaders());
         props.setMessageId(mprop.getMessageId());

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/url/URLParser_0_10.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/url/URLParser_0_10.java?rev=576491&r1=576490&r2=576491&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/url/URLParser_0_10.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/url/URLParser_0_10.java
Mon Sep 17 08:58:20 2007
@@ -356,7 +356,7 @@
         try
         {
             char next = _url[_index];
-            while (next != ADDRESS_SEPERATOR_CHAR)
+            while (next != ADDRESS_SEPERATOR_CHAR && next != END_OF_URL_MARKER )
             {
                 b.append(next);
                 next = _url[++_index];
@@ -378,6 +378,10 @@
             {
                 int port = Integer.parseInt(portStr);
                 _currentBroker.setPort(port);
+                if( _url[_index] == END_OF_URL_MARKER )
+                {
+                    _endOfURL = true;
+                }
                 return URLParserState.ADDRESS_END;
             }
             catch (NumberFormatException e)



Mime
View raw message