Package co.paralleluniverse.fibers
Class FiberForkJoinScheduler
- java.lang.Object
-
- co.paralleluniverse.fibers.FiberScheduler
-
- co.paralleluniverse.fibers.FiberForkJoinScheduler
-
- All Implemented Interfaces:
FiberFactory
,StrandFactory
public class FiberForkJoinScheduler extends FiberScheduler
AForkJoinPool
based scheduler for fibers.
-
-
Constructor Summary
Constructors Constructor Description FiberForkJoinScheduler(java.lang.String name, int parallelism)
Creates a new fiber scheduler using a defaultUncaughtExceptionHandler
and no monitoring.FiberForkJoinScheduler(java.lang.String name, int parallelism, co.paralleluniverse.common.monitoring.MonitorType monitorType, boolean detailedInfo)
Creates a new fiber scheduler using a defaultUncaughtExceptionHandler
.FiberForkJoinScheduler(java.lang.String name, int parallelism, java.lang.Thread.UncaughtExceptionHandler exceptionHandler, co.paralleluniverse.common.monitoring.MonitorType monitorType, boolean detailedInfo)
Creates a new fiber scheduler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.Executor
getExecutor()
java.util.concurrent.ForkJoinPool
getForkJoinPool()
protected int
getQueueLength()
protected boolean
isCurrentThreadInScheduler()
static boolean
isFiberThread(java.lang.Thread t)
protected void
onIdle()
void
shutdown()
-
Methods inherited from class co.paralleluniverse.fibers.FiberScheduler
getMonitor, getName, newFiber, newStrand
-
-
-
-
Constructor Detail
-
FiberForkJoinScheduler
public FiberForkJoinScheduler(java.lang.String name, int parallelism, java.lang.Thread.UncaughtExceptionHandler exceptionHandler, co.paralleluniverse.common.monitoring.MonitorType monitorType, boolean detailedInfo)
Creates a new fiber scheduler.- Parameters:
name
- the scheuler's name. This name is used in naming the scheduler's threads.parallelism
- the number of threads in the poolexceptionHandler
- anUncaughtExceptionHandler
to be used for exceptions thrown in fibers that aren't caught.monitorType
- theMonitorType
type to use for theForkJoinPool
.detailedInfo
- whether detailed information about the fibers is collected by the fibers monitor.
-
FiberForkJoinScheduler
public FiberForkJoinScheduler(java.lang.String name, int parallelism, co.paralleluniverse.common.monitoring.MonitorType monitorType, boolean detailedInfo)
Creates a new fiber scheduler using a defaultUncaughtExceptionHandler
.- Parameters:
name
- the scheuler's name. This name is used in naming the scheduler's threads.parallelism
- the number of threads in the poolmonitorType
- theMonitorType
type to use for theForkJoinPool
.detailedInfo
- whether detailed information about the fibers is collected by the fibers monitor.
-
FiberForkJoinScheduler
public FiberForkJoinScheduler(java.lang.String name, int parallelism)
Creates a new fiber scheduler using a defaultUncaughtExceptionHandler
and no monitoring.- Parameters:
name
- the scheuler's name. This name is used in naming the scheduler's threads.parallelism
- the number of threads in the pool
-
-
Method Detail
-
shutdown
public void shutdown()
- Overrides:
shutdown
in classFiberScheduler
-
getForkJoinPool
public java.util.concurrent.ForkJoinPool getForkJoinPool()
-
getExecutor
public java.util.concurrent.Executor getExecutor()
- Specified by:
getExecutor
in classFiberScheduler
-
getQueueLength
protected int getQueueLength()
- Specified by:
getQueueLength
in classFiberScheduler
-
isCurrentThreadInScheduler
protected final boolean isCurrentThreadInScheduler()
- Specified by:
isCurrentThreadInScheduler
in classFiberScheduler
-
isFiberThread
public static boolean isFiberThread(java.lang.Thread t)
-
onIdle
protected void onIdle()
-
-