diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2009-04-14 14:28:17 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2009-04-14 14:28:17 +0000 |
| commit | ef2604098acff8ceb85817669e8608d4212dd5d5 (patch) | |
| tree | 75c049076c1606523351d363e647ede8e6a2b338 /java/client | |
| parent | df6517b6513aa8278e5feb1b1759da39f50dfc55 (diff) | |
| download | qpid-python-ef2604098acff8ceb85817669e8608d4212dd5d5.tar.gz | |
QPID-1779 : Update to ensure CACFTest reports failures correctly and resolved the issue that it was not showing.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@764790 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQConnection.java | 2 | ||||
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/AMQSession.java | 30 |
2 files changed, 31 insertions, 1 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 c09b05bda8..4db94627bc 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 @@ -1326,6 +1326,8 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect // handling sequence if (cause instanceof IOException || cause instanceof AMQDisconnectedException) { + // If we have an IOE/AMQDisconnect there is no connection to close on. + _closing.set(false); closer = !_closed.getAndSet(true); _protocolHandler.getProtocolSession().notifyError(je); 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 ea131dd565..3529cfa6ad 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 @@ -21,6 +21,7 @@ package org.apache.qpid.client; import java.io.Serializable; +import java.io.IOException; import java.net.URISyntaxException; import java.text.MessageFormat; import java.util.ArrayList; @@ -698,7 +699,11 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic // Failover failed and ain't coming back. Knife the dispatcher. _dispatcherThread.interrupt(); } - } + + } + + //if we don't have an exception then we can perform closing operations + _closing.set(e == null); if (!_closed.getAndSet(true)) { @@ -3001,4 +3006,27 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic } } } + + /** + * Checks if the Session and its parent connection are closed + * + * @return <tt>true</tt> if this is closed, <tt>false</tt> otherwise. + */ + @Override + public boolean isClosed() + { + return _closed.get() || _connection.isClosed(); + } + + /** + * Checks if the Session and its parent connection are capable of performing + * closing operations + * + * @return <tt>true</tt> if we are closing, <tt>false</tt> otherwise. + */ + @Override + public boolean isClosing() + { + return _closing.get()|| _connection.isClosing(); + } } |
