144
|
1 package rep.handler;
|
|
2
|
155
|
3 import java.io.IOException;
|
144
|
4 import rep.REPCommand;
|
213
|
5 import rep.REPCommandPacker;
|
144
|
6 import rep.SessionManager;
|
213
|
7 import rep.channel.REPSelectionKey;
|
144
|
8 import rep.channel.REPSocketChannel;
|
|
9
|
|
10 public class REPHandlerImpl implements REPHandler {
|
|
11
|
|
12 private SessionManager manager;
|
|
13
|
|
14
|
170
|
15 public REPHandlerImpl(int sid, SessionManager manager) {
|
144
|
16 this.manager = manager;
|
|
17 }
|
|
18
|
178
|
19 @SuppressWarnings("unchecked")
|
213
|
20 public void handle(REPSelectionKey<REPCommand> key) throws IOException {
|
|
21 REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.accept(new REPCommandPacker());
|
178
|
22 REPCommand command = channel.read();
|
|
23
|
144
|
24 manager.manage(channel, command);
|
|
25 }
|
|
26
|
|
27 }
|