ForkJoinPool Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| ForkJoinPool() |
Creates a |
| ForkJoinPool(Int32) |
Creates a |
| ForkJoinPool(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
| ForkJoinPool(Int32, ForkJoinPool+IForkJoinWorkerThreadFactory, Thread+IUncaughtExceptionHandler, Boolean) |
Creates a |
| ForkJoinPool(Int32, ForkJoinPool+IForkJoinWorkerThreadFactory, Thread+IUncaughtExceptionHandler, Boolean, Int32, Int32, Int32, IPredicate, Int64, TimeUnit) |
Creates a ForkJoinPool with the given parameters. |
ForkJoinPool()
Creates a ForkJoinPool with parallelism equal to java.lang.Runtime#availableProcessors, using defaults for all
other parameters (see #ForkJoinPool(int,
ForkJoinWorkerThreadFactory, UncaughtExceptionHandler, boolean,
int, int, int, Predicate, long, TimeUnit)).
[Android.Runtime.Register(".ctor", "()V", "")]
public ForkJoinPool();
- Attributes
Remarks
Creates a ForkJoinPool with parallelism equal to java.lang.Runtime#availableProcessors, using defaults for all other parameters (see #ForkJoinPool(int, ForkJoinWorkerThreadFactory, UncaughtExceptionHandler, boolean, int, int, int, Predicate, long, TimeUnit)).
Java documentation for java.util.concurrent.ForkJoinPool.ForkJoinPool().
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
ForkJoinPool(Int32)
Creates a ForkJoinPool with the indicated parallelism
level, using defaults for all other parameters (see #ForkJoinPool(int, ForkJoinWorkerThreadFactory,
UncaughtExceptionHandler, boolean, int, int, int, Predicate,
long, TimeUnit)).
[Android.Runtime.Register(".ctor", "(I)V", "")]
public ForkJoinPool(int parallelism);
[<Android.Runtime.Register(".ctor", "(I)V", "")>]
new Java.Util.Concurrent.ForkJoinPool : int -> Java.Util.Concurrent.ForkJoinPool
Parameters
- parallelism
- Int32
the parallelism level
- Attributes
Exceptions
if parallelism less than or equal to zero, or greater than implementation limit
Remarks
Creates a ForkJoinPool with the indicated parallelism level, using defaults for all other parameters (see #ForkJoinPool(int, ForkJoinWorkerThreadFactory, UncaughtExceptionHandler, boolean, int, int, int, Predicate, long, TimeUnit)).
Java documentation for java.util.concurrent.ForkJoinPool.ForkJoinPool(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
ForkJoinPool(IntPtr, JniHandleOwnership)
A constructor used when creating managed representations of JNI objects; called by the runtime.
protected ForkJoinPool(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Java.Util.Concurrent.ForkJoinPool : nativeint * Android.Runtime.JniHandleOwnership -> Java.Util.Concurrent.ForkJoinPool
Parameters
- transfer
- JniHandleOwnership
A JniHandleOwnershipindicating how to handle javaReference
Remarks
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
ForkJoinPool(Int32, ForkJoinPool+IForkJoinWorkerThreadFactory, Thread+IUncaughtExceptionHandler, Boolean)
Creates a ForkJoinPool with parallelism equal to java.lang.Runtime#availableProcessors, using the #defaultForkJoinWorkerThreadFactory default thread factory,
no UncaughtExceptionHandler, and non-async LIFO processing mode.
[Android.Runtime.Register(".ctor", "(ILjava/util/concurrent/ForkJoinPool$ForkJoinWorkerThreadFactory;Ljava/lang/Thread$UncaughtExceptionHandler;Z)V", "")]
public ForkJoinPool(int parallelism, Java.Util.Concurrent.ForkJoinPool.IForkJoinWorkerThreadFactory? factory, Java.Lang.Thread.IUncaughtExceptionHandler? handler, bool asyncMode);
[<Android.Runtime.Register(".ctor", "(ILjava/util/concurrent/ForkJoinPool$ForkJoinWorkerThreadFactory;Ljava/lang/Thread$UncaughtExceptionHandler;Z)V", "")>]
new Java.Util.Concurrent.ForkJoinPool : int * Java.Util.Concurrent.ForkJoinPool.IForkJoinWorkerThreadFactory * Java.Lang.Thread.IUncaughtExceptionHandler * bool -> Java.Util.Concurrent.ForkJoinPool
Parameters
- parallelism
- Int32
the parallelism level. For default value, use Runtime.availableProcessors().
the factory for creating new threads. For default value, use defaultForkJoinWorkerThreadFactory.
- handler
- Thread.IUncaughtExceptionHandler
the handler for internal worker threads that terminate due to unrecoverable errors encountered while executing tasks. For default value, use null.
- asyncMode
- Boolean
if true, establishes local first-in-first-out scheduling mode for forked tasks that are never joined. This mode may be more appropriate than default locally stack-based mode in applications in which worker threads only process event-style asynchronous tasks. For default value, use false.
- Attributes
Exceptions
if parallelism less than or equal to zero, or greater than implementation limit
if the factory is null
Remarks
Java reference for java.util.concurrent.ForkJoinPool.ForkJoinPool.
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
ForkJoinPool(Int32, ForkJoinPool+IForkJoinWorkerThreadFactory, Thread+IUncaughtExceptionHandler, Boolean, Int32, Int32, Int32, IPredicate, Int64, TimeUnit)
Creates a ForkJoinPool with the given parameters.
[Android.Runtime.Register(".ctor", "(ILjava/util/concurrent/ForkJoinPool$ForkJoinWorkerThreadFactory;Ljava/lang/Thread$UncaughtExceptionHandler;ZIIILjava/util/function/Predicate;JLjava/util/concurrent/TimeUnit;)V", "", ApiSince=33)]
public ForkJoinPool(int parallelism, Java.Util.Concurrent.ForkJoinPool.IForkJoinWorkerThreadFactory? factory, Java.Lang.Thread.IUncaughtExceptionHandler? handler, bool asyncMode, int corePoolSize, int maximumPoolSize, int minimumRunnable, Java.Util.Functions.IPredicate? saturate, long keepAliveTime, Java.Util.Concurrent.TimeUnit? unit);
[<Android.Runtime.Register(".ctor", "(ILjava/util/concurrent/ForkJoinPool$ForkJoinWorkerThreadFactory;Ljava/lang/Thread$UncaughtExceptionHandler;ZIIILjava/util/function/Predicate;JLjava/util/concurrent/TimeUnit;)V", "", ApiSince=33)>]
new Java.Util.Concurrent.ForkJoinPool : int * Java.Util.Concurrent.ForkJoinPool.IForkJoinWorkerThreadFactory * Java.Lang.Thread.IUncaughtExceptionHandler * bool * int * int * int * Java.Util.Functions.IPredicate * int64 * Java.Util.Concurrent.TimeUnit -> Java.Util.Concurrent.ForkJoinPool
Parameters
- parallelism
- Int32
the parallelism level. For default value, use Runtime.availableProcessors().
the factory for creating new threads. For default value, use defaultForkJoinWorkerThreadFactory.
- handler
- Thread.IUncaughtExceptionHandler
the handler for internal worker threads that terminate due to unrecoverable errors encountered while executing tasks. For default value, use null.
- asyncMode
- Boolean
if true, establishes local first-in-first-out scheduling mode for forked tasks that are never joined. This mode may be more appropriate than default locally stack-based mode in applications in which worker threads only process event-style asynchronous tasks. For default value, use false.
- corePoolSize
- Int32
the number of threads to keep in the pool (unless timed out after an elapsed keep-alive). Normally (and by default) this is the same value as the parallelism level, but may be set to a larger value to reduce dynamic overhead if tasks regularly block. Using a smaller value (for example 0) has the same effect as the default.
- maximumPoolSize
- Int32
the maximum number of threads allowed. When the maximum is reached, attempts to replace blocked threads fail. (However, because creation and termination of different threads may overlap, and may be managed by the given thread factory, this value may be transiently exceeded.) To arrange the same value as is used by default for the common pool, use 256 plus the parallelism level. (By default, the common pool allows a maximum of 256 spare threads.) Using a value (for example Integer.MAX_VALUE) larger than the implementation's total thread limit has the same effect as using this limit (which is the default).
- minimumRunnable
- Int32
the minimum allowed number of core threads not blocked by a join or ForkJoinPool.ManagedBlocker. To ensure progress, when too few unblocked threads exist and unexecuted tasks may exist, new threads are constructed, up to the given maximumPoolSize. For the default value, use 1, that ensures liveness. A larger value might improve throughput in the presence of blocked activities, but might not, due to increased overhead. A value of zero may be acceptable when submitted tasks cannot have dependencies requiring additional threads.
- saturate
- IPredicate
if non-null, a predicate invoked upon attempts to create more than the maximum total allowed threads. By default, when a thread is about to block on a join or ForkJoinPool.ManagedBlocker, but cannot be replaced because the maximumPoolSize would be exceeded, a RejectedExecutionException is thrown. But if this predicate returns true, then no exception is thrown, so the pool continues to operate with fewer than the target number of runnable threads, which might not ensure progress.
- keepAliveTime
- Int64
the elapsed time since last use before a thread is terminated (and then later replaced if needed). For the default value, use 60, TimeUnit.SECONDS.
- unit
- TimeUnit
the time unit for the keepAliveTime argument
- Attributes
Remarks
Creates a ForkJoinPool with the given parameters.
Java reference for java.util.concurrent.ForkJoinPool.ForkJoinPool.