comparison rep/channel/REPSelector.java @ 125:9faacdd6c9cb

*** empty log message ***
author pin
date Wed, 27 Aug 2008 17:54:47 +0900
parents
children 785a3e8ea858
comparison
equal deleted inserted replaced
124:97a321d91b79 125:9faacdd6c9cb
1 package rep.channel;
2
3 import java.io.IOException;
4 import java.nio.channels.SelectionKey;
5 import java.nio.channels.Selector;
6 import java.nio.channels.spi.AbstractSelector;
7 import java.nio.channels.spi.SelectorProvider;
8 import java.util.Set;
9
10 public class REPSelector extends Selector{
11
12 Selector selector;
13
14 public REPSelector(AbstractSelector selector) {
15 this.selector = selector;
16 }
17
18 static REPSelector create() throws IOException{
19 if(REPServerSocketChannel.isSimulation){
20 return new SelectorSimulator();
21 }
22 return new REPSelector(SelectorProvider.provider().openSelector());
23 }
24
25 @Override
26 public void close() throws IOException {
27 selector.close();
28 }
29
30 @Override
31 public boolean isOpen() {
32 return selector.isOpen();
33 }
34
35 @Override
36 public Set<SelectionKey> keys() {
37 return selector.keys();
38 }
39
40 @Override
41 public SelectorProvider provider() {
42 return selector.provider();
43 }
44
45 @Override
46 public int select() throws IOException {
47 return selector.select();
48 }
49
50 @Override
51 public int select(long timeout) throws IOException {
52 return selector.select(timeout);
53 }
54
55 @Override
56 public int selectNow() throws IOException {
57 return selector.selectNow();
58 }
59
60 @Override
61 public Set<SelectionKey> selectedKeys() {
62 return selector.selectedKeys();
63 }
64
65 @Override
66 public Selector wakeup() {
67 return selector.wakeup();
68 }
69
70 }