@Test(timeout = 60_000) public void testScheduleAction() throws Exception { AtomicLong tickCounter = new AtomicLong(); ScheduleReference reference = localScheduler.schedule( scheduleDescriptor.toBuilder().withName("testScheduleAction").build(), t -> tickCounter.incrementAndGet(), true ); testExecutionLifecycle(reference, tickCounter); }
@Override public ScheduleReference schedule(ScheduleDescriptor scheduleDescriptor, Consumer<ExecutionContext> action, boolean isolated) { ExecutorService executorService = isolated ? Executors.newSingleThreadScheduledExecutor(r -> { Thread thread = new Thread(SCHEDULER_THREAD_GROUP, r, scheduleDescriptor.getName()); thread.setDaemon(true); return thread; }) : null; return schedule(scheduleDescriptor, action, executorService); }
DefaultLocalScheduler implements LocalScheduler { @Override public ScheduleReference schedule(ScheduleDescriptor scheduleDescriptor, Consumer<ExecutionContext> action, boolean isolated) { ExecutorService executorService = isolated ? Executors.newSingleThreadScheduledExecutor(r -> { Thread thread = new Thread(SCHEDULER_THREAD_GROUP, r, scheduleDescriptor.getName()); thread.setDaemon(true); return thread; }) : null; return schedule(scheduleDescriptor, action, executorService); } }
DefaultLocalScheduler implements LocalScheduler { @Override public ScheduleReference schedule(ScheduleDescriptor scheduleDescriptor, Consumer<ExecutionContext> action, boolean isolated) { ExecutorService executorService = isolated ? Executors.newSingleThreadScheduledExecutor(r -> { Thread thread = new Thread(SCHEDULER_THREAD_GROUP, r, scheduleDescriptor.getName()); thread.setDaemon(true); return thread; }) : null; return schedule(scheduleDescriptor, action, executorService); } DefaultLocalScheduler(Duration internalLoopInterval, Scheduler scheduler, Clock clock, Registry registry); }
DefaultLocalScheduler implements LocalScheduler { @Override public ScheduleReference schedule(ScheduleDescriptor scheduleDescriptor, Consumer<ExecutionContext> action, boolean isolated) { ExecutorService executorService = isolated ? Executors.newSingleThreadScheduledExecutor(r -> { Thread thread = new Thread(SCHEDULER_THREAD_GROUP, r, scheduleDescriptor.getName()); thread.setDaemon(true); return thread; }) : null; return schedule(scheduleDescriptor, action, executorService); } DefaultLocalScheduler(Duration internalLoopInterval, Scheduler scheduler, Clock clock, Registry registry); void shutdown(); @Override List<Schedule> getActiveSchedules(); @Override List<Schedule> getArchivedSchedules(); @Override Optional<Schedule> findSchedule(String scheduleId); @Override Flux<LocalSchedulerEvent> events(); @Override ScheduleReference scheduleMono(ScheduleDescriptor scheduleDescriptor, Function<ExecutionContext, Mono<Void>> actionProducer, Scheduler scheduler); @Override ScheduleReference schedule(ScheduleDescriptor scheduleDescriptor, Consumer<ExecutionContext> action, boolean isolated); @Override ScheduleReference schedule(ScheduleDescriptor scheduleDescriptor, Consumer<ExecutionContext> action, ExecutorService executorService); @Override Mono<Void> cancel(String scheduleId); }
DefaultLocalScheduler implements LocalScheduler { @Override public ScheduleReference schedule(ScheduleDescriptor scheduleDescriptor, Consumer<ExecutionContext> action, boolean isolated) { ExecutorService executorService = isolated ? Executors.newSingleThreadScheduledExecutor(r -> { Thread thread = new Thread(SCHEDULER_THREAD_GROUP, r, scheduleDescriptor.getName()); thread.setDaemon(true); return thread; }) : null; return schedule(scheduleDescriptor, action, executorService); } DefaultLocalScheduler(Duration internalLoopInterval, Scheduler scheduler, Clock clock, Registry registry); void shutdown(); @Override List<Schedule> getActiveSchedules(); @Override List<Schedule> getArchivedSchedules(); @Override Optional<Schedule> findSchedule(String scheduleId); @Override Flux<LocalSchedulerEvent> events(); @Override ScheduleReference scheduleMono(ScheduleDescriptor scheduleDescriptor, Function<ExecutionContext, Mono<Void>> actionProducer, Scheduler scheduler); @Override ScheduleReference schedule(ScheduleDescriptor scheduleDescriptor, Consumer<ExecutionContext> action, boolean isolated); @Override ScheduleReference schedule(ScheduleDescriptor scheduleDescriptor, Consumer<ExecutionContext> action, ExecutorService executorService); @Override Mono<Void> cancel(String scheduleId);  }