Class AbstractProcedureScheduler

java.lang.Object
org.apache.iotdb.confignode.procedure.scheduler.AbstractProcedureScheduler
All Implemented Interfaces:
ProcedureScheduler
Direct Known Subclasses:
SimpleProcedureScheduler

public abstract class AbstractProcedureScheduler extends Object implements ProcedureScheduler
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addBack(Procedure procedure)
    Inserts the specified element at the end of this queue.
    void
    addBack(Procedure procedure, boolean notify)
    Inserts the specified element at the end of this queue.
    void
    addFront(Procedure procedure)
    Inserts the specified element at the front of this queue.
    void
    addFront(Procedure procedure, boolean notify)
    Inserts the specified element at the front of this queue.
    protected abstract Procedure
    Fetch one Procedure from the queue NOTE: this method is called with the sched lock held.
    protected abstract void
    enqueue(Procedure procedure, boolean addFront)
    Add the procedure to the queue.
    boolean
     
    Fetch one Procedure from the queue
    poll(long nanos)
     
    poll(long timeout, TimeUnit unit)
    Fetch one Procedure from the queue
    protected void
    push(Procedure procedure, boolean addFront, boolean notify)
     
    protected abstract boolean
    Returns true if there are procedures available to process.
    protected abstract int
    Returns the number of elements in this queue.
    protected void
     
    protected void
     
    void
    In case the class is blocking on poll() waiting for items to be added, this method should awake poll() and poll() should return.
    int
    Returns the number of elements in this queue.
    void
    Start the scheduler
    void
    Stop the scheduler

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.iotdb.confignode.procedure.scheduler.ProcedureScheduler

    clear, yield
  • Constructor Details

    • AbstractProcedureScheduler

      public AbstractProcedureScheduler()
  • Method Details

    • start

      public void start()
      Description copied from interface: ProcedureScheduler
      Start the scheduler
      Specified by:
      start in interface ProcedureScheduler
    • stop

      public void stop()
      Description copied from interface: ProcedureScheduler
      Stop the scheduler
      Specified by:
      stop in interface ProcedureScheduler
    • signalAll

      public void signalAll()
      Description copied from interface: ProcedureScheduler
      In case the class is blocking on poll() waiting for items to be added, this method should awake poll() and poll() should return.
      Specified by:
      signalAll in interface ProcedureScheduler
    • enqueue

      protected abstract void enqueue(Procedure procedure, boolean addFront)
      Add the procedure to the queue. NOTE: this method is called with the sched lock held.
      Parameters:
      procedure - the Procedure to add
      addFront - true if the item should be added to the front of the queue
    • addFront

      public void addFront(Procedure procedure)
      Description copied from interface: ProcedureScheduler
      Inserts the specified element at the front of this queue.
      Specified by:
      addFront in interface ProcedureScheduler
      Parameters:
      procedure - the Procedure to add
    • addFront

      public void addFront(Procedure procedure, boolean notify)
      Description copied from interface: ProcedureScheduler
      Inserts the specified element at the front of this queue.
      Specified by:
      addFront in interface ProcedureScheduler
      Parameters:
      procedure - the Procedure to add
      notify - whether need to notify worker
    • addBack

      public void addBack(Procedure procedure)
      Description copied from interface: ProcedureScheduler
      Inserts the specified element at the end of this queue.
      Specified by:
      addBack in interface ProcedureScheduler
      Parameters:
      procedure - the Procedure to add
    • addBack

      public void addBack(Procedure procedure, boolean notify)
      Description copied from interface: ProcedureScheduler
      Inserts the specified element at the end of this queue.
      Specified by:
      addBack in interface ProcedureScheduler
      Parameters:
      procedure - the Procedure to add
      notify - whether need to notify worker
    • push

      protected void push(Procedure procedure, boolean addFront, boolean notify)
    • dequeue

      protected abstract Procedure dequeue()
      Fetch one Procedure from the queue NOTE: this method is called with the sched lock held.
      Returns:
      the Procedure to execute, or null if nothing is available.
    • poll

      public Procedure poll()
      Description copied from interface: ProcedureScheduler
      Fetch one Procedure from the queue
      Specified by:
      poll in interface ProcedureScheduler
      Returns:
      the Procedure to execute, or null if nothing present.
    • poll

      public Procedure poll(long timeout, TimeUnit unit)
      Description copied from interface: ProcedureScheduler
      Fetch one Procedure from the queue
      Specified by:
      poll in interface ProcedureScheduler
      Parameters:
      timeout - how long to wait before giving up, in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      Returns:
      the Procedure to execute, or null if nothing present.
    • poll

      public Procedure poll(long nanos)
    • queueSize

      protected abstract int queueSize()
      Returns the number of elements in this queue. NOTE: this method is called with the sched lock held.
      Returns:
      the number of elements in this queue.
    • queueHasRunnables

      protected abstract boolean queueHasRunnables()
      Returns true if there are procedures available to process. NOTE: this method is called with the sched lock held.
      Returns:
      true if there are procedures available to process, otherwise false.
    • size

      public int size()
      Description copied from interface: ProcedureScheduler
      Returns the number of elements in this queue.
      Specified by:
      size in interface ProcedureScheduler
      Returns:
      the number of elements in this queue.
    • hasRunnables

      public boolean hasRunnables()
      Specified by:
      hasRunnables in interface ProcedureScheduler
      Returns:
      true if there are procedures available to process, otherwise false.
    • schedLock

      protected void schedLock()
    • schedUnlock

      protected void schedUnlock()