Interface Scheduler<I,V>

Type Parameters:
I - the scheduled entry identifier type
V - the scheduled entry value type
All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
Scheduler.InactiveScheduler, Scheduler.ReferenceScheduler

public interface Scheduler<I,V> extends AutoCloseable
A task scheduler.
Author:
Paul Ferraro
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
     
    static class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cancel(I id)
    Cancels a previously scheduled task for the object with the specified identifier.
    void
     
    boolean
    contains(I id)
    Indicates whether the entry with the specified identifier is scheduled.
    static <I, V> Scheduler<I,V>
    fromReference(Supplier<? extends Scheduler<I,V>> reference)
    Returns a scheduler that delegates to a scheduler reference.
    static <I, V> Scheduler<I,V>
    Returns an inactive scheduler instance.
    default <T> Scheduler<I,T>
    map(Function<T,Optional<V>> mapper)
     
    void
    schedule(I id, V value)
    Schedules a task for the object with the specified identifier, using the specified metaData
  • Method Details

    • schedule

      void schedule(I id, V value)
      Schedules a task for the object with the specified identifier, using the specified metaData
      Parameters:
      id - the scheduled entry identifier
      value - the scheduled entry value
    • cancel

      void cancel(I id)
      Cancels a previously scheduled task for the object with the specified identifier.
      Parameters:
      id - an object identifier
    • contains

      boolean contains(I id)
      Indicates whether the entry with the specified identifier is scheduled.
      Parameters:
      id - an object identifier
      Returns:
      true, if the specified entry is scheduled, false otherwise.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
    • map

      default <T> Scheduler<I,T> map(Function<T,Optional<V>> mapper)
    • inactive

      static <I, V> Scheduler<I,V> inactive()
      Returns an inactive scheduler instance.
      Type Parameters:
      I - the scheduled entry identifier type
      V - the scheduled entry value type
      Returns:
      an inactive scheduler instance.
    • fromReference

      static <I, V> Scheduler<I,V> fromReference(Supplier<? extends Scheduler<I,V>> reference)
      Returns a scheduler that delegates to a scheduler reference.
      Type Parameters:
      I - the scheduled entry identifier type
      V - the scheduled entry value type
      Parameters:
      reference - a scheduler reference
      Returns:
      a scheduler that delegates to a scheduler reference.