Compartir a través de


AbstractSelectableChannel.Register(Selector, Operations, Object) Method

Definition

Registers this channel with the given selector, returning a selection key.

[Android.Runtime.Register("register", "(Ljava/nio/channels/Selector;ILjava/lang/Object;)Ljava/nio/channels/SelectionKey;", "")]
public override sealed Java.Nio.Channels.SelectionKey? Register (Java.Nio.Channels.Selector? sel, Java.Nio.Channels.Operations ops, Java.Lang.Object? att);
[<Android.Runtime.Register("register", "(Ljava/nio/channels/Selector;ILjava/lang/Object;)Ljava/nio/channels/SelectionKey;", "")>]
override this.Register : Java.Nio.Channels.Selector * Java.Nio.Channels.Operations * Java.Lang.Object -> Java.Nio.Channels.SelectionKey

Parameters

sel
Selector
att
Object

Returns

Attributes

Exceptions

if this channel is registered but its key has been canceled.

if this channel is closed.

if interestSet is not supported by this channel.

if this channel is in blocking mode.

if this channel does not have the same provider as the given selector.

Remarks

Registers this channel with the given selector, returning a selection key.

This method first verifies that this channel is open and that the given initial interest set is valid.

If this channel is already registered with the given selector then the selection key representing that registration is returned after setting its interest set to the given value.

Otherwise this channel has not yet been registered with the given selector, so the AbstractSelector#register register method of the selector is invoked while holding the appropriate locks. The resulting key is added to this channel's key set before being returned.

Java documentation for java.nio.channels.spi.AbstractSelectableChannel.register(java.nio.channels.Selector, int, java.lang.Object).

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