Class AbstractSelectionKey

java.lang.Object
java.nio.channels.SelectionKey
java.nio.channels.spi.AbstractSelectionKey

public abstract class AbstractSelectionKey
extends SelectionKey
AbstractSelectionKey is the base implementation class for selection keys. It implements validation and cancellation methods.
  • Constructor Details

    • AbstractSelectionKey

      protected AbstractSelectionKey()
      Constructs a new AbstractSelectionKey.
  • Method Details

    • isValid

      public final boolean isValid()
      Indicates whether this key is valid. A key is valid as long as it has not been canceled.
      Specified by:
      isValid in class SelectionKey
      Returns:
      true if this key has not been canceled, false otherwise.
    • cancel

      public final void cancel()
      Cancels this key.

      A key that has been canceled is no longer valid. Calling this method on an already canceled key does nothing.

      Specified by:
      cancel in class SelectionKey