AsynchronousChannelGroup.WithCachedThreadPool(IExecutorService, Int32) Method

Definition

Creates an asynchronous channel group with a given thread pool that creates new threads as needed.

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

Parameters

executor
IExecutorService

The thread pool for the resulting group

initialSize
Int32

A value >=0 or a negative value for implementation specific default

Returns

A new asynchronous channel group

Attributes

Remarks

Creates an asynchronous channel group with a given thread pool that creates new threads as needed.

The executor parameter is an ExecutorService that creates new threads as needed to execute tasks that are submitted to handle I/O events and dispatch completion results for operations initiated on asynchronous channels in the group. It may reuse previously constructed threads when they are available.

The initialSize parameter may be used by the implementation as a <em>hint</em> as to the initial number of tasks it may submit. For example, it may be used to indicate the initial number of threads that wait on I/O events.

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.

Java documentation for java.nio.channels.AsynchronousChannelGroup.withCachedThreadPool(java.util.concurrent.ExecutorService, int).

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