Package br.com.caelum.vraptor.tasks.jobs.simple

Source Code of br.com.caelum.vraptor.tasks.jobs.simple.StatefulJobWrapper

package br.com.caelum.vraptor.tasks.jobs.simple;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.PersistJobDataAfterExecution;

import br.com.caelum.vraptor.tasks.Task;
import br.com.caelum.vraptor.tasks.jobs.TaskExecutionException;

@DisallowConcurrentExecution
@PersistJobDataAfterExecution
public class StatefulJobWrapper implements Job {

  private final Task task;

  public StatefulJobWrapper(Task task) {
    this.task = task;
  }

  public void execute(JobExecutionContext context) throws JobExecutionException {
    try {
      task.execute();
    } catch (Exception e) {
      throw new TaskExecutionException(e);
    }
  }

}
TOP

Related Classes of br.com.caelum.vraptor.tasks.jobs.simple.StatefulJobWrapper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.