private void handleRequest(final InterestRequest req) { // ignore the request if we are stopped/stopping if (isStopRequested()) { return; } if (Thread.currentThread() == this) { modifyInterest(req); } else { final CommThread commTh = req.getCommNIOServiceThread(); Assert.assertNotNull(commTh); commTh.addSelectorTask( new Runnable() { @Override public void run() { commTh.handleRequest(req); } }); } }
void removeReadInterest(TCConnectionImpl conn, SelectableChannel channel) { Assert.eval(isReader()); handleRequest( InterestRequest.createRemoveInterestRequest(channel, conn, SelectionKey.OP_READ, this)); }
private void requestAcceptInterest(TCListenerImpl lsnr, ServerSocketChannel ssc) { Assert.eval(isReader()); handleRequest( InterestRequest.createSetInterestRequest(ssc, lsnr, SelectionKey.OP_ACCEPT, this)); }
void requestWriteInterest(TCChannelWriter writer, GatheringByteChannel channel) { Assert.eval(!isReader()); handleRequest( InterestRequest.createAddInterestRequest( (SelectableChannel) channel, writer, SelectionKey.OP_WRITE, this)); }
void requestReadInterest(TCChannelReader reader, ScatteringByteChannel channel) { Assert.eval(isReader()); handleRequest( InterestRequest.createAddInterestRequest( (SelectableChannel) channel, reader, SelectionKey.OP_READ, this)); }
void requestConnectInterest(TCConnectionImpl conn, SocketChannel sc) { handleRequest( InterestRequest.createSetInterestRequest(sc, conn, SelectionKey.OP_CONNECT, this)); }