@Test public void testTheCreationOfDelayedCallable() throws ExecutionException, InterruptedException { long begin = System.currentTimeMillis(); ManagedScheduledFutureTask<String> future = executor.schedule(new Callable<String>() { @Override public String call() throws Exception { return "Hello"; } }, 10, TimeUnit.MILLISECONDS); String result = future.get(); long end = System.currentTimeMillis(); assertThat(result).isEqualToIgnoringCase("Hello"); assertThat(end - begin).isGreaterThanOrEqualTo(10); }
@Override public synchronized <V> ManagedScheduledFutureTask<V> schedule(Callable<V> callable, long delay, TimeUnit unit) { ScheduledTask<V> task = getNewScheduledTaskFor(callable, false); ScheduledFuture<V> future = ((ScheduledExecutorService) executor).schedule(task.callable, delay, unit); task.submittedScheduledTask(future); return task; }
ManagedScheduledExecutorServiceImpl extends AbstractManagedExecutorService implements ManagedScheduledExecutorService { @Override public synchronized <V> ManagedScheduledFutureTask<V> schedule(Callable<V> callable, long delay, TimeUnit unit) { ScheduledTask<V> task = getNewScheduledTaskFor(callable, false); ScheduledFuture<V> future = ((ScheduledExecutorService) executor).schedule(task.callable, delay, unit); task.submittedScheduledTask(future); return task; } }
ManagedScheduledExecutorServiceImpl extends AbstractManagedExecutorService implements ManagedScheduledExecutorService { @Override public synchronized <V> ManagedScheduledFutureTask<V> schedule(Callable<V> callable, long delay, TimeUnit unit) { ScheduledTask<V> task = getNewScheduledTaskFor(callable, false); ScheduledFuture<V> future = ((ScheduledExecutorService) executor).schedule(task.callable, delay, unit); task.submittedScheduledTask(future); return task; } ManagedScheduledExecutorServiceImpl(String name, Configuration configuration,
                                               List<ExecutionContextService> ecs);  ManagedScheduledExecutorServiceImpl(
            String name,
            ThreadType tu,
            long hungTime,
            int coreSize,
            int priority,
            List<ExecutionContextService> ecs); }
ManagedScheduledExecutorServiceImpl extends AbstractManagedExecutorService implements ManagedScheduledExecutorService { @Override public synchronized <V> ManagedScheduledFutureTask<V> schedule(Callable<V> callable, long delay, TimeUnit unit) { ScheduledTask<V> task = getNewScheduledTaskFor(callable, false); ScheduledFuture<V> future = ((ScheduledExecutorService) executor).schedule(task.callable, delay, unit); task.submittedScheduledTask(future); return task; } ManagedScheduledExecutorServiceImpl(String name, Configuration configuration,
                                               List<ExecutionContextService> ecs);  ManagedScheduledExecutorServiceImpl(
            String name,
            ThreadType tu,
            long hungTime,
            int coreSize,
            int priority,
            List<ExecutionContextService> ecs); @Override synchronized ManagedScheduledFutureTask<V> schedule(Callable<V> callable, long delay, TimeUnit unit); @Override synchronized ManagedScheduledFutureTask<?> schedule(Runnable command, long delay, TimeUnit unit); @Override synchronized ManagedScheduledFutureTask<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit); @Override synchronized ManagedScheduledFutureTask<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit); }
ManagedScheduledExecutorServiceImpl extends AbstractManagedExecutorService implements ManagedScheduledExecutorService { @Override public synchronized <V> ManagedScheduledFutureTask<V> schedule(Callable<V> callable, long delay, TimeUnit unit) { ScheduledTask<V> task = getNewScheduledTaskFor(callable, false); ScheduledFuture<V> future = ((ScheduledExecutorService) executor).schedule(task.callable, delay, unit); task.submittedScheduledTask(future); return task; } ManagedScheduledExecutorServiceImpl(String name, Configuration configuration,
                                               List<ExecutionContextService> ecs);  ManagedScheduledExecutorServiceImpl(
            String name,
            ThreadType tu,
            long hungTime,
            int coreSize,
            int priority,
            List<ExecutionContextService> ecs); @Override synchronized ManagedScheduledFutureTask<V> schedule(Callable<V> callable, long delay, TimeUnit unit); @Override synchronized ManagedScheduledFutureTask<?> schedule(Runnable command, long delay, TimeUnit unit); @Override synchronized ManagedScheduledFutureTask<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit); @Override synchronized ManagedScheduledFutureTask<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit);  }