|
|
|
@ -41,7 +41,7 @@ import static org.quartz.TriggerBuilder.newTrigger;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Quartz scheduler wrapper used to setup triggers.
|
|
|
|
|
* <p/>
|
|
|
|
|
*
|
|
|
|
|
* Created by Sunand on 6/8/2015.
|
|
|
|
|
*/
|
|
|
|
|
public class RulesEngineScheduler {
|
|
|
|
@ -91,6 +91,7 @@ public class RulesEngineScheduler {
|
|
|
|
|
*
|
|
|
|
|
* @param engine the engine to schedule
|
|
|
|
|
* @param startTime the start time
|
|
|
|
|
* @throws RulesEngineSchedulerException if unable to schedule the rules engine
|
|
|
|
|
*/
|
|
|
|
|
public void scheduleAt(final RulesEngine engine, final Date startTime) throws RulesEngineSchedulerException {
|
|
|
|
|
checkNotNull(engine, "engine");
|
|
|
|
@ -122,6 +123,7 @@ public class RulesEngineScheduler {
|
|
|
|
|
* @param engine the engine to schedule
|
|
|
|
|
* @param startTime the start time
|
|
|
|
|
* @param interval the repeat interval in seconds
|
|
|
|
|
* @throws RulesEngineSchedulerException if unable to schedule the rules engine
|
|
|
|
|
*/
|
|
|
|
|
public void scheduleAtWithInterval(final RulesEngine engine, final Date startTime, final int interval) throws RulesEngineSchedulerException {
|
|
|
|
|
checkNotNull(engine, "engine");
|
|
|
|
@ -159,6 +161,7 @@ public class RulesEngineScheduler {
|
|
|
|
|
* @param cronExpression the cron expression to use.
|
|
|
|
|
* For a complete tutorial about cron expressions, please refer to
|
|
|
|
|
* <a href="http://quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger">quartz reference documentation</a>.
|
|
|
|
|
* @throws RulesEngineSchedulerException if unable to schedule the rules engine
|
|
|
|
|
*/
|
|
|
|
|
public void scheduleCron(final RulesEngine engine, final String cronExpression) throws RulesEngineSchedulerException {
|
|
|
|
|
checkNotNull(engine, "engine");
|
|
|
|
@ -230,7 +233,7 @@ public class RulesEngineScheduler {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Stop the scheduler.
|
|
|
|
|
* <p/>
|
|
|
|
|
*
|
|
|
|
|
* <strong>Note: The scheduler cannot be re-started and no more engines can be scheduled.</strong>
|
|
|
|
|
*
|
|
|
|
|
* @throws RulesEngineSchedulerException thrown if the scheduler cannot be stopped
|
|
|
|
@ -246,6 +249,7 @@ public class RulesEngineScheduler {
|
|
|
|
|
/**
|
|
|
|
|
* Check if the scheduler is started.
|
|
|
|
|
*
|
|
|
|
|
* @return true if the scheduler is started, false else
|
|
|
|
|
* @throws RulesEngineSchedulerException thrown if the scheduler status cannot be checked
|
|
|
|
|
*/
|
|
|
|
|
public boolean isStarted() throws RulesEngineSchedulerException {
|
|
|
|
@ -259,6 +263,7 @@ public class RulesEngineScheduler {
|
|
|
|
|
/**
|
|
|
|
|
* Check if the scheduler is stopped.
|
|
|
|
|
*
|
|
|
|
|
* @return true if the scheduler is stopped, false else
|
|
|
|
|
* @throws RulesEngineSchedulerException thrown if the scheduler status cannot be checked
|
|
|
|
|
*/
|
|
|
|
|
public boolean isStopped() throws RulesEngineSchedulerException {
|
|
|
|
|