接口 ProcedureScheduler

    • 方法概要

      所有方法 实例方法 抽象方法 
      修饰符和类型 方法 说明
      void addBack​(Procedure proc)
      Inserts the specified element at the end of this queue.
      void addBack​(Procedure proc, boolean notify)
      Inserts the specified element at the end of this queue.
      void addFront​(Procedure proc)
      Inserts the specified element at the front of this queue.
      void addFront​(Procedure proc, boolean notify)
      Inserts the specified element at the front of this queue.
      void clear()
      Clear current state of scheduler such that it is equivalent to newly created scheduler.
      boolean hasRunnables()  
      Procedure poll()
      Fetch one Procedure from the queue
      Procedure poll​(long timeout, java.util.concurrent.TimeUnit unit)
      Fetch one Procedure from the queue
      void signalAll()
      In case the class is blocking on poll() waiting for items to be added, this method should awake poll() and poll() should return.
      int size()
      Returns the number of elements in this queue.
      void start()
      Start the scheduler
      void stop()
      Stop the scheduler
      void yield​(Procedure proc)
      The procedure can't run at the moment. add it back to the queue, giving priority to someone else.
    • 方法详细资料

      • start

        void start()
        Start the scheduler
      • stop

        void stop()
        Stop the scheduler
      • signalAll

        void signalAll()
        In case the class is blocking on poll() waiting for items to be added, this method should awake poll() and poll() should return.
      • addFront

        void addFront​(Procedure proc)
        Inserts the specified element at the front of this queue.
        参数:
        proc - the Procedure to add
      • addFront

        void addFront​(Procedure proc,
                      boolean notify)
        Inserts the specified element at the front of this queue.
        参数:
        proc - the Procedure to add
        notify - whether need to notify worker
      • addBack

        void addBack​(Procedure proc)
        Inserts the specified element at the end of this queue.
        参数:
        proc - the Procedure to add
      • addBack

        void addBack​(Procedure proc,
                     boolean notify)
        Inserts the specified element at the end of this queue.
        参数:
        proc - the Procedure to add
        notify - whether need to notify worker
      • yield

        void yield​(Procedure proc)
        The procedure can't run at the moment. add it back to the queue, giving priority to someone else.
        参数:
        proc - the Procedure to add back to the list
      • hasRunnables

        boolean hasRunnables()
        返回:
        true if there are procedures available to process, otherwise false.
      • poll

        Procedure poll()
        Fetch one Procedure from the queue
        返回:
        the Procedure to execute, or null if nothing present.
      • poll

        Procedure poll​(long timeout,
                       java.util.concurrent.TimeUnit unit)
        Fetch one Procedure from the queue
        参数:
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        返回:
        the Procedure to execute, or null if nothing present.
      • size

        int size()
        Returns the number of elements in this queue.
        返回:
        the number of elements in this queue.
      • clear

        void clear()
        Clear current state of scheduler such that it is equivalent to newly created scheduler. Used for testing failure and recovery.