summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2010-09-30 01:55:15 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2010-09-30 01:55:15 +0000
commit48e39cda054c0bd4b6e79c4b307a705daa5ff0ae (patch)
tree4c6574d077ddd4e51c60065ecc034c0858a82d02
parentc50e715ac43286db077635d33d120b27ae1ca924 (diff)
downloadqpid-python-48e39cda054c0bd4b6e79c4b307a705daa5ff0ae.tar.gz
A connection listener is set to all connections, to catch any connection level exceptions and report them via the error handler.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1002927 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/testkit/src/main/java/org/apache/qpid/testkit/Client.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/java/testkit/src/main/java/org/apache/qpid/testkit/Client.java b/java/testkit/src/main/java/org/apache/qpid/testkit/Client.java
index 34818fcbea..b10129d855 100644
--- a/java/testkit/src/main/java/org/apache/qpid/testkit/Client.java
+++ b/java/testkit/src/main/java/org/apache/qpid/testkit/Client.java
@@ -28,9 +28,11 @@ import java.text.SimpleDateFormat;
import javax.jms.Connection;
import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
import javax.jms.Session;
-public abstract class Client
+public abstract class Client implements ExceptionListener
{
private Connection con;
private Session ssn;
@@ -50,7 +52,8 @@ public abstract class Client
public Client(Connection con) throws Exception
{
- this.con = con;
+ this.con = con;
+ this.con.setExceptionListener(this);
durable = Boolean.getBoolean("durable");
transacted = Boolean.getBoolean("transacted");
txSize = Integer.getInteger("tx_size",10);
@@ -70,6 +73,11 @@ public abstract class Client
}
}
+ public void onException(JMSException e)
+ {
+ handleError("Connection error",e);
+ }
+
public void setErrorHandler(ErrorHandler h)
{
this.errorHandler = h;