annotate rep/handler/REPHandlerImpl.java @ 213:4d9b32666ed2

*** empty log message ***
author pin
date Sat, 30 Aug 2008 17:56:06 +0900
parents a097b1d619a1
children 827c439d0da4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
144
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
1 package rep.handler;
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
2
155
bbd2801d8ce0 *** empty log message ***
pin
parents: 148
diff changeset
3 import java.io.IOException;
144
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
4 import rep.REPCommand;
213
4d9b32666ed2 *** empty log message ***
pin
parents: 178
diff changeset
5 import rep.REPCommandPacker;
144
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
6 import rep.SessionManager;
213
4d9b32666ed2 *** empty log message ***
pin
parents: 178
diff changeset
7 import rep.channel.REPSelectionKey;
144
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
8 import rep.channel.REPSocketChannel;
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
9
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
10 public class REPHandlerImpl implements REPHandler {
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
11
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
12 private SessionManager manager;
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
13
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
14
170
30cf7747d134 *** empty log message ***
pin
parents: 155
diff changeset
15 public REPHandlerImpl(int sid, SessionManager manager) {
144
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
16 this.manager = manager;
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
17 }
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
18
178
a097b1d619a1 *** empty log message ***
pin
parents: 170
diff changeset
19 @SuppressWarnings("unchecked")
213
4d9b32666ed2 *** empty log message ***
pin
parents: 178
diff changeset
20 public void handle(REPSelectionKey<REPCommand> key) throws IOException {
4d9b32666ed2 *** empty log message ***
pin
parents: 178
diff changeset
21 REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.accept(new REPCommandPacker());
178
a097b1d619a1 *** empty log message ***
pin
parents: 170
diff changeset
22 REPCommand command = channel.read();
a097b1d619a1 *** empty log message ***
pin
parents: 170
diff changeset
23
144
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
24 manager.manage(channel, command);
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
25 }
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
26
0bf7f8d0f5f7 *** empty log message ***
pin
parents:
diff changeset
27 }