Class InstantPeriodicTask

  • All Implemented Interfaces:
    Disposable, java.util.concurrent.Callable<java.lang.Void>

    final class InstantPeriodicTask
    extends java.lang.Object
    implements java.util.concurrent.Callable<java.lang.Void>, Disposable
    Wrapper for a regular task that gets immediately rescheduled when the task completed.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static java.util.concurrent.FutureTask<java.lang.Void> CANCELLED  
      (package private) java.util.concurrent.ExecutorService executor  
      (package private) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.Future<?>> first  
      (package private) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.Future<?>> rest  
      (package private) java.lang.Thread runner  
      (package private) java.lang.Runnable task  
    • Constructor Summary

      Constructors 
      Constructor Description
      InstantPeriodicTask​(java.lang.Runnable task, java.util.concurrent.ExecutorService executor)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Void call()  
      void dispose()
      Dispose the resource, the operation should be idempotent.
      boolean isDisposed()
      Returns true if this resource has been disposed.
      (package private) void setFirst​(java.util.concurrent.Future<?> f)  
      (package private) void setRest​(java.util.concurrent.Future<?> f)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • task

        final java.lang.Runnable task
      • rest

        final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.Future<?>> rest
      • first

        final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.Future<?>> first
      • executor

        final java.util.concurrent.ExecutorService executor
      • runner

        java.lang.Thread runner
      • CANCELLED

        static final java.util.concurrent.FutureTask<java.lang.Void> CANCELLED
    • Constructor Detail

      • InstantPeriodicTask

        InstantPeriodicTask​(java.lang.Runnable task,
                            java.util.concurrent.ExecutorService executor)
    • Method Detail

      • call

        public java.lang.Void call()
        Specified by:
        call in interface java.util.concurrent.Callable<java.lang.Void>
      • dispose

        public void dispose()
        Description copied from interface: Disposable
        Dispose the resource, the operation should be idempotent.
        Specified by:
        dispose in interface Disposable
      • isDisposed

        public boolean isDisposed()
        Description copied from interface: Disposable
        Returns true if this resource has been disposed.
        Specified by:
        isDisposed in interface Disposable
        Returns:
        true if this resource has been disposed
      • setFirst

        void setFirst​(java.util.concurrent.Future<?> f)
      • setRest

        void setRest​(java.util.concurrent.Future<?> f)