executetimercommand.java

来自「workflow first jbpm」· Java 代码 · 共 32 行

JAVA
32
字号
package org.jbpm.scheduler.ejbtimer;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmContext;
import org.jbpm.command.Command;
import org.jbpm.job.Timer;

public class ExecuteTimerCommand implements Command {

  private static final long serialVersionUID = 1L;
  
  long timerId;

  public ExecuteTimerCommand(long timerId) {
    this.timerId = timerId;
  }

  public Object execute(JbpmContext jbpmContext) throws Exception {
    Timer timer = (Timer) jbpmContext.getJobSession().getJob(timerId);
    if (timer!=null) {
      log.debug("executing timer "+timerId);
      timer.execute(jbpmContext);
    } else {
      log.info("execution of timer "+timerId+" was skipped cause the timer was deleted from the database");
    }
    return timer;
  }

  private static Log log = LogFactory.getLog(ExecuteTimerCommand.class);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?