Mercurial > hg > RemoteEditor > REPSessionManager
view rep/handler/REPHandlerImpl.java @ 267:c513cf1ce9cc
call handle.cancel() on socket channel close.
fix unterminated read() on closed channel.
on socket channel close, key.isreadable() and read() will return -1
we should throw IOException in this case.
author | kono |
---|---|
date | Thu, 11 Sep 2008 14:39:32 +0900 |
parents | 6589b148dd13 |
children | ad487e63e3c8 |
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 REPHandlerImpl implements REPHandler { private SessionManager manager; public REPHandlerImpl(int sid, SessionManager manager) { this.manager = manager; } @SuppressWarnings("unchecked") public void handle(REPSelectionKey<REPCommand> key) throws IOException { REPSocketChannel<REPCommand> channel = (REPSocketChannel<REPCommand>) key.channel(); System.out.println("REPHandlerImpl.handle() : channel = " + channel); REPCommand command = channel.read(); System.out.println("REPHandlerImpl.handle() : command = " + command); manager.manage(channel, command); } public void cancel() { // TODO Auto-generated method stub } }