Mercurial > hg > RemoteEditor > REPSessionManager
view rep/handler/REPEditorHandler.java @ 316:77f443f6dc9f
add session manager channel handler
author | kono |
---|---|
date | Tue, 07 Oct 2008 18:15:33 +0900 |
parents | |
children | 5ba5b7a9761b |
line wrap: on
line source
package rep.handler; import java.io.IOException; import rep.REPCommand; import rep.SessionManager; import rep.channel.REPSelectionKey; import rep.channel.REPSocketChannel; public class REPEditorHandler implements REPHandler { private SessionManager manager; public REPEditorHandler(SessionManager manager) { this.manager = manager; } public void handle(REPSelectionKey<REPCommand> key) throws IOException { REPSocketChannel<REPCommand> channel = key.channel1(); REPCommand command = channel.read(); System.out.println("REPHandlerImpl.handle() read : command = " + command +" from "+channel); manager.manage(channel, command); } public void cancel(REPSocketChannel<REPCommand> socketChannel) { manager.remove(socketChannel); } }