Search in sources :

Example 1 with CUScheduleFuture

use of org.apache.openejb.threads.future.CUScheduleFuture in project tomee by apache.

the class ManagedScheduledExecutorServiceImpl method schedule.

@Override
public ScheduledFuture<?> schedule(final Runnable command, final long delay, final TimeUnit unit) {
    final CURunnable wrapper = new CURunnable(command);
    final ScheduledFuture<?> future = delegate.schedule(wrapper, delay, unit);
    wrapper.taskSubmitted(future, this, command);
    return new CUScheduleFuture<Object>(ScheduledFuture.class.cast(future), wrapper);
}
Also used : CURunnable(org.apache.openejb.threads.task.CURunnable) CUScheduleFuture(org.apache.openejb.threads.future.CUScheduleFuture) ScheduledFuture(java.util.concurrent.ScheduledFuture)

Example 2 with CUScheduleFuture

use of org.apache.openejb.threads.future.CUScheduleFuture in project tomee by apache.

the class ManagedScheduledExecutorServiceImpl method scheduleAtFixedRate.

@Override
public ScheduledFuture<?> scheduleAtFixedRate(final Runnable command, final long initialDelay, final long period, final TimeUnit unit) {
    final CURunnable wrapper = new CURunnable(command);
    final ScheduledFuture<?> future = delegate.scheduleAtFixedRate(wrapper, initialDelay, period, unit);
    wrapper.taskSubmitted(future, this, command);
    return new CUScheduleFuture<Object>(ScheduledFuture.class.cast(future), wrapper);
}
Also used : CURunnable(org.apache.openejb.threads.task.CURunnable) CUScheduleFuture(org.apache.openejb.threads.future.CUScheduleFuture) ScheduledFuture(java.util.concurrent.ScheduledFuture)

Example 3 with CUScheduleFuture

use of org.apache.openejb.threads.future.CUScheduleFuture in project tomee by apache.

the class ManagedScheduledExecutorServiceImpl method scheduleWithFixedDelay.

@Override
public ScheduledFuture<?> scheduleWithFixedDelay(final Runnable command, final long initialDelay, final long delay, final TimeUnit unit) {
    final CURunnable wrapper = new CURunnable(command);
    final ScheduledFuture<?> future = delegate.scheduleWithFixedDelay(wrapper, initialDelay, delay, unit);
    wrapper.taskSubmitted(future, this, command);
    return new CUScheduleFuture<Object>(ScheduledFuture.class.cast(future), wrapper);
}
Also used : CURunnable(org.apache.openejb.threads.task.CURunnable) CUScheduleFuture(org.apache.openejb.threads.future.CUScheduleFuture) ScheduledFuture(java.util.concurrent.ScheduledFuture)

Aggregations

ScheduledFuture (java.util.concurrent.ScheduledFuture)3 CUScheduleFuture (org.apache.openejb.threads.future.CUScheduleFuture)3 CURunnable (org.apache.openejb.threads.task.CURunnable)3