comparison rep/channel/SelectionKeySimulator.java @ 205:dfc2afab1325 simulator-nio-both-worked

*** empty log message ***
author kono
date Sat, 30 Aug 2008 11:42:52 +0900
parents 8d7c74610b05
children 3e0cd34d625d
comparison
equal deleted inserted replaced
204:0607cc699ba3 205:dfc2afab1325
2 2
3 import java.io.IOException; 3 import java.io.IOException;
4 import java.nio.channels.SelectableChannel; 4 import java.nio.channels.SelectableChannel;
5 import java.nio.channels.SelectionKey; 5 import java.nio.channels.SelectionKey;
6 import java.nio.channels.Selector; 6 import java.nio.channels.Selector;
7 import java.nio.channels.ServerSocketChannel;
8 7
9 public class SelectionKeySimulator<P> extends REPSelectionKey<P>{ 8 public class SelectionKeySimulator<P> extends REPSelectionKey<P>{
10 9
11 private int interestOpt; 10 private int interestOpt;
12 private SelectableChannel channel; 11 private SelectableChannel channel;
51 50
52 public SelectableChannel channel(REPPack<P> packer) { 51 public SelectableChannel channel(REPPack<P> packer) {
53 return channel; 52 return channel;
54 } 53 }
55 54
55 @SuppressWarnings("unchecked")
56 public REPSocketChannel<P> accept(REPPack<P> pack) throws IOException { 56 public REPSocketChannel<P> accept(REPPack<P> pack) throws IOException {
57 assert(channel instanceof ServerChannelSimulator); 57 assert(channel instanceof ServerChannelSimulator);
58 ServerChannelSimulator<P> scs = (ServerChannelSimulator<P>) channel; 58 ServerChannelSimulator<P> scs = (ServerChannelSimulator<P>) channel;
59 return scs.accept1(); 59 return scs.accept1();
60 } 60 }