Package co.paralleluniverse.fibers
Class FiberExecutorScheduler
- java.lang.Object
-
- co.paralleluniverse.fibers.FiberScheduler
-
- co.paralleluniverse.fibers.FiberExecutorScheduler
-
- All Implemented Interfaces:
FiberFactory
,StrandFactory
,java.util.concurrent.Executor
public class FiberExecutorScheduler extends FiberScheduler implements java.util.concurrent.Executor
A fiber scheduler that uses a givenExecutor
for scheduling. TheRunnable
tasks passed to theExecutor
for execution, implement theFiberSchedulerTask
interface.
-
-
Constructor Summary
Constructors Constructor Description FiberExecutorScheduler(java.lang.String name, java.util.concurrent.Executor executor)
Creates a new fiber scheduler with no monitor.FiberExecutorScheduler(java.lang.String name, java.util.concurrent.Executor executor, co.paralleluniverse.common.monitoring.MonitorType monitorType, boolean detailedInfo)
Creates a new fiber scheduler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(java.lang.Runnable command)
java.util.concurrent.Executor
getExecutor()
protected int
getQueueLength()
protected java.util.Map<java.lang.Thread,Fiber>
getRunningFibers()
protected boolean
isCurrentThreadInScheduler()
void
shutdown()
-
Methods inherited from class co.paralleluniverse.fibers.FiberScheduler
getMonitor, getName, newFiber, newStrand
-
-
-
-
Constructor Detail
-
FiberExecutorScheduler
public FiberExecutorScheduler(java.lang.String name, java.util.concurrent.Executor executor, 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.executor
- anExecutor
used to schedule the fibers; may benull
if theexecute(Runnable)
method is overriden.monitorType
- theMonitorType
type to use for the scheduler.detailedInfo
- whether detailed information about the fibers is collected by the fibers monitor.
-
FiberExecutorScheduler
public FiberExecutorScheduler(java.lang.String name, java.util.concurrent.Executor executor)
Creates a new fiber scheduler with no monitor.- Parameters:
name
- the scheuler's name. This name is used in naming the scheduler's threads.executor
- anExecutor
used to schedule the fibers; may benull
if theexecute(Runnable)
method is overriden.
-
-
Method Detail
-
shutdown
public void shutdown()
- Overrides:
shutdown
in classFiberScheduler
-
isCurrentThreadInScheduler
protected boolean isCurrentThreadInScheduler()
- Specified by:
isCurrentThreadInScheduler
in classFiberScheduler
-
getQueueLength
protected int getQueueLength()
- Specified by:
getQueueLength
in classFiberScheduler
-
execute
public void execute(java.lang.Runnable command)
- Specified by:
execute
in interfacejava.util.concurrent.Executor
-
getRunningFibers
protected java.util.Map<java.lang.Thread,Fiber> getRunningFibers()
-
getExecutor
public java.util.concurrent.Executor getExecutor()
- Specified by:
getExecutor
in classFiberScheduler
-
-