示例#1
0
 /**
  * This implementation defers to the {@link #accept(SelectionKey)} method if a connection is
  * pending. In all other cases it defers to it's parent.
  *
  * @param key The {@link SelectionKey} for the socket on which an I/O operation is pending.
  * @throws IOException if an error occurs while processing the pending event.
  */
 protected void handleSelectionKeyOperation(SelectionKey key) throws IOException {
   if (key.isValid() && key.isAcceptable()) {
     this.accept(key);
   } else {
     super.handleSelectionKeyOperation(key);
   }
 }
示例#2
0
  protected void deregisterSocket(Socket socket) {
    TimerTask task = (TimerTask) this.socketActivity.remove(socket);
    if (task != null) {
      task.cancel();
    }

    super.deregisterSocket(socket);
  }
示例#3
0
 protected void write(SelectionKey key) throws IOException {
   SocketChannel socketChannel = (SocketChannel) key.channel();
   this.resetClientTimer(socketChannel.socket());
   super.write(key);
 }