public class SplitPolicy
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static short |
DFLT_MAX_TASKS_PER_CORE
Default value for maximum average number of subtasks per core.
|
static int |
DFLT_MIN_TASK_SIZE
Default value for minimum subtask size.
|
static SplitPolicy |
DFLT_POLICY
Default splitting policy.
|
Constructor and Description |
---|
SplitPolicy()
Constructs a policy with default configuration.
|
SplitPolicy(java.util.function.Supplier<java.util.concurrent.ForkJoinPool> fjPoolSupplier,
int minTaskSize,
short maxTasksPerCore)
Constructs a policy with supplied configuration options.
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.ForkJoinPool |
getForkJoinPool()
Returns the ForkJoinPool used by this policy.
|
short |
getMaxTasksPerCore()
Returns the maximum number of tasks (on average) to be executed
on each core as a result of decomposition, or zero for no limit.
|
int |
getMinTaskSize()
Returns the smallest task size used by this policy.
|
java.lang.String |
toString() |
boolean |
willAttemptSplit(Splittable<?> content)
Indicates whether an attempt should be made to split a splittable
in order to process it.
|
public static final int DFLT_MIN_TASK_SIZE
ForkJoinTask
javadocs recommend
as a rough rule of thumb a value in the range of 1e2-1e4 steps,
so this possibly could be reduced.public static final short DFLT_MAX_TASKS_PER_CORE
Spliterator
javadocs.public static final SplitPolicy DFLT_POLICY
public SplitPolicy()
public SplitPolicy(java.util.function.Supplier<java.util.concurrent.ForkJoinPool> fjPoolSupplier, int minTaskSize, short maxTasksPerCore)
fjPoolSupplier
- supplier for fork/join pool for execution,
or null to use the common pool;
if non-null this supplier will be used
a maximum of once for lazy acquisitionminTaskSize
- smallest acceptable size of sub-task
to split tasks into, or non-positive value
for default (DFLT_MIN_TASK_SIZE
)maxTasksPerCore
- maximum number of tasks (on average)
to be executed on each core as a result
of decomposition, or zero for no limit,
or negative value for default limit
(DFLT_MAX_TASKS_PER_CORE
)public java.util.concurrent.ForkJoinPool getForkJoinPool()
public int getMinTaskSize()
public short getMaxTasksPerCore()
public boolean willAttemptSplit(Splittable<?> content)
content
- splittablepublic java.lang.String toString()
toString
in class java.lang.Object