private void closeSelector() { channel.selector = null; try { selector.close(); } catch (Exception e) { if (logger.isWarnEnabled()) { logger.warn("Failed to close a selector.", e); } } }
Boss(SctpServerChannelImpl channel) throws IOException { this.channel = channel; selector = Selector.open(); boolean registered = false; try { channel.serverChannel.register(selector, SelectionKey.OP_ACCEPT); registered = true; } finally { if (!registered) { closeSelector(); } } channel.selector = selector; }