Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/handler/Dispatcher.java @ 387:6f356d160e58
IPv6 any address
author | one@firefly.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Mon, 10 Nov 2008 22:21:52 +0900 |
parents | bba62c4ac323 |
children |
comparison
equal
deleted
inserted
replaced
386:bba62c4ac323 | 387:6f356d160e58 |
---|---|
15 * SessionManager Command and Multiplexed Editor Command come here. | 15 * SessionManager Command and Multiplexed Editor Command come here. |
16 * Dispatch Editor command according to the session and the channel. | 16 * Dispatch Editor command according to the session and the channel. |
17 */ | 17 */ |
18 public class Dispatcher extends Forwarder { | 18 public class Dispatcher extends Forwarder { |
19 | 19 |
20 public Dispatcher(SessionManager manager) { | 20 |
21 super(manager); | 21 public Dispatcher(SessionManager manager, |
22 REPSocketChannel<REPCommand> channel) { | |
23 super(manager, channel); | |
22 } | 24 } |
23 | 25 |
24 public void setQuit2(REPCommand cmd) { | 26 public void setQuit2(REPCommand cmd) { |
25 send(cmd); | 27 send(cmd); |
26 } | 28 } |
33 public String toString(){ | 35 public String toString(){ |
34 return ("Dispatcher:" + channel); | 36 return ("Dispatcher:" + channel); |
35 } | 37 } |
36 | 38 |
37 | 39 |
38 public void handle(REPSelectionKey<REPCommand> key) throws IOException { | 40 @Override |
41 public void handle(REPCommand command, REPSelectionKey<REPCommand> key) throws IOException { | |
39 /* | 42 /* |
40 * SessionManagerから来たコマンドは、Editor関係のコマンドは、 | 43 * SessionManagerから来たコマンドは、Editor関係のコマンドは、 |
41 * sessionとeidを判定して、そのeditorにforwardしてやれば良い。 | 44 * sessionとeidを判定して、そのeditorにforwardしてやれば良い。 |
42 * 残りは、manager.manage() で処理する。 | 45 * 残りは、manager.manage() で処理する。 |
43 */ | 46 */ |
44 REPSocketChannel<REPCommand> channel = key.channel1(); | |
45 REPCommand command = channel.read(); | |
46 ServerMainLoop.logger.writeLog("REPHandlerImpl.handle() : command = " + command); | 47 ServerMainLoop.logger.writeLog("REPHandlerImpl.handle() : command = " + command); |
47 if (manager.sessionManage(this, command)) return; | 48 if (manager.sessionManage(this, command)) return; |
48 | 49 |
49 distpatchToEditor(channel, command); | 50 distpatchToEditor(channel, command); |
50 } | 51 } |