From f2de56da6296064109eee0fa42a76bf765adbfb2 Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Wed, 6 Feb 2008 22:13:31 +0000 Subject: added close notification git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@619182 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/qpidity/nclient/Client.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'java/client/src/main') 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 1bb661c3ef..03294e11e0 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 @@ -49,6 +49,8 @@ public class Client implements org.apache.qpidity.nclient.Connection ConnectionDelegate connectionDelegate = new ConnectionDelegate() { + private boolean receivedClose = false; + public SessionDelegate getSessionDelegate() { return new ClientSessionDelegate(); @@ -62,7 +64,15 @@ public class Client implements org.apache.qpidity.nclient.Connection } else { - throw new RuntimeException("Connection closed",t); + throw new RuntimeException("connection closed",t); + } + } + + public void closed() + { + if (_closedListner != null && !this.receivedClose) + { + _closedListner.onClosed(ErrorCode.CONNECTION_ERROR,ErrorCode.CONNECTION_ERROR.getDesc()); } } @@ -81,6 +91,8 @@ public class Client implements org.apache.qpidity.nclient.Connection { _closedListner.onClosed(errorCode, connectionClose.getReplyText()); } + + this.receivedClose = true; } }; -- cgit v1.2.1