144
|
1 package rep.handler;
|
|
2
|
155
|
3 import java.io.IOException;
|
144
|
4 import rep.REPCommand;
|
|
5 import rep.SessionManager;
|
213
|
6 import rep.channel.REPSelectionKey;
|
144
|
7 import rep.channel.REPSocketChannel;
|
|
8
|
|
9 public class REPHandlerImpl implements REPHandler {
|
|
10
|
|
11 private SessionManager manager;
|
|
12
|
|
13
|
170
|
14 public REPHandlerImpl(int sid, SessionManager manager) {
|
144
|
15 this.manager = manager;
|
|
16 }
|
|
17
|
178
|
18 @SuppressWarnings("unchecked")
|
213
|
19 public void handle(REPSelectionKey<REPCommand> key) throws IOException {
|
238
|
20 REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.channel();
|
237
|
21 System.out.println("REPHandlerImpl.handle() : channel = " + channel);
|
|
22
|
178
|
23 REPCommand command = channel.read();
|
233
|
24 System.out.println("REPHandlerImpl.handle() : command = " + command);
|
178
|
25
|
144
|
26 manager.manage(channel, command);
|
|
27 }
|
|
28
|
267
|
29 public void cancel() {
|
|
30 // TODO Auto-generated method stub
|
|
31
|
|
32 }
|
|
33
|
144
|
34 }
|