diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2012-07-30 21:18:07 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2012-07-30 21:18:07 +0000 |
| commit | eed0c3d16613998b02d324abe2abfb713113c261 (patch) | |
| tree | f949eb4e817911d14306fe9b3db7c55a424a6e53 /qpid/java/client/src | |
| parent | ad7a94acd0bb798c0a6d9e51de09c07e4fa815bf (diff) | |
| download | qpid-python-eed0c3d16613998b02d324abe2abfb713113c261.tar.gz | |
Porting to 0.18 branch.
QPID-3575 SessionExceptions (0-10 code path) are now marked as soft
errors. When a Session receives an exception it is closed and the
exception is notified via the ConnectionListener as well. However the
exception is marked as a soft-error, therefore the connection will not
be closed.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.18@1367307 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src')
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java | 14 | ||||
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java | 26 |
2 files changed, 29 insertions, 11 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index d70a54ccd4..1468e90c4e 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -801,11 +801,8 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic if (e instanceof AMQDisconnectedException) { - if (_dispatcherThread != null) - { - // Failover failed and ain't coming back. Knife the dispatcher. - _dispatcherThread.interrupt(); - } + // Failover failed and ain't coming back. Knife the dispatcher. + stopDispatcherThread(); } @@ -834,6 +831,13 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic } } + protected void stopDispatcherThread() + { + if (_dispatcherThread != null) + { + _dispatcherThread.interrupt(); + } + } /** * Commits all messages done in this transaction and releases any locks currently held. * diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java index 317c8902be..3deddbd918 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java @@ -390,11 +390,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic */ public void sendClose(long timeout) throws AMQException, FailoverException { - if (flushTask != null) - { - flushTask.cancel(); - flushTask = null; - } + cancelTimerTask(); flushAcknowledgments(); try { @@ -1051,9 +1047,19 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic { code = ee.getErrorCode().getValue(); } - AMQException amqe = new AMQException(AMQConstant.getConstant(code), se.getMessage(), se.getCause()); + AMQException amqe = new AMQException(AMQConstant.getConstant(code), false, se.getMessage(), se.getCause()); _currentException = amqe; } + cancelTimerTask(); + stopDispatcherThread(); + try + { + closed(_currentException); + } + catch(Exception e) + { + _logger.warn("Error closing session", e); + } getAMQConnection().exceptionReceived(_currentException); } @@ -1414,5 +1420,13 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic return _qpidSession.isFlowBlocked(); } + private void cancelTimerTask() + { + if (flushTask != null) + { + flushTask.cancel(); + flushTask = null; + } + } } |
