diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2008-02-06 22:13:31 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2008-02-06 22:13:31 +0000 |
| commit | f2de56da6296064109eee0fa42a76bf765adbfb2 (patch) | |
| tree | a7939e7e2f762b58a3f598ec099f6058f20b338a /java/client/src | |
| parent | 790a3ac50987c7e87ec501e1fa2438faa162ab69 (diff) | |
| download | qpid-python-f2de56da6296064109eee0fa42a76bf765adbfb2.tar.gz | |
added close notification
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@619182 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpidity/nclient/Client.java | 14 |
1 files changed, 13 insertions, 1 deletions
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; } }; |
