diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2007-02-19 14:48:44 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2007-02-19 14:48:44 +0000 |
| commit | e14993ebab6c2f2ed5984de30fe03ce320cf4c0c (patch) | |
| tree | f3f700b337b81b6c8a4d2b0a7eafbe86c57c98d6 /java/client/src/main | |
| parent | ef65342bbda798f5ecdcc70ef1919d3b3d0300f5 (diff) | |
| download | qpid-python-e14993ebab6c2f2ed5984de30fe03ce320cf4c0c.tar.gz | |
Fully propogated timeouts during AMQConnection.close. Still needs timeouts to be reduced between the various session closures. QPID-380
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@509216 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/main')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQConnection.java | 13 | ||||
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQSession.java | 3 |
2 files changed, 11 insertions, 5 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java index 1fb1c51890..03a70d7f39 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java @@ -725,7 +725,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect long startCloseTime = System.currentTimeMillis(); _taskPool.shutdown(); - closeAllSessions(null, timeout); + closeAllSessions(null, timeout, startCloseTime); if (!_taskPool.isTerminated()) { @@ -734,7 +734,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect //adjust timeout long taskPoolTimeout = adjustTimeout(timeout, startCloseTime); - _taskPool.awaitTermination(taskPoolTimeout , TimeUnit.MILLISECONDS); + _taskPool.awaitTermination(taskPoolTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { @@ -791,7 +791,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect * @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 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect { try { + if (starttime != -1) + { + timeout = adjustTimeout(timeout, starttime); + } + session.close(timeout); } catch (JMSException e) @@ -1065,7 +1070,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect _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) { diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index fe77acfabc..6d4d6cbaad 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -521,7 +521,8 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi 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 |
