|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.model.ResourceController
public class ResourceController
Controls mutual exclusion of ResourceList
.
Constructor Summary | |
---|---|
ResourceController()
|
Method Summary | |
---|---|
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. |
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.) |
Resource |
getMissingResource(ResourceList resources)
Of the resource in the given resource list, return the one that's currently in use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceController()
Method Detail |
---|
public void execute(Runnable task, ResourceActivity activity) throws InterruptedException
The execution is blocked until the resource is available.
InterruptedException
- the thread can be interrupted while waiting for the available resources.public boolean canRun(ResourceList resources)
This method is really only useful as a hint, since
another activity might acquire resources before the caller
gets to call execute(Runnable, ResourceActivity)
.
public Resource getMissingResource(ResourceList resources)
If more than one such resource exists, one is chosen and returned. This method is used for reporting what's causing the blockage.
public ResourceActivity getBlockingActivity(ResourceActivity activity)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |