Methods Summary |
---|
public void | clear(int port)
statemap.remove(port);
socketmap.remove(port);
|
int | getPortState(int port)
Integer i = statemap.get(port);
if (i == null) {
return PORT_UNBOUND;
} else {
return i.intValue();
}
|
private java.nio.channels.spi.SelectorProvider | getProvider()
SelectorProvider sp = null;
try {
Class clazz = Class.forName( "sun.nio.ch.DefaultSelectorProvider" );
java.lang.reflect.Method createMeth = clazz.getMethod("create", new Class[] {});
sp = (SelectorProvider) createMeth.invoke( null, new Object[] {} );
} catch( Exception e ) {
throw new RuntimeException("Unable to create default SelectorProvider.", e);
}
return sp;
|
java.net.ServerSocket | getServerSocket(int port)
return socketmap.get(port);
|
public java.nio.channels.DatagramChannel | openDatagramChannel()
return provider.openDatagramChannel();
|
public java.nio.channels.Pipe | openPipe()
return provider.openPipe();
|
public java.nio.channels.spi.AbstractSelector | openSelector()
AbstractSelector sel = provider.openSelector();
return new ASSelector(sel, this);
|
public java.nio.channels.ServerSocketChannel | openServerSocketChannel()
ServerSocketChannel ssc = provider.openServerSocketChannel();
return new ASServerSocketChannel(ssc, this);
|
public java.nio.channels.SocketChannel | openSocketChannel()
//SocketChannel sc = provider.openSocketChannel();
//return new ASSocketChannel(sc, this);
return provider.openSocketChannel();
|
public void | setPortState(int port, int state)
statemap.put(port, state);
|
void | setServerSocket(java.net.ServerSocket ss, int port)
int state = getPortState(port);
/**
if (state < 3) {
state++;
statemap.put(s, new Integer(state));
}
**/
if (state == PORT_UNBOUND) {
socketmap.put(port, ss);
setPortState(port, PORT_BOUND);
}
else if (state == PORT_BOUND) {
setPortState(port, PORT_CONFLICT);
}
|