use of org.apache.openejb.threads.task.TriggerCallable in project tomee by apache.
the class ManagedScheduledExecutorServiceImpl method schedule.
@Override
public <V> ScheduledFuture<V> schedule(final Callable<V> vCallable, final Trigger trigger) {
final Date taskScheduledTime = new Date();
final AtomicReference<Future<V>> futureHandle = new AtomicReference<Future<V>>();
final TriggerCallable<V> wrapper = new TriggerCallable<>(this, vCallable, new CUCallable<>(vCallable), trigger, taskScheduledTime, getTaskId(vCallable), futureHandle);
final ScheduledFuture<V> future = delegate.schedule(wrapper, trigger.getNextRunTime(wrapper.getLastExecution(), taskScheduledTime).getTime() - nowMs(), TimeUnit.MILLISECONDS);
return initTriggerScheduledFuture(vCallable, futureHandle, wrapper, future);
}
Aggregations