Executors.NewCachedThreadPool Method

Definition

Overloads

NewCachedThreadPool()

Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available.

NewCachedThreadPool(IThreadFactory)

Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available, and uses the provided ThreadFactory to create new threads when needed.

NewCachedThreadPool()

Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available.

[Android.Runtime.Register("newCachedThreadPool", "()Ljava/util/concurrent/ExecutorService;", "")]
public static Java.Util.Concurrent.IExecutorService? NewCachedThreadPool ();
[<Android.Runtime.Register("newCachedThreadPool", "()Ljava/util/concurrent/ExecutorService;", "")>]
static member NewCachedThreadPool : unit -> Java.Util.Concurrent.IExecutorService

Returns

the newly created thread pool

Attributes

Remarks

Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available. These pools will typically improve the performance of programs that execute many short-lived asynchronous tasks. Calls to execute will reuse previously constructed threads if available. If no existing thread is available, a new thread will be created and added to the pool. Threads that have not been used for sixty seconds are terminated and removed from the cache. Thus, a pool that remains idle for long enough will not consume any resources. Note that pools with similar properties but different details (for example, timeout parameters) may be created using ThreadPoolExecutor constructors.

Java documentation for java.util.concurrent.Executors.newCachedThreadPool().

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

NewCachedThreadPool(IThreadFactory)

Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available, and uses the provided ThreadFactory to create new threads when needed.

[Android.Runtime.Register("newCachedThreadPool", "(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;", "")]
public static Java.Util.Concurrent.IExecutorService? NewCachedThreadPool (Java.Util.Concurrent.IThreadFactory? threadFactory);
[<Android.Runtime.Register("newCachedThreadPool", "(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;", "")>]
static member NewCachedThreadPool : Java.Util.Concurrent.IThreadFactory -> Java.Util.Concurrent.IExecutorService

Parameters

threadFactory
IThreadFactory

the factory to use when creating new threads

Returns

the newly created thread pool

Attributes

Exceptions

if threadFactory is null

Remarks

Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available, and uses the provided ThreadFactory to create new threads when needed.

Java documentation for java.util.concurrent.Executors.newCachedThreadPool(java.util.concurrent.ThreadFactory).

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