in provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/tcp/TcpTransportServer.java [92:128]
public void start(Runnable onCompleted) throws Exception {
try {
channel = ServerSocketChannel.open();
channel.configureBlocking(false);
channel.socket().bind(bindAddress, backlog);
} catch (IOException e) {
throw new IOException("Failed to bind to server socket: " + bindAddress + " due to: " + e, e);
}
acceptSource = Dispatch.createSource(channel, SelectionKey.OP_ACCEPT, dispatchQueue);
acceptSource.setEventHandler(new Runnable() {
public void run() {
try {
SocketChannel client = channel.accept();
while( client!=null ) {
handleSocket(client);
client = channel.accept();
}
} catch (Exception e) {
listener.onAcceptError(TcpTransportServer.this, e);
}
}
});
acceptSource.setCancelHandler(new Runnable() {
public void run() {
try {
channel.close();
} catch (IOException e) {
}
}
});
acceptSource.resume();
if( onCompleted!=null ) {
dispatchQueue.execute(onCompleted);
}
}