共用方式為


Selector.SelectNow Method

Definition

Overloads

SelectNow()

Selects a set of keys whose corresponding channels are ready for I/O operations.

SelectNow(IConsumer)

Selects and performs an action on the keys whose corresponding channels are ready for I/O operations.

SelectNow()

Selects a set of keys whose corresponding channels are ready for I/O operations.

[Android.Runtime.Register("selectNow", "()I", "GetSelectNowHandler")]
public abstract int SelectNow ();
[<Android.Runtime.Register("selectNow", "()I", "GetSelectNowHandler")>]
abstract member SelectNow : unit -> int

Returns

The number of keys, possibly zero, whose ready-operation sets were updated by the selection operation

Attributes

Exceptions

if an I/O error occurrs.

if the selector is closed.

Remarks

Selects a set of keys whose corresponding channels are ready for I/O operations.

This method performs a non-blocking selection operation. If no channels have become selectable since the previous selection operation then this method immediately returns zero.

Invoking this method clears the effect of any previous invocations of the #wakeup wakeup method.

Java documentation for java.nio.channels.Selector.selectNow().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SelectNow(IConsumer)

Selects and performs an action on the keys whose corresponding channels are ready for I/O operations.

[Android.Runtime.Register("selectNow", "(Ljava/util/function/Consumer;)I", "GetSelectNow_Ljava_util_function_Consumer_Handler", ApiSince=33)]
public virtual int SelectNow (Java.Util.Functions.IConsumer? action);
[<Android.Runtime.Register("selectNow", "(Ljava/util/function/Consumer;)I", "GetSelectNow_Ljava_util_function_Consumer_Handler", ApiSince=33)>]
abstract member SelectNow : Java.Util.Functions.IConsumer -> int
override this.SelectNow : Java.Util.Functions.IConsumer -> int

Parameters

action
IConsumer

The action to perform

Returns

The number of unique keys consumed, possibly zero

Attributes

Remarks

Selects and performs an action on the keys whose corresponding channels are ready for I/O operations.

This method performs a non-blocking selection operation.

Invoking this method clears the effect of any previous invocations of the #wakeup wakeup method.

Added in 11.

Java documentation for java.nio.channels.Selector.selectNow(java.util.function.Consumer<java.nio.channels.SelectionKey>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to