Package hudson.model
Class ResourceController
java.lang.Object
hudson.model.ResourceController
- Direct Known Subclasses:
Queue
Controls mutual exclusion of
ResourceList
.- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_await()
protected void
protected <V,
T extends Throwable>
V_withLock
(hudson.remoting.Callable<V, T> callable) protected void
protected <V> V
boolean
canRun
(ResourceList resources) Checks if an activity that requires the given resource list can run immediately.void
execute
(Runnable task, ResourceActivity activity) Performs the task that requires the given list of resources.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.)getMissingResource
(ResourceList resources) Of the resource in the given resource list, return the one that's currently in use.
-
Constructor Details
-
ResourceController
public ResourceController()
-
-
Method Details
-
execute
Performs the task that requires the given list of resources.The execution is blocked until the resource is available.
- Throws:
InterruptedException
- the thread can be interrupted while waiting for the available resources.
-
canRun
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
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
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.) -
_await
- Throws:
InterruptedException
-
_signalAll
protected void _signalAll() -
_withLock
-
_withLock
- Throws:
Exception
-
_withLock
- Throws:
T extends Throwable
-