Class DelayedRunnable.Immediate

java.lang.Object
org.apache.sis.internal.system.DelayedRunnable
org.apache.sis.internal.system.DelayedRunnable.Immediate
All Implemented Interfaces:
Comparable<Delayed>, Runnable, Delayed
Direct Known Subclasses:
Cache.Strong, Cache.Work
Enclosing class:
DelayedRunnable

public abstract static class DelayedRunnable.Immediate extends DelayedRunnable
A "delayed" task which is actually executed as soon as possible. The delay is fixed to 0 seconds, however those tasks are still ordered in a "first created, first executed" basis.
Since:
0.3
Version:
0.3
  • Field Details

    • COUNTER

      private static final AtomicLong COUNTER
      A counter for ordering the tasks in a "first created, first executed" basis.
  • Constructor Details

    • Immediate

      protected Immediate()
      Creates a new immediate task.
  • Method Details

    • getDelay

      public final long getDelay(TimeUnit unit)
      Returns the delay, which is fixed to 0 in every cases.
      Specified by:
      getDelay in interface Delayed
      Overrides:
      getDelay in class DelayedRunnable
      Parameters:
      unit - the unit of the value to return (ignored).
      Returns:
      the delay, which is fixed to 0.
    • compareTo

      public final int compareTo(Delayed other)
      Compares this task with the given delayed object for ordering. The other object shall be an instance of DelayedRunnable. This restriction should be okay since the DelayedExecutor queue accepts only DelayedRunnable instances.
      Specified by:
      compareTo in interface Comparable<Delayed>
      Overrides:
      compareTo in class DelayedRunnable
      Parameters:
      other - the other delayed object to compare with this delayed task.
      Returns:
      -1 if the other task should happen before this one, +1 if it should happen after, or 0.