/** * Start and wait for incoming connection */ @Override public void startEndpoint() throws IOException, InstantiationException { setRunning(true); while (isRunning()) { try{ if (getSelector() == null){ setSelector(Selector.open()); } registerNewChannels(); doSelect(); } catch (Throwable t){ logger.log(Level.FINE,"selectorThread.errorOnRequest",t); } } }
/** * Initialize this <code>SelectorThread</code> */ @Override public void initEndpoint() throws IOException, InstantiationException { setName("SSLSelectorReaderThread-" + getPort()); initAlgorithm(); }
/** * Register all <code>Channel</code> with an OP_READ opeation. */ private synchronized void registerNewChannels() throws IOException { int size = channels.size(); for (int i = 0; i < size; i++) { SocketChannel sc = channels.get(i); sc.configureBlocking(false); try { SelectionKey readKey = sc.register(getSelector(), SelectionKey.OP_READ); setSocketOptions(((SocketChannel)readKey.channel()).socket()); } catch (ClosedChannelException cce) { } } channels.clear(); }
/** * Add a <code>Channel</code> to be processed by this * <code>Selector</code> */ public synchronized void addChannel(SocketChannel channel) throws IOException, ClosedChannelException { channels.add(channel); getSelector().wakeup(); }
/** * Provides the count of request threads that are currently * being processed by the container * * @return Count of requests */ @Override public int getCurrentBusyProcessorThreads() { return (getProcessorPipeline().getCurrentThreadsBusy()); }