summaryrefslogtreecommitdiff
path: root/qpid/java/client
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2012-07-16 17:40:50 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2012-07-16 17:40:50 +0000
commitcd62dd33516f7119e560d9ad9f1dbf8ad4558ab1 (patch)
tree84e4aecca1b5e24cdd7037d1549e08fa2c68b141 /qpid/java/client
parent551cf1ecc6072d41ffce35ed94746555163244d0 (diff)
downloadqpid-python-cd62dd33516f7119e560d9ad9f1dbf8ad4558ab1.tar.gz
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/trunk@1362161 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java14
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java26
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;
+ }
+ }
}