Class QueueListener

  • All Implemented Interfaces:
    ExtensionPoint
    Direct Known Subclasses:
    Queue.Saver

    public abstract class QueueListener
    extends Object
    implements ExtensionPoint
    Listener for events in Queue.

    Queue is highly synchronized objects, and these callbacks are invoked synchronously. To avoid the risk of deadlocks and general slow down, please minimize the amount of work callbacks will perform, and push any sizable work to asynchronous execution via Executor, such as Computer.threadPoolForRemoting.

    For the state transition of Queue.Item in Queue, please refer to the Queue javadoc.

    Since:
    1.520
    Author:
    Kohsuke Kawaguchi
    • Constructor Detail

      • QueueListener

        public QueueListener()
    • Method Detail

      • onEnterWaiting

        public void onEnterWaiting​(Queue.WaitingItem wi)
        When a task is submitted to the queue, it first gets to the waiting phase, where it spends until the quiet period runs out and the item becomes executable.
        See Also:
        Queue.WaitingItem.timestamp
      • onLeaveWaiting

        public void onLeaveWaiting​(Queue.WaitingItem wi)
        An item leaves the waiting phase when the current time of the system is past its due date. The item will then enter either the blocked phase or the buildable phase.
      • onEnterBlocked

        public void onEnterBlocked​(Queue.BlockedItem bi)
        An item enters the blocked phase when there's someone saying "NO" to it proceeding to the buildable phase, such as QueueTaskDispatcher. Note that waiting for an executor to become available is not a part of this.
      • onLeaveBlocked

        public void onLeaveBlocked​(Queue.BlockedItem bi)
        An item leaves the blocked phase and becomes buildable when there's no one vetoing.
      • onEnterBuildable

        public void onEnterBuildable​(Queue.BuildableItem bi)
        An item enters the buildable phase when all signals are green (or blue!) and it's just waiting for the scheduler to allocate it to the available executor. An item can spend considerable time in this phase for example if all the executors are busy.
      • onLeaveBuildable

        public void onLeaveBuildable​(Queue.BuildableItem bi)
        An item leaves the buildable phase. It will move to the "left" state if the executors are allocated to it, or it will move to the blocked phase if someone starts vetoing once again.
      • onLeft

        public void onLeft​(Queue.LeftItem li)
        The item has left the queue, either by getting cancelled or by getting picked up by an executor and starts running.