Class ProcessorBase<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      ProcessorBase​(java.util.concurrent.Executor parent)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void doTask​(T task)  
      boolean flush​(long timeout, java.util.concurrent.TimeUnit unit)
      WARNING: This will only flush when all the activity is suspended.
      boolean isFlushed()  
      int remaining()
      Returns the remaining items to be processed.
      void shutdown()
      It will shutdown and wait 30 seconds for timeout.
      void shutdown​(long timeout, java.util.concurrent.TimeUnit unit)  
      int shutdownNow​(java.util.function.Consumer<? super T> onPendingItem, int timeout, java.util.concurrent.TimeUnit unit)
      It will shutdown the executor however it will not wait for finishing tasks
      int status()  
      protected void task​(T command)  
      • Methods inherited from class java.lang.Object

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

      • ProcessorBase

        public ProcessorBase​(java.util.concurrent.Executor parent)
    • Method Detail

      • shutdown

        public void shutdown()
        It will shutdown and wait 30 seconds for timeout.
      • shutdown

        public void shutdown​(long timeout,
                             java.util.concurrent.TimeUnit unit)
      • shutdownNow

        public int shutdownNow​(java.util.function.Consumer<? super T> onPendingItem,
                               int timeout,
                               java.util.concurrent.TimeUnit unit)
        It will shutdown the executor however it will not wait for finishing tasks
      • doTask

        protected abstract void doTask​(T task)
      • isFlushed

        public final boolean isFlushed()
      • flush

        public final boolean flush​(long timeout,
                                   java.util.concurrent.TimeUnit unit)
        WARNING: This will only flush when all the activity is suspended. don't expect success on this call if another thread keeps feeding the queue this is only valid on situations where you are not feeding the queue, like in shutdown and failover situations.
      • task

        protected void task​(T command)
      • remaining

        public final int remaining()
        Returns the remaining items to be processed.

        This method is safe to be called by different threads and its accuracy is subject to concurrent modifications.
        It is meant to be used only for test purposes, because of its O(n) cost.

      • status

        public final int status()