You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2007/02/19 15:48:45 UTC

svn commit: r509216 - in /incubator/qpid/trunk/qpid/java/client/src: main/java/org/apache/qpid/client/ test/java/org/apache/qpid/client/ test/java/org/apache/qpid/test/unit/client/channelclose/

Author: ritchiem
Date: Mon Feb 19 06:48:44 2007
New Revision: 509216

URL: http://svn.apache.org/viewvc?view=rev&rev=509216
Log:
Fully propogated timeouts during AMQConnection.close. Still needs timeouts to be reduced between the various session closures. QPID-380

Removed:
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/TestChannelCloseMethodHandlerNoCloseOk.java
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/AMQSession.java
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/DispatcherTest.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?view=diff&rev=509216&r1=509215&r2=509216
==============================================================================
--- 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 Feb 19 06:48:44 2007
@@ -725,7 +725,7 @@
                     long startCloseTime = System.currentTimeMillis();
 
                     _taskPool.shutdown();
-                    closeAllSessions(null, timeout);
+                    closeAllSessions(null, timeout, startCloseTime);
 
                     if (!_taskPool.isTerminated())
                     {
@@ -734,7 +734,7 @@
                             //adjust timeout
                             long taskPoolTimeout = adjustTimeout(timeout, startCloseTime);
 
-                            _taskPool.awaitTermination(taskPoolTimeout , TimeUnit.MILLISECONDS);
+                            _taskPool.awaitTermination(taskPoolTimeout, TimeUnit.MILLISECONDS);
                         }
                         catch (InterruptedException e)
                         {
@@ -791,7 +791,7 @@
      * @param cause if not null, the error that is causing this shutdown <p/> The caller must hold the failover mutex
      *              before calling this method.
      */
-    private void closeAllSessions(Throwable cause, long timeout) throws JMSException
+    private void closeAllSessions(Throwable cause, long timeout, long starttime) throws JMSException
     {
         final LinkedList sessionCopy = new LinkedList(_sessions.values());
         final Iterator it = sessionCopy.iterator();
@@ -807,6 +807,11 @@
             {
                 try
                 {
+                    if (starttime != -1)
+                    {
+                        timeout = adjustTimeout(timeout, starttime);
+                    }
+
                     session.close(timeout);
                 }
                 catch (JMSException e)
@@ -1065,7 +1070,7 @@
                     _logger.info("Closing AMQConnection due to :" + cause.getMessage());
                 }
                 _closed.set(true);
-                closeAllSessions(cause, -1); // FIXME: when doing this end up with RejectedExecutionException from executor.
+                closeAllSessions(cause, -1, -1); // FIXME: when doing this end up with RejectedExecutionException from executor.
             }
             catch (JMSException e)
             {

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?view=diff&rev=509216&r1=509215&r2=509216
==============================================================================
--- 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 Mon Feb 19 06:48:44 2007
@@ -521,7 +521,8 @@
                                                                            0,    // methodId
                                                                            AMQConstant.REPLY_SUCCESS.getCode(),    // replyCode
                                                                            new AMQShortString("JMS client closing channel"));    // replyText
-                    getProtocolHandler().syncWrite(frame, ChannelCloseOkBody.class);
+                    
+                    getProtocolHandler().syncWrite(frame, ChannelCloseOkBody.class, timeout);
                     // When control resumes at this point, a reply will have been received that
                     // indicates the broker has closed the channel successfully
 

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/DispatcherTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/DispatcherTest.java?view=diff&rev=509216&r1=509215&r2=509216
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/DispatcherTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/client/DispatcherTest.java Mon Feb 19 06:48:44 2007
@@ -83,7 +83,7 @@
         Hashtable<String, String> env = new Hashtable<String, String>();
 
         env.put("connectionfactory.connection", "amqp://client:client@MLT_ID/test?brokerlist='vm://:1'");
-        env.put("queue.queue", "direct://amq.direct//MessageListenerTest");
+        env.put("queue.queue", "MessageListenerTest");
 
         _context = factory.getInitialContext(env);