Package jadex.platform.service.cron
Class CronAgent
- java.lang.Object
-
- jadex.platform.service.cron.CronAgent
-
- All Implemented Interfaces:
ICronService
public class CronAgent extends java.lang.Object implements ICronService
The cron agent is an agent based implementation of unix cron. Allows for specifying time pattern and a job. The time pattern will be checked every minute and the job will be executed if the pattern matches. The pattern corresponds to the way unix cron patterns are defined: * * * * * Min Hour Day of Month Month Mo-Fr 0-59 0-23 1-31 1-12 0-6 Specification allows for: - wildcard: * (any value) - value: 1 - values: 2,3,4 - range: 1-5 - steps: *\/5 (every 5) - combined patterns: p1|p2|p3
-
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccessagentThe agent.protected java.util.Map<java.lang.String,Tuple2<CronJob<?>,SubscriptionIntermediateFuture<?>>>jobsThe cron jobs (id -> job).protected longlookaheadThe agent lookahead.protected booleanrealtimeArgument if realtime should be used.protected booleanuseworkeragentThe agent lookahead.
-
Constructor Summary
Constructors Constructor Description CronAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> ISubscriptionIntermediateFuture<T>addJob(CronJob<T> job)Add a schedule job.voidbody()The agent body.IFuture<java.lang.Boolean>containsJob(java.lang.String jobid)Test if a job is scheduled with an id.protected IFuture<java.lang.Void>doExecuteCommand(Tuple2<CronJob<?>,SubscriptionIntermediateFuture<?>> jobtup, long time)Execute the command of a job.protected IFuture<java.lang.Void>executeJob(Tuple2<CronJob<?>,SubscriptionIntermediateFuture<?>> jobtup, long time)Execute a job on worker agent or directly.IFuture<java.lang.Void>removeJob(java.lang.String jobid)Remove a schedule job.
-
-
-
Field Detail
-
realtime
protected boolean realtime
Argument if realtime should be used.
-
lookahead
protected long lookahead
The agent lookahead.
-
useworkeragent
protected boolean useworkeragent
The agent lookahead.
-
jobs
protected java.util.Map<java.lang.String,Tuple2<CronJob<?>,SubscriptionIntermediateFuture<?>>> jobs
The cron jobs (id -> job).
-
agent
protected IInternalAccess agent
The agent.
-
-
Method Detail
-
body
public void body()
The agent body.
-
addJob
public <T> ISubscriptionIntermediateFuture<T> addJob(CronJob<T> job)
Add a schedule job.- Specified by:
addJobin interfaceICronService- Parameters:
job- The cron job.
-
removeJob
public IFuture<java.lang.Void> removeJob(java.lang.String jobid)
Remove a schedule job.- Specified by:
removeJobin interfaceICronService- Parameters:
jobid- The job id.
-
containsJob
public IFuture<java.lang.Boolean> containsJob(java.lang.String jobid)
Test if a job is scheduled with an id.- Specified by:
containsJobin interfaceICronService- Parameters:
jobid- The jobid.
-
executeJob
protected IFuture<java.lang.Void> executeJob(Tuple2<CronJob<?>,SubscriptionIntermediateFuture<?>> jobtup, long time)
Execute a job on worker agent or directly.
-
doExecuteCommand
protected IFuture<java.lang.Void> doExecuteCommand(Tuple2<CronJob<?>,SubscriptionIntermediateFuture<?>> jobtup, long time)
Execute the command of a job.
-
-