Package hudson.model

Class ResourceController

  • Direct Known Subclasses:

    public class ResourceController
    extends Object
    Controls mutual exclusion of ResourceList.
    Kohsuke Kawaguchi
    • Constructor Detail

      • ResourceController

        public ResourceController()
    • Method Detail

      • execute

        public void execute​(@NonNull
                            Runnable task,
                            ResourceActivity activity)
                     throws InterruptedException
        Performs the task that requires the given list of resources.

        The execution is blocked until the resource is available.

        InterruptedException - the thread can be interrupted while waiting for the available resources.
      • canRun

        public boolean canRun​(ResourceList resources)
        Checks if an activity that requires the given resource list can run immediately.

        This method is really only useful as a hint, since another activity might acquire resources before the caller gets to call execute(Runnable, ResourceActivity).

      • getMissingResource

        public Resource getMissingResource​(ResourceList resources)
        Of the resource in the given resource list, return the one that's currently in use.

        If more than one such resource exists, one is chosen and returned. This method is used for reporting what's causing the blockage.

      • getBlockingActivity

        public ResourceActivity getBlockingActivity​(ResourceActivity activity)
        Of the activities that are in progress, return one that's blocking the given activity, or null if it's not blocked (and thus the given activity can be executed immediately.)
      • _signalAll

        protected void _signalAll()
      • _withLock

        protected void _withLock​(Runnable runnable)
      • _withLock

        protected <V,​T extends Throwable> V _withLock​(hudson.remoting.Callable<V,​T> callable)
                                                     throws T extends Throwable
        T extends Throwable