diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2013-09-25 15:32:23 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2013-09-25 15:32:23 +0000 |
| commit | 80e3697ffe3e510be76c1db898bbab94a325cb40 (patch) | |
| tree | 2e5a9ec026fbdc65ff85c75311ec1b14759a6b86 /qpid/java/amqp-1-0-common | |
| parent | 3bdd4780e35b4454477cf423b31ad6915df357fa (diff) | |
| download | qpid-python-80e3697ffe3e510be76c1db898bbab94a325cb40.tar.gz | |
QPID-5113 : JMS Client - JMS Connection exception listener is not notified when AMQ broker is killed (patch from Michael Samson)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1526207 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/amqp-1-0-common')
3 files changed, 47 insertions, 2 deletions
diff --git a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/framing/ConnectionHandler.java b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/framing/ConnectionHandler.java index f391cf3035..d4077e0f08 100644 --- a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/framing/ConnectionHandler.java +++ b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/framing/ConnectionHandler.java @@ -386,12 +386,14 @@ public class ConnectionHandler private BytesSource _bytesSource; private boolean _closed; private ConnectionEndpoint _conn; + private SocketExceptionHandler _exceptionHandler; - public BytesOutputHandler(OutputStream outputStream, BytesSource source, ConnectionEndpoint conn) + public BytesOutputHandler(OutputStream outputStream, BytesSource source, ConnectionEndpoint conn, SocketExceptionHandler exceptionHandler) { _outputStream = outputStream; _bytesSource = source; _conn = conn; + _exceptionHandler = exceptionHandler; } public void run() @@ -421,7 +423,7 @@ public class ConnectionHandler catch (IOException e) { _closed = true; - e.printStackTrace(); //TODO + _exceptionHandler.processSocketException(e); } } } diff --git a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/framing/SocketExceptionHandler.java b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/framing/SocketExceptionHandler.java new file mode 100644 index 0000000000..540aee0f8d --- /dev/null +++ b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/framing/SocketExceptionHandler.java @@ -0,0 +1,31 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.amqp_1_0.framing; + +/** + * Callback interface for processing socket exceptions. + */ +public interface SocketExceptionHandler +{ + + public void processSocketException(Exception exception); + +} diff --git a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/type/transport/ConnectionError.java b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/type/transport/ConnectionError.java index 07f0496e23..8a2120a252 100644 --- a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/type/transport/ConnectionError.java +++ b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/type/transport/ConnectionError.java @@ -43,6 +43,8 @@ public class ConnectionError public static final ConnectionError REDIRECT = new ConnectionError(Symbol.valueOf("amqp:connection:redirect")); + public static final ConnectionError SOCKET_ERROR = new ConnectionError(Symbol.valueOf("amqp:connection:socket-error")); + private ConnectionError(Symbol val) @@ -73,6 +75,11 @@ public class ConnectionError return "redirect"; } + if(this == SOCKET_ERROR) + { + return "socket-error"; + } + else { return String.valueOf(_val); @@ -97,6 +104,11 @@ public class ConnectionError { return REDIRECT; } + + if(SOCKET_ERROR._val.equals(val)) + { + return SOCKET_ERROR; + } // TODO ERROR return null; |
