Пример #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);
 }