diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-09-30 01:55:15 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-09-30 01:55:15 +0000 |
commit | 8c32d038ac6790d437f075285ae811e21d5149d3 (patch) | |
tree | 3a55c2d81619872c572b428d81b5f39d90de156c | |
parent | f42d290f367701bf8386ca84397913c27c7f57b3 (diff) | |
download | qpid-python-8c32d038ac6790d437f075285ae811e21d5149d3.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@1002927 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/testkit/src/main/java/org/apache/qpid/testkit/Client.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/Client.java b/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/Client.java index 34818fcbea..b10129d855 100644 --- a/qpid/java/testkit/src/main/java/org/apache/qpid/testkit/Client.java +++ b/qpid/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; |