01: package org.jbpm.scheduler.ejbtimer;
02:
03: import org.apache.commons.logging.Log;
04: import org.apache.commons.logging.LogFactory;
05: import org.jbpm.JbpmContext;
06: import org.jbpm.command.Command;
07: import org.jbpm.job.Timer;
08:
09: public class ExecuteTimerCommand implements Command {
10:
11: private static final long serialVersionUID = 1L;
12:
13: long timerId;
14:
15: public ExecuteTimerCommand(long timerId) {
16: this .timerId = timerId;
17: }
18:
19: public Object execute(JbpmContext jbpmContext) throws Exception {
20: Timer timer = (Timer) jbpmContext.getJobSession().getJob(
21: timerId);
22: if (timer != null) {
23: log.debug("executing timer " + timerId);
24: timer.execute(jbpmContext);
25: } else {
26: log
27: .info("execution of timer "
28: + timerId
29: + " was skipped cause the timer was deleted from the database");
30: }
31: return timer;
32: }
33:
34: private static Log log = LogFactory
35: .getLog(ExecuteTimerCommand.class);
36: }
|