Freigeben über


AsynchronousChannelGroup.WithThreadPool(IExecutorService) Method

Definition

Creates an asynchronous channel group with a given thread pool.

[Android.Runtime.Register("withThreadPool", "(Ljava/util/concurrent/ExecutorService;)Ljava/nio/channels/AsynchronousChannelGroup;", "", ApiSince=26)]
public static Java.Nio.Channels.AsynchronousChannelGroup? WithThreadPool (Java.Util.Concurrent.IExecutorService? executor);
[<Android.Runtime.Register("withThreadPool", "(Ljava/util/concurrent/ExecutorService;)Ljava/nio/channels/AsynchronousChannelGroup;", "", ApiSince=26)>]
static member WithThreadPool : Java.Util.Concurrent.IExecutorService -> Java.Nio.Channels.AsynchronousChannelGroup

Parameters

executor
IExecutorService

The thread pool for the resulting group

Returns

A new asynchronous channel group

Attributes

Remarks

Creates an asynchronous channel group with a given thread pool.

The executor parameter is an ExecutorService that executes tasks submitted to dispatch completion results for operations initiated on asynchronous channels in the group.

Care should be taken when configuring the executor service. It should support <em>direct handoff</em> or <em>unbounded queuing</em> of submitted tasks, and the thread that invokes the ExecutorService#execute execute method should never invoke the task directly. An implementation may mandate additional constraints.

The executor is intended to be used exclusively by the resulting asynchronous channel group. Termination of the group results in the orderly ExecutorService#shutdown shutdown of the executor service. Shutting down the executor service by other means results in unspecified behavior.

The group is created by invoking the AsynchronousChannelProvider#openAsynchronousChannelGroup(ExecutorService,int) openAsynchronousChannelGroup(ExecutorService,int) method of the system-wide default AsynchronousChannelProvider object with an initialSize of 0.

Java documentation for java.nio.channels.AsynchronousChannelGroup.withThreadPool(java.util.concurrent.ExecutorService).

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