|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlbg.peer.core.rms.ResourceTracker
public class ResourceTracker
A ResourceTracker tracks Resources for the ResourceManager that uses it.
Constructor Summary | |
---|---|
ResourceTracker(Peer managed_peer,
ResourceDataTracker data_tracker)
|
Method Summary | |
---|---|
int |
countBusyLocalResources()
|
int |
countBusySupplyingResources()
|
int |
countIdleResources()
|
int |
countResources()
|
ResourceHandle |
getFirstBusyLocalResource()
Deprecated. |
ResourceHandle |
getFirstBusySupplyingResource()
Deprecated. |
ResourceHandle |
getFirstIdleResource()
Deprecated. |
java.util.Iterator<ResourceUsageData> |
getIdleResourcesIterator()
Returns an Iterator over idle Resources usage data. |
ResourceHandle |
getRandomBusyLocalResource()
Returns a random busy local Resource. |
ResourceHandle |
getRandomBusySupplyingResource()
Returns a random busy supplying Resource. |
ResourceHandle |
getRandomIdleResource()
Returns a random idle Resource. |
ResourceState |
getResourceState(ResourceHandle rh)
|
ResourceUsageData |
getResourceUsageData(ResourceHandle rh)
|
WorkingSet |
getWorkingSetOfIdleResource(ResourceHandle rh)
Returns the WorkingSet of the target Resource, if target Resource is idle. |
boolean |
hasBusyLocalResource()
|
boolean |
hasBusySupplyingResource()
|
boolean |
hasIdleResource()
|
java.lang.String |
toString()
|
void |
trackResource(ResourceHandle rh)
Starts the tracking of the target Resource. |
ResourceUsageData |
untrackResource(ResourceHandle rh)
Stops the tracking of the target Resource. |
WorkingSet |
updateResourceStatusToBusy(ResourceHandle rh,
ResourceState state,
Task t)
Updates target Resource status from idle to busy local or busy supplying, depending on the value of target state. |
WorkingSet |
updateResourceStatusToIdle(ResourceHandle rh,
ResourceState state)
Updates target Resource status from busy local or busy supplying, depending on the value of target state, to idle. |
double |
utilization()
Returns the Peer utilization, i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ResourceTracker(Peer managed_peer, ResourceDataTracker data_tracker) throws GridException
GridException
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public int countResources()
public int countIdleResources()
public int countBusyLocalResources()
public int countBusySupplyingResources()
public boolean hasIdleResource()
public boolean hasBusyLocalResource()
public boolean hasBusySupplyingResource()
public double utilization() throws GridException
GridException
public ResourceState getResourceState(ResourceHandle rh) throws GridException
GridException
public ResourceUsageData getResourceUsageData(ResourceHandle rh) throws GridException
GridException
public void trackResource(ResourceHandle rh) throws GridException
rh
- target Resource
GridException
- if a parameter is illegalpublic ResourceUsageData untrackResource(ResourceHandle rh) throws GridException
rh
- target Resource
GridException
- if a parameter is illegalpublic java.util.Iterator<ResourceUsageData> getIdleResourcesIterator()
public WorkingSet getWorkingSetOfIdleResource(ResourceHandle rh) throws GridException
Note: does not assume that Resource is idle, but rather returns a WorkingSet only when it is idle.
rh
- target Resource
GridException
- if a parameter is illegal@Deprecated public ResourceHandle getFirstIdleResource()
@Deprecated public ResourceHandle getFirstBusyLocalResource()
@Deprecated public ResourceHandle getFirstBusySupplyingResource()
public ResourceHandle getRandomIdleResource() throws GridException
GridException
public ResourceHandle getRandomBusyLocalResource() throws GridException
GridException
public ResourceHandle getRandomBusySupplyingResource() throws GridException
GridException
public WorkingSet updateResourceStatusToBusy(ResourceHandle rh, ResourceState state, Task t) throws GridException
rs_idle = rs_idle \ { rh } ; rs_busy_x = rs_busy_x U { rh } ;
rh
- target Resourcestate
- target state (legal values: BUSY_LOCAL, BUSY_SUPPLYING)t
- Task that is going to be run on target Resource
GridException
- if a parameter is illegalpublic WorkingSet updateResourceStatusToIdle(ResourceHandle rh, ResourceState state) throws GridException
rs_busy_x = rs_busy_x \ { rh } ; rs_idle = rs_idle U { rh } ;
rh
- target Resourcestate
- target state (legal values: BUSY_LOCAL, BUSY_SUPPLYING)
GridException
- if a parameter is illegal
|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.