Mercurial > hg > RemoteEditor > REPSessionManager
diff rep/channel/SelectorSimulator.java @ 174:72252e970a8b
*** empty log message ***
author | kent |
---|---|
date | Thu, 28 Aug 2008 19:49:41 +0900 |
parents | 785a3e8ea858 |
children | 5653cf8e3c8b |
line wrap: on
line diff
--- a/rep/channel/SelectorSimulator.java Thu Aug 28 18:59:30 2008 +0900 +++ b/rep/channel/SelectorSimulator.java Thu Aug 28 19:49:41 2008 +0900 @@ -1,6 +1,7 @@ package rep.channel; import java.io.IOException; +import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.spi.SelectorProvider; @@ -44,19 +45,25 @@ } return selectedKeys.size(); } - + /* public <T> SelectionKeySimulator register(SelectableChannelSimulator<T> cs, int opt){ SelectionKeySimulator key = new SelectionKeySimulator(cs, opt, this); keyList.add(key); return key; + }*/ + public SelectionKeySimulator register(SelectableChannel cs, int opt, Object handler){ + SelectionKeySimulator key = new SelectionKeySimulator(cs, opt, this); + key.attach(handler); + keyList.add(key); + return key; } - + /* public <T> SelectionKeySimulator register(ChannelSimulator<T> cs, int opt, Object handler){ SelectionKeySimulator key = new SelectionKeySimulator(cs, opt, this); key.attach(handler); keyList.add(key); return key; - } + }*/ public <T> SelectionKey getKey(ChannelSimulator<T> channel){ for(SelectionKey key : keyList){