test_class.declarator: periodicScheduler = new PeriodicSchedulerImpl(new SchedulerImpl())
test_class.modifier: private final
test_class.original_string: private final PeriodicSchedulerImpl periodicScheduler = new PeriodicSchedulerImpl(new SchedulerImpl());
test_class.type: PeriodicSchedulerImpl
test_class.var_name: periodicScheduler
test_class.file: bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/PeriodicSchedulerImplTest.java
test_class.identifier: PeriodicSchedulerImplTest
test_case.body: @Test
      @Timeout(value = 5, unit = TimeUnit.SECONDS)
      public void testSchedule() throws InterruptedException, IOException {
          Queue<Long> times = new ArrayDeque<>();
          Semaphore semaphore = new Semaphore(0);
          Duration[] delays = { Duration.ofMillis(100), Duration.ofMillis(200), Duration.ofMillis(300) };
          final long now = System.currentTimeMillis();
  
          ScheduledCompletableFuture<Object> future = periodicScheduler.schedule(() -> {
              times.add((System.currentTimeMillis() - now) / 100);
              semaphore.release();
          }, delays);
          semaphore.acquire(6);
          future.cancel(true);
          // Because starting scheduler takes some time and we don't know how long
          // the first time set is the offset on which we check the next values.
          long offset = times.poll();
          long[] expectedResults = { 2, 5, 8, 11, 14 };
          for (long expectedResult : expectedResults) {
              assertEquals(offset + expectedResult, times.poll().longValue(), "Expected periodic time");
          }
          assertFalse(semaphore.tryAcquire(1, TimeUnit.SECONDS), "No more jobs should have been scheduled");
      }
test_case.class_method_signature: PeriodicSchedulerImplTest.testSchedule()
test_case.full_signature: @Test @Timeout(value = 5, unit = TimeUnit.SECONDS) public void testSchedule()
test_case.identifier: testSchedule
test_case.invocations: ofMillis ofMillis ofMillis currentTimeMillis schedule add currentTimeMillis release acquire cancel poll assertEquals longValue poll assertFalse tryAcquire
test_case.modifiers: @Test @Timeout(value = 5, unit = TimeUnit.SECONDS) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSchedule()
focal_class.declarator: scheduler
focal_class.modifier: private final
focal_class.original_string: private final Scheduler scheduler;
focal_class.type: Scheduler
focal_class.var_name: scheduler
focal_class.file: bundles/org.openhab.core/src/main/java/org/openhab/core/internal/scheduler/PeriodicSchedulerImpl.java
focal_class.identifier: PeriodicSchedulerImpl
focal_class.interfaces: implements PeriodicScheduler
focal_class.class_method_signature: PeriodicSchedulerImpl.PeriodicSchedulerImpl(final @Reference Scheduler scheduler)
focal_class.full_signature: @Activate public  PeriodicSchedulerImpl(final @Reference Scheduler scheduler)
focal_class.identifier: PeriodicSchedulerImpl
focal_class.modifiers: @Activate public
focal_class.parameters: (final @Reference Scheduler scheduler)
focal_class.signature:  PeriodicSchedulerImpl(final @Reference Scheduler scheduler)
focal_class.class_method_signature: PeriodicSchedulerImpl.schedule(SchedulerRunnable runnable, Duration... delays)
focal_class.full_signature: @Override public ScheduledCompletableFuture<T> schedule(SchedulerRunnable runnable, Duration... delays)
focal_class.identifier: schedule
focal_class.modifiers: @Override public
focal_class.parameters: (SchedulerRunnable runnable, Duration... delays)
focal_class.return: ScheduledCompletableFuture<T>
focal_class.signature: ScheduledCompletableFuture<T> schedule(SchedulerRunnable runnable, Duration... delays)
focal_method.body: @Override
      public <T> ScheduledCompletableFuture<T> schedule(SchedulerRunnable runnable, Duration... delays) {
          return scheduler.schedule(runnable, new PeriodicAdjuster(delays));
      }
focal_method.class_method_signature: PeriodicSchedulerImpl.schedule(SchedulerRunnable runnable, Duration... delays)
focal_method.full_signature: @Override public ScheduledCompletableFuture<T> schedule(SchedulerRunnable runnable, Duration... delays)
focal_method.identifier: schedule
focal_method.invocations: schedule
focal_method.modifiers: @Override public
focal_method.parameters: (SchedulerRunnable runnable, Duration... delays)
focal_method.return: ScheduledCompletableFuture<T>
focal_method.signature: ScheduledCompletableFuture<T> schedule(SchedulerRunnable runnable, Duration... delays)