Example #1
0
 private void closeSelector() {
   channel.selector = null;
   try {
     selector.close();
   } catch (Exception e) {
     if (logger.isWarnEnabled()) {
       logger.warn("Failed to close a selector.", e);
     }
   }
 }
Example #2
0
    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;
    }