use of commonj.work.WorkRejectedException in project spring-framework by spring-projects.
the class WorkManagerTaskExecutor method execute.
//-------------------------------------------------------------------------
// Implementation of the Spring SchedulingTaskExecutor interface
//-------------------------------------------------------------------------
@Override
public void execute(Runnable task) {
Assert.state(this.workManager != null, "No WorkManager specified");
Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task);
try {
if (this.workListener != null) {
this.workManager.schedule(work, this.workListener);
} else {
this.workManager.schedule(work);
}
} catch (WorkRejectedException ex) {
throw new TaskRejectedException("CommonJ WorkManager did not accept task: " + task, ex);
} catch (WorkException ex) {
throw new SchedulingException("Could not schedule task on CommonJ WorkManager", ex);
}
}
Aggregations