Package ortus.boxlang.runtime.services
Class SchedulerService
java.lang.Object
ortus.boxlang.runtime.services.BaseService
ortus.boxlang.runtime.services.SchedulerService
- All Implemented Interfaces:
IService
This service manages all schedulers in the system.
-
Field Summary
Fields inherited from class ortus.boxlang.runtime.services.BaseService
name, runtime, timerUtil -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearSchedulers(Boolean force, Long timeout) Clear all schedulers from the service.getScheduler(Key name) Get a scheduler by nameGet all schedulersbooleanhasScheduler(Key name) Do we have a scheduler by this name?loadScheduler(Key name, IScheduler scheduler) This method is used to load a scheduler into the service.voidonShutdown(Boolean force) The shutdown event is fired when the runtime shuts downvoidThe startup event is fired when the runtime starts upregisterScheduler(IScheduler scheduler) Register a scheduler with the serviceregisterScheduler(IScheduler scheduler, Boolean force) Register a scheduler with the servicebooleanremoveScheduler(Key name) Remove a scheduler from the service.booleanremoveScheduler(Key name, boolean force, long timeout) Remove a scheduler from the service.booleanrestartScheduler(Key name) Restart the scheduler if it exists.booleanrestartScheduler(Key name, boolean force, long timeout) Restart the scheduler if it existsintsize()How many schedulers do we have registeredStartup all the registered schedulers This is called by the runtime when it starts upMethods inherited from class ortus.boxlang.runtime.services.BaseService
announce, announce, announce, announce, getName, getRuntime, getTimerUtil
-
Constructor Details
-
SchedulerService
Constructor- Parameters:
runtime- The BoxRuntime
-
-
Method Details
-
onStartup
public void onStartup()The startup event is fired when the runtime starts up- Specified by:
onStartupin interfaceIService- Specified by:
onStartupin classBaseService
-
onShutdown
The shutdown event is fired when the runtime shuts down- Specified by:
onShutdownin interfaceIService- Specified by:
onShutdownin classBaseService- Parameters:
force- If true, forces the shutdown of the scheduler
-
startupSchedulers
Startup all the registered schedulers This is called by the runtime when it starts up -
getSchedulers
Get all schedulers- Returns:
- The schedulers
-
getScheduler
Get a scheduler by name- Parameters:
name- The name of the scheduler- Returns:
- The scheduler or null if not found
-
size
public int size()How many schedulers do we have registered- Returns:
- The number of schedulers
-
hasScheduler
Do we have a scheduler by this name?- Parameters:
name- The name of the scheduler
-
registerScheduler
Register a scheduler with the service- Parameters:
scheduler- The IScheduler to register- Returns:
- The scheduler
- Throws:
BoxRuntimeException- If a scheduler with the same name already exists
-
registerScheduler
Register a scheduler with the service- Parameters:
scheduler- The IScheduler to registerforce- If true, forces the registration of the scheduler- Returns:
- The scheduler
- Throws:
BoxRuntimeException- If a scheduler with the same name already exists
-
loadScheduler
This method is used to load a scheduler into the service. If the scheduler already exists, it will be replaced. This is usually used from the ModuleService to load a module scheduler- Parameters:
name- The name of the schedulerscheduler- The IScheduler to load- Returns:
-
removeScheduler
Remove a scheduler from the service. This will also shutdown the scheduler.- Parameters:
name- The name of the schedulerforce- If true, forces the shutdown of the schedulertimeout- The timeout in milliseconds to wait for the scheduler to shutdown- Returns:
- True if the scheduler was removed, false if it was not found
-
removeScheduler
Remove a scheduler from the service. This will also shutdown the scheduler gracefully- Parameters:
name- The name of the scheduler- Returns:
- True if the scheduler was removed, false if it was not found
-
clearSchedulers
Clear all schedulers from the service. This will also shutdown all the schedulers- Parameters:
force- If true, forces the shutdown of the schedulertimeout- The timeout in milliseconds to wait for the scheduler to shutdown
-
restartScheduler
Restart the scheduler if it exists- Parameters:
name- The name of the schedulerforce- If true, forces the shutdown of the schedulertimeout- The timeout in milliseconds to wait for the scheduler to shutdown
-
restartScheduler
Restart the scheduler if it exists. Not forced- Parameters:
name- The name of the scheduler
-