01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.net.core.event;
06:
07: import com.tc.net.core.TCConnection;
08: import com.tc.net.protocol.TCNetworkMessage;
09:
10: /**
11: * A special flavor of TCConnectionEvent indicating an error on a specific connection
12: *
13: * @author teck
14: */
15: public class TCConnectionErrorEvent extends TCConnectionEvent {
16:
17: private final Exception exception;
18: private final TCNetworkMessage context;
19:
20: public TCConnectionErrorEvent(TCConnection connection,
21: final Exception exception, final TCNetworkMessage context) {
22: super (connection);
23: this .exception = exception;
24: this .context = context;
25: }
26:
27: /**
28: * The exception thrown by an IO operation on this connection
29: */
30: public Exception getException() {
31: return exception;
32: }
33:
34: /**
35: * If relevant, the message instance that was being used for the IO operation. Can be null
36: */
37: public TCNetworkMessage getMessageContext() {
38: return context;
39: }
40:
41: public String toString() {
42: return getSource()
43: + ", exception: "
44: + ((exception != null) ? exception.toString()
45: : "[null exception]")
46: + ", message context: "
47: + ((context != null) ? context.toString()
48: : "[no message context]");
49: }
50: }
|