Class LocalSchedulerService<K>

java.lang.Object
org.wildfly.clustering.server.service.SimpleService
org.wildfly.clustering.server.local.scheduler.LocalSchedulerService<K>
Type Parameters:
K - the scheduled entry key type
All Implemented Interfaces:
AutoCloseable, Runnable, Scheduler<K,Instant>, SchedulerService<K,Instant>, Service

public class LocalSchedulerService<K> extends SimpleService implements SchedulerService<K,Instant>, Runnable
Scheduler that uses a single scheduled task in concert with a ScheduledEntries.
Author:
Paul Ferraro
  • Constructor Details

    • LocalSchedulerService

      public LocalSchedulerService(LocalSchedulerService.Configuration<K> configuration)
      Creates a local scheduler using the specified configuration.
      Parameters:
      configuration - the scheduler configuration
  • Method Details

    • schedule

      public void schedule(K key, Instant instant)
      Description copied from interface: Scheduler
      Schedules a task for the specified entry.
      Specified by:
      schedule in interface Scheduler<K,Instant>
      Parameters:
      key - the scheduled entry key
      instant - the scheduled entry value
    • cancel

      public void cancel(K key)
      Description copied from interface: Scheduler
      Cancels a previously scheduled task for the entry with the specified key.
      Specified by:
      cancel in interface Scheduler<K,Instant>
      Parameters:
      key - the scheduled entry key
    • contains

      public boolean contains(K key)
      Description copied from interface: Scheduler
      Indicates whether the entry with the specified key is scheduled.
      Specified by:
      contains in interface Scheduler<K,Instant>
      Parameters:
      key - the scheduled entry key
      Returns:
      true, if the specified entry is scheduled, false otherwise.
    • start

      public void start()
      Description copied from interface: Service
      Starts this service.
      Specified by:
      start in interface Service
      Overrides:
      start in class SimpleService
    • stop

      public void stop()
      Description copied from interface: Service
      Stops this service.
      Specified by:
      stop in interface Service
      Overrides:
      stop in class SimpleService
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SchedulerService<K,Instant>
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • toString

      public String toString()
      Overrides:
      toString in class Object