1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.mina.core.service;
21
22 import org.apache.mina.core.session.IdleStatus;
23 import org.apache.mina.core.session.IoSession;
24 import org.apache.mina.filter.FilterEvent;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28
29
30
31
32
33
34
35 public class IoHandlerAdapter implements IoHandler {
36 private static final Logger LOGGER = LoggerFactory.getLogger(IoHandlerAdapter.class);
37
38
39
40
41 @Override
42 public void sessionCreated(IoSession session) throws Exception {
43
44 }
45
46
47
48
49 @Override
50 public void sessionOpened(IoSession session) throws Exception {
51
52 }
53
54
55
56
57 @Override
58 public void sessionClosed(IoSession session) throws Exception {
59
60 }
61
62
63
64
65 @Override
66 public void sessionIdle(IoSession session, IdleStatus status) throws Exception {
67
68 }
69
70
71
72
73 @Override
74 public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
75 if (LOGGER.isWarnEnabled()) {
76 LOGGER.warn("EXCEPTION, please implement " + getClass().getName()
77 + ".exceptionCaught() for proper handling:", cause);
78 }
79 }
80
81
82
83
84 @Override
85 public void messageReceived(IoSession session, Object message) throws Exception {
86
87 }
88
89
90
91
92 @Override
93 public void messageSent(IoSession session, Object message) throws Exception {
94
95 }
96
97
98
99
100 @Override
101 public void inputClosed(IoSession session) throws Exception {
102 session.closeNow();
103 }
104
105
106
107
108 @Override
109 public void event(IoSession session, FilterEvent event) throws Exception {
110
111 }
112 }