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 | 7dcc9e664a8a877fbd8adf657faa2eb5e6b41a5e (patch) | |
| tree | 10dbe2236b099facc2867e902dfc0c3745d5072d /qpid/java/client/src | |
| parent | 3f3f3d29322a02f2fc5b1f452b2f75582ffb8c26 (diff) | |
| download | qpid-python-7dcc9e664a8a877fbd8adf657faa2eb5e6b41a5e.tar.gz | |
added close notification
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@619182 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src')
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java b/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java index 1bb661c3ef..03294e11e0 100644 --- a/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java +++ b/qpid/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; } }; |
