Ejemplo n.º 1
0
  public Date schedule(JobExecution jobExecution) {
    Date startTime = jobExecution.getStartTime();
    Date now = Calendar.getInstance().getTime();

    if (startTime.compareTo(now) < 0) {
      startTime = now;
    }

    Timer timer = timerService.createTimer(startTime, jobExecution.getId());
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm");
    LOGGER.log(Level.INFO, "Job Scheduled to {0}", df.format(timer.getNextTimeout()));
    return timer.getNextTimeout();
  }
Ejemplo n.º 2
0
 public Date findTimeout(JobExecution jobExecution) {
   Timer timer = findTimer(jobExecution);
   return timer != null ? timer.getNextTimeout() : null;
 }