public class RotatingTaskScheduler extends Object implements TaskScheduler
TaskScheduler that delegates to the registered TimerDrivenModules in round-robin fashion, in the order
in which the modules were registered. All work performed by this implementation is done by a single thread.| Constructor and Description |
|---|
RotatingTaskScheduler(org.neo4j.graphdb.GraphDatabaseService database,
ModuleMetadataRepository repository,
TimingStrategy timingStrategy)
Construct a new task scheduler.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
hasCorrectRole(TimerDrivenModule<?> module)
Check if the given module has the correct role (e.g.
|
protected Runnable |
nextTask()
Create next task wrapped in a
Runnable. |
<C extends TimerDrivenModuleContext,T extends TimerDrivenModule<C>> |
registerModuleAndContext(T module,
C context)
Register a module and its context.
|
void |
start()
Start scheduling tasks / delegating work to registered modules.
|
void |
stop()
Stop scheduling tasks.
|
public RotatingTaskScheduler(org.neo4j.graphdb.GraphDatabaseService database,
ModuleMetadataRepository repository,
TimingStrategy timingStrategy)
database - against which the modules are running.repository - for persisting metadata.timingStrategy - strategy for timing the work delegation.public <C extends TimerDrivenModuleContext,T extends TimerDrivenModule<C>> void registerModuleAndContext(T module, C context)
TaskScheduler.start().registerModuleAndContext in interface TaskSchedulerC - type of the metadata.T - type of the module.module - to register.context - of the module.public void start()
start in interface TaskSchedulerpublic void stop()
stop in interface TaskSchedulerprotected boolean hasCorrectRole(TimerDrivenModule<?> module)
module - to check for.true iff can run.Copyright © 2013-2016–2018 Graph Aware Limited. All rights reserved.