@Test public void testCreationOfPeriodicTaskWithFixedRate() throws ExecutionException, InterruptedException { Semaphore semaphore = new Semaphore(0); ManagedScheduledFutureTask<?> future = executor.scheduleAtFixedRate(new MyRunnable(4, semaphore), 10, 10, TimeUnit.MILLISECONDS); assertThat(future).isNotNull(); semaphore.acquire(); future.cancel(false); assertThat(counter.get()).isGreaterThanOrEqualTo(4); assertThat(future.getDelay(TimeUnit.MILLISECONDS)).isLessThanOrEqualTo(10); assertThat(future.isPeriodic()).isTrue(); assertThat(executor.getCompletedTaskCount()).isBetween(2l, 5l); }
@Override public synchronized ManagedScheduledFutureTask<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { ScheduledTask<?> task = getNewScheduledTaskFor(command, true); ScheduledFuture<?> future = ((ScheduledExecutorService) executor).scheduleAtFixedRate(task.asRunnable(), initialDelay, period, unit); task.submittedScheduledTask(future); return task; }
ManagedScheduledExecutorServiceImpl extends AbstractManagedExecutorService implements ManagedScheduledExecutorService { @Override public synchronized ManagedScheduledFutureTask<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { ScheduledTask<?> task = getNewScheduledTaskFor(command, true); ScheduledFuture<?> future = ((ScheduledExecutorService) executor).scheduleAtFixedRate(task.asRunnable(), initialDelay, period, unit); task.submittedScheduledTask(future); return task; } }
ManagedScheduledExecutorServiceImpl extends AbstractManagedExecutorService implements ManagedScheduledExecutorService { @Override public synchronized ManagedScheduledFutureTask<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { ScheduledTask<?> task = getNewScheduledTaskFor(command, true); ScheduledFuture<?> future = ((ScheduledExecutorService) executor).scheduleAtFixedRate(task.asRunnable(), initialDelay, period, 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 ManagedScheduledFutureTask<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { ScheduledTask<?> task = getNewScheduledTaskFor(command, true); ScheduledFuture<?> future = ((ScheduledExecutorService) executor).scheduleAtFixedRate(task.asRunnable(), initialDelay, period, 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 ManagedScheduledFutureTask<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { ScheduledTask<?> task = getNewScheduledTaskFor(command, true); ScheduledFuture<?> future = ((ScheduledExecutorService) executor).scheduleAtFixedRate(task.asRunnable(), initialDelay, period, 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);  }