|
24 | 24 | import com.rabbitmq.client.Connection; |
25 | 25 | import com.rabbitmq.client.Consumer; |
26 | 26 |
|
| 27 | +/** |
| 28 | + * Default implementation of {@link ExceptionHandler} used by {@link AMQConnection}. |
| 29 | + */ |
27 | 30 | public class DefaultExceptionHandler implements ExceptionHandler { |
28 | 31 | public void handleUnexpectedConnectionDriverException(Connection conn, Throwable exception) { |
29 | 32 | // TODO: Log this somewhere, just in case we have a bug like |
@@ -58,23 +61,26 @@ public void handleConsumerException(Channel channel, Throwable exception, |
58 | 61 |
|
59 | 62 | protected void handleChannelKiller(Channel channel, Throwable exception, String what) { |
60 | 63 | // TODO: log the exception |
61 | | - System.err.println(what + " threw an exception for channel " + channel + ":"); |
| 64 | + System.err.println("DefaultExceptionHandler: " + what + " threw an exception for channel " |
| 65 | + + channel + ":"); |
62 | 66 | exception.printStackTrace(); |
63 | 67 | try { |
64 | 68 | channel.close(); |
65 | 69 | } catch (AlreadyClosedException ace) { |
66 | | - //noop |
| 70 | + // noop |
67 | 71 | } catch (IOException ioe) { |
68 | 72 | // TODO: log the failure |
69 | | - System.err.println("Failure during close of channel " + channel + " after " + exception + ":"); |
| 73 | + System.err.println("Failure during close of channel " + channel + " after " + exception |
| 74 | + + ":"); |
70 | 75 | ioe.printStackTrace(); |
71 | 76 | AMQConnection conn = (AMQConnection) channel.getConnection(); |
72 | 77 | try { |
73 | 78 | conn.close(AMQP.INTERNAL_ERROR, "Internal error closing channel for " + what, |
74 | 79 | false, ioe); |
75 | 80 | } catch (IOException ioeH) { |
76 | 81 | // TODO: log the failure |
77 | | - System.err.println("Failure during close of connection " + conn + " after " + ioe + ":"); |
| 82 | + System.err.println("Failure during close of connection " + conn + " after " + ioe |
| 83 | + + ":"); |
78 | 84 | ioeH.printStackTrace(); |
79 | 85 | } |
80 | 86 | } |
|
0 commit comments