Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/handler/REPHandlerImpl.java @ 213:4d9b32666ed2
*** empty log message ***
author | pin |
---|---|
date | Sat, 30 Aug 2008 17:56:06 +0900 |
parents | a097b1d619a1 |
children | 827c439d0da4 |
comparison
equal
deleted
inserted
replaced
212:e8f716498caf | 213:4d9b32666ed2 |
---|---|
1 package rep.handler; | 1 package rep.handler; |
2 | 2 |
3 import java.io.IOException; | 3 import java.io.IOException; |
4 import java.nio.channels.SelectionKey; | |
5 | |
6 import rep.REPCommand; | 4 import rep.REPCommand; |
5 import rep.REPCommandPacker; | |
7 import rep.SessionManager; | 6 import rep.SessionManager; |
7 import rep.channel.REPSelectionKey; | |
8 import rep.channel.REPSocketChannel; | 8 import rep.channel.REPSocketChannel; |
9 | 9 |
10 public class REPHandlerImpl implements REPHandler { | 10 public class REPHandlerImpl implements REPHandler { |
11 | 11 |
12 private SessionManager manager; | 12 private SessionManager manager; |
15 public REPHandlerImpl(int sid, SessionManager manager) { | 15 public REPHandlerImpl(int sid, SessionManager manager) { |
16 this.manager = manager; | 16 this.manager = manager; |
17 } | 17 } |
18 | 18 |
19 @SuppressWarnings("unchecked") | 19 @SuppressWarnings("unchecked") |
20 public void handle(SelectionKey key) throws IOException { | 20 public void handle(REPSelectionKey<REPCommand> key) throws IOException { |
21 REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.channel(); | 21 REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.accept(new REPCommandPacker()); |
22 REPCommand command = channel.read(); | 22 REPCommand command = channel.read(); |
23 | 23 |
24 manager.manage(channel, command); | 24 manager.manage(channel, command); |
25 } | 25 } |
26 | 26 |