コード例 #1
0
  void disableWrites() {
    if (writeChannel == null) return;

    try {
      final SelectionKey selectionKey = writeChannel.keyFor(this.selector);
      selectionKey.interestOps(selectionKey.interestOps() & ~OP_WRITE);
    } catch (Exception e) {
      LOG.error("", e);
    }
  }
コード例 #2
0
  private void enableWrites() {
    if (writeChannel == null) return;

    try {
      final SelectionKey selectionKey = writeChannel.keyFor(this.selector);
      if (selectionKey != null) selectionKey.interestOps(selectionKey.interestOps() | OP_WRITE);
      // we have just enabled it, so don't have to do this again.
      shouldEnableOpWrite = false;
    } catch (Exception e) {
      LOG.error("", e);
    }
  }