APIdia Launch Partner
Top Description Fields Constructors Methods
java.nio.channels.spi

public abstract Class AbstractSelectionKey

extends SelectionKey
Class Inheritance
Known Direct Subclasses
sun.nio.ch.SelectionKeyImpl
Imports
java.lang.invoke.MethodHandles, .VarHandle, java.nio.channels.SelectionKey, .Selector, jdk.internal.invoke.MhUtil, sun.nio.ch.SelectionKeyImpl, .SelectorImpl

Base implementation class for selection keys.

This class tracks the validity of the key and implements cancellation.

Authors
Mark Reinhold, JSR-51 Expert Group
Since
1.4

Field Summary

Modifier and TypeField and Description
private static final VarHandle
private volatile boolean
Inherited from java.nio.channels.SelectionKey:
OP_ACCEPTOP_CONNECTOP_READOP_WRITE

Constructor Summary

AccessConstructor and Description
protected
AbstractSelectionKey()

Initializes a new instance of this class.

Method Summary

Modifier and TypeMethod and Description
public final void
cancel()

Implements abstract java.nio.channels.SelectionKey.cancel.

Cancels this key.

pack-priv void
public final boolean
isValid()

Implements abstract java.nio.channels.SelectionKey.isValid.

Tells whether or not this key is valid.

Inherited from java.nio.channels.SelectionKey:
attachattachmentchannelinterestOpsinterestOpsinterestOpsAndinterestOpsOrisAcceptableisConnectableisReadableisWritablereadyOpsselector

Field Detail

INVALIDback to summary
private static final VarHandle INVALID
invalidback to summary
private volatile boolean invalid

Constructor Detail

AbstractSelectionKeyback to summary
protected AbstractSelectionKey()

Initializes a new instance of this class.

Method Detail

cancelback to summary
public final void cancel()

Implements abstract java.nio.channels.SelectionKey.cancel.

Cancels this key.

If this key has not yet been cancelled then it is added to its selector's cancelled-key set while synchronized on that set.

invalidateback to summary
pack-priv void invalidate()
isValidback to summary
public final boolean isValid()

Implements abstract java.nio.channels.SelectionKey.isValid.

Doc from java.nio.channels.SelectionKey.isValid.

Tells whether or not this key is valid.

A key is valid upon creation and remains so until it is cancelled, its channel is closed, or its selector is closed.