public final SelectionKey keyFor() { return channel.keyFor(selector); }
/** * {@inheritDoc} */ @Override protected void close(ServerSocketChannel handle) throws Exception { SelectionKey key = handle.keyFor(selector); if (key != null) { key.cancel(); } handle.close(); }
/** * {@inheritDoc} */ @Override protected void close(ServerSocketChannel handle) throws Exception { SelectionKey key = handle.keyFor(selector); if (key != null) { key.cancel(); } handle.close(); }
/** * {@inheritDoc} */ @Override protected void close(ServerSocketChannel handle) throws Exception { SelectionKey key = handle.keyFor(selector); if (key != null) { key.cancel(); } handle.close(); }
/** * {@inheritDoc} */ @Override protected void close(ServerSocketChannel handle) throws Exception { SelectionKey key = handle.keyFor(selector); if (key != null) { key.cancel(); } handle.close(); }
public void removeSelector(Selector selector) { final SelectionKey key = media.keyFor(selector); if (key != null) { key.cancel(); try { // required to reuse socket on windows, see https://github.com/kaazing/nuklei/issues/20 selector.select(1); } catch (IOException e) { LOG.debug("Failed to remove selector {}", selector, e); } } }
public void removeSelector(Selector selector) { final SelectionKey key = media.keyFor(selector); if (key != null) { key.cancel(); try { // required to reuse socket on windows, see https://github.com/kaazing/nuklei/issues/20 selector.select(1); } catch (IOException e) { LOG.debug("Failed to remove selector {}", selector, e); } } }
key = handle.keyFor(selector);
key = handle.keyFor(selector);
ServerSocketChannel handle) throws Exception { SelectionKey key = handle.keyFor(selector);
/** * {@inheritDoc} */ @Override protected NioSessionEx accept(IoProcessor<NioSessionEx> processor, ServerSocketChannel handle) throws Exception { SelectionKey key = handle.keyFor(selector); if ((key == null) || (!key.isValid()) || (!key.isAcceptable())) { return null; } // accept the connection from the client SocketChannel ch = handle.accept(); if (ch == null) { return null; } final NioSocketSessionEx session = new NioSocketSessionEx(this, processor, ch); try { session.initSessionConfig(); return session; } catch (RuntimeIoException e) { if (AbstractIoSessionConfig.REPORT_SESSION_CONFIG_FAILURE) { throw e; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Unexpected exception initializing session " + "TCP options. Rejecting connection.", e); } return null; } }
"Address not bound: " + request.address); } else { SelectionKey key = ssc.keyFor(selector); request.registrationRequest = (RegistrationRequest) key .attachment();
"Address not bound: " + request.address); } else { SelectionKey key = ssc.keyFor(selector); request.registrationRequest = (RegistrationRequest) key .attachment();
if (server != null) { if (debugEnabled) log.debug("port {} already used, not creating nio server", port); final SelectionKey key = server.keyFor(selector); @SuppressWarnings("unchecked") final Map<String, Object> map = (Map<String, Object>) key.attachment();
this.serverChannel.keyFor(this.selector).cancel(); this.serverChannel.close(); this.selector.close();
SelectionKey key = ssc.keyFor( selector ); request.registrationRequest = ( RegistrationRequest ) key.attachment(); key.cancel();