diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2008-02-05 02:37:13 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2008-02-05 02:37:13 +0000 |
commit | 89bfec4dc6c5ef0b23dc89744e22caa16a4216e3 (patch) | |
tree | 94e7e23538214b5f868cf7bf12a1c1938fab0d4c | |
parent | 554980543c9134c84b687090fc86090debb5ce36 (diff) | |
download | qpid-python-89bfec4dc6c5ef0b23dc89744e22caa16a4216e3.tar.gz |
Added code to connect the network error exceptions to the JMS Exception listener.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@618519 13f79535-47bb-0310-9956-ffa450edef68
3 files changed, 13 insertions, 2 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java index 1bf1c5bc7f..e3c12a3f50 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java @@ -111,6 +111,7 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Closed } _qpidConnection.connect(brokerDetail.getHost(), brokerDetail.getPort(), _conn.getVirtualHost(), _conn.getUsername(), _conn.getPassword()); + _qpidConnection.setClosedListener(this); } catch (QpidException e) { diff --git a/java/client/src/main/java/org/apache/qpidity/nclient/Client.java b/java/client/src/main/java/org/apache/qpidity/nclient/Client.java index 08ad27fd54..1bb661c3ef 100644 --- a/java/client/src/main/java/org/apache/qpidity/nclient/Client.java +++ b/java/client/src/main/java/org/apache/qpidity/nclient/Client.java @@ -56,7 +56,14 @@ public class Client implements org.apache.qpidity.nclient.Connection public void exception(Throwable t) { - // XXX: need to propogate exception + if (_closedListner != null) + { + _closedListner.onClosed(ErrorCode.CONNECTION_ERROR,ErrorCode.CONNECTION_ERROR.getDesc()); + } + else + { + throw new RuntimeException("Connection closed",t); + } } @Override public void connectionClose(Channel context, ConnectionClose connectionClose) @@ -185,7 +192,9 @@ public class Client implements org.apache.qpidity.nclient.Connection public void setClosedListener(ClosedListener closedListner) { + _closedListner = closedListner; + System.out.println("setting connection listener " + _closedListner); } } diff --git a/java/common/src/main/java/org/apache/qpidity/ErrorCode.java b/java/common/src/main/java/org/apache/qpidity/ErrorCode.java index 3f6308622a..4ff6939139 100644 --- a/java/common/src/main/java/org/apache/qpidity/ErrorCode.java +++ b/java/common/src/main/java/org/apache/qpidity/ErrorCode.java @@ -4,7 +4,8 @@ public enum ErrorCode { //Qpid specific - for the time being UNDEFINED(1,"undefined",true), - MESSAGE_REJECTED(1,"message_rejected",true), + MESSAGE_REJECTED(2,"message_rejected",true), + CONNECTION_ERROR(3,"connection was closed",true), //This might change in the spec, the error class is not applicable NO_ERROR(200,"reply-success",true), |