Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/channel/REPServerSocketChannel.java @ 123:5b1a0574b406 add-simulator
*** empty log message ***
author | pin |
---|---|
date | Wed, 27 Aug 2008 17:21:25 +0900 |
parents | |
children | 01062be677e9 |
comparison
equal
deleted
inserted
replaced
122:790c8dd42a7b | 123:5b1a0574b406 |
---|---|
1 package rep.channel; | |
2 | |
3 import java.io.IOException; | |
4 import java.net.ServerSocket; | |
5 import java.nio.channels.ServerSocketChannel; | |
6 import java.nio.channels.SocketChannel; | |
7 import java.nio.channels.spi.SelectorProvider; | |
8 | |
9 public class REPServerSocketChannel<P> extends ServerSocketChannel{ | |
10 | |
11 public static boolean isSimulation; | |
12 private ServerSocketChannel ss; | |
13 | |
14 protected REPServerSocketChannel(SelectorProvider provider) { | |
15 super(provider); | |
16 | |
17 } | |
18 | |
19 public REPServerSocketChannel(ServerSocketChannel channel){ | |
20 super(null); | |
21 ss = channel; | |
22 } | |
23 | |
24 public static REPServerSocketChannel open() throws IOException { | |
25 if(isSimulation){ | |
26 return ServerChannelSimulatorImpl.open(); | |
27 }else{ | |
28 return new REPServerSocketChannel(open()); | |
29 } | |
30 } | |
31 | |
32 public REPSocketChannel<P> accept1() throws IOException { | |
33 return new REPSocketChannel<P>(ss.accept()); | |
34 } | |
35 | |
36 @Override | |
37 public ServerSocket socket() { | |
38 return ss.socket(); | |
39 } | |
40 | |
41 @Override | |
42 protected void implCloseSelectableChannel() throws IOException { | |
43 ss.close(); | |
44 } | |
45 | |
46 @Override | |
47 protected void implConfigureBlocking(boolean block) throws IOException { | |
48 ss.configureBlocking(block); | |
49 } | |
50 | |
51 @Override | |
52 public SocketChannel accept() throws IOException { | |
53 // TODO Auto-generated method stub | |
54 return null; | |
55 } | |
56 } |