Package io.deephaven.engine.table.impl
Class ForkJoinPoolOperationInitializer
java.lang.Object
io.deephaven.engine.table.impl.ForkJoinPoolOperationInitializer
- All Implemented Interfaces:
OperationInitializer
Implementation of
OperationInitializer
that delegates to a ForkJoinPool
.-
Field Summary
Fields inherited from interface io.deephaven.engine.updategraph.OperationInitializer
NON_PARALLELIZABLE
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether the current thread can parallelize operations using this OperationInitialization.static Runnable
ensureParallelizable
(@NotNull Runnable task) Ensure thattask
is parallelizable within the currentExecutionContext
, by wrapping it with a newExecutionContext
that usesfromCommonPool()
if the currentExecutionContext
does notallow parallelization
.static <T> Supplier<T>
ensureParallelizable
(@NotNull Supplier<T> task) Ensure thattask
is parallelizable within the currentExecutionContext
, by wrapping it with a newExecutionContext
that usesfromCommonPool()
if the currentExecutionContext
does notallow parallelization
.static @NotNull OperationInitializer
int
Number of threads that are potentially available.@NotNull Future<?>
Submits a task to run in this thread pool.
-
Method Details
-
fromCommonPool
-
canParallelize
public boolean canParallelize()Description copied from interface:OperationInitializer
Whether the current thread can parallelize operations using this OperationInitialization.- Specified by:
canParallelize
in interfaceOperationInitializer
-
submit
Description copied from interface:OperationInitializer
Submits a task to run in this thread pool.- Specified by:
submit
in interfaceOperationInitializer
-
parallelismFactor
public int parallelismFactor()Description copied from interface:OperationInitializer
Number of threads that are potentially available.- Specified by:
parallelismFactor
in interfaceOperationInitializer
-
ensureParallelizable
Ensure thattask
is parallelizable within the currentExecutionContext
, by wrapping it with a newExecutionContext
that usesfromCommonPool()
if the currentExecutionContext
does notallow parallelization
.- Parameters:
task
- The task to possible wrap- Returns:
- The possibly-wrapped task
-
ensureParallelizable
Ensure thattask
is parallelizable within the currentExecutionContext
, by wrapping it with a newExecutionContext
that usesfromCommonPool()
if the currentExecutionContext
does notallow parallelization
.- Parameters:
task
- The task to possible wrap- Returns:
- The possibly-wrapped task
-