org.ocap.resource.ResourceContentionManager.html Maven / Gradle / Ivy
ResourceContentionManager
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
org.ocap.resource
Class ResourceContentionManager
java.lang.Object
org.ocap.resource.ResourceContentionManager
public class ResourceContentionManager
- extends java.lang.Object
This class manages a means of resolving a resource contention.
An application which has a MonitorAppPermission ("handler.resource") may have a subclass of the AppsDatabaseFilter class or a class implementing the ResourceContentionHandler interface, and may set an instance of them in the ResourceContentionManager. The concrete class of the AppsDatabaseFilter class identifies an application that is not allowed absolutely to reserve the resource. The class implementing the ResourceContentionHandler interface resolves a resource contention after a resource negotiation.
See the section 19 Resource Management in this specification for details.
Constructor Summary | |
---|---|
protected |
ResourceContentionManager()
A constructor of this class. |
Method Summary | |
---|---|
static ResourceContentionManager |
getInstance()
This method returns an instance of the ResourceContentionManager class. |
int |
getWarningPeriod()
Gets the warning period set by the setWarningPeriod method. |
void |
setResourceContentionHandler(ResourceContentionHandler handler)
This method sets the specified ResourceContentionHandler that decides which application shall be denied reserving a scarce resource. |
void |
setResourceFilter(AppsDatabaseFilter filter,
java.lang.String resourceProxy)
This method sets an instance of a concrete class that extends AppsDatabaseFilter. |
void |
setWarningPeriod(int warningPeriod)
Sets the warning period used by the implementation to determine when to call the resourceContentionWarning method in a registered ResourceContentionHandler . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
ResourceContentionManager
protected ResourceContentionManager()
- A constructor of this class. An application must use the
getInstance()
method to create an instance.
Method Detail |
---|
getInstance
public static ResourceContentionManager getInstance()
- This method returns an instance of the ResourceContentionManager class.
It is not required to be a singleton manner.
- Returns:
- The ResourceContentionManager instance.
setResourceFilter
public void setResourceFilter(AppsDatabaseFilter filter, java.lang.String resourceProxy)
- This method sets an instance of a concrete class that extends
AppsDatabaseFilter.
The AppsDatabaseFilter.accept(AppID) method returns true if an
application specified by the AppID is allowed to reserve the
resource, and returns false if the application is not allowed to
reserve it.
At most, only one AppsDatabaseFilter is set for each type of resource.
Multiple calls of this method replace the previous instance
by a new one.
If an AppsDatabaseFilter has not been associated with the
resource, then any application is allowed to reserve the resource.
By default, no AppsDatabaseFilter is set, i.e., all
applications are allowed to reserve the resource.
- Parameters:
filter
- the AppsDatabaseFilter to deny the application reserving the specified resource. If null is set, the AppsDatabaseFilter for the specified resource will be removed.resourceProxy
- A full path class name of a concrete class of the org.davic.resources.ResourceProxy interface. It specifies a resource type that the specified AppsDatabaseFilter filters. For example, "org.davic.net.tuning.NetworkInterfaceController".- Throws:
java.lang.SecurityException
- if the caller does not have MonitorAppPermission("handler.resource").
setResourceContentionHandler
public void setResourceContentionHandler(ResourceContentionHandler handler)
- This method sets the specified ResourceContentionHandler that decides
which application shall be denied reserving a scarce resource. At most
only one instance of ResourceContentionHandler can be set. Multiple
calls of this method replace the previous instance
by a new one. By default, no ResourceContentionHandler is set, i.e. the
ResourceContentionHandler.resolveResourceContention(org.ocap.resource.ResourceUsage, org.ocap.resource.ResourceUsage[])
method is not called.- Parameters:
handler
- the ResourceContentionHandler to be set. If null is set, the ResourceContentionHandler instance will be removed and theResourceContentionHandler.resolveResourceContention(org.ocap.resource.ResourceUsage, org.ocap.resource.ResourceUsage[])
method will not be called.- Throws:
java.lang.SecurityException
- if the caller does not have MonitorAppPermission("handler.resource").
getWarningPeriod
public int getWarningPeriod()
- Gets the warning period set by the setWarningPeriod method.
- Returns:
- The warning period in milli-seconds.
setWarningPeriod
public void setWarningPeriod(int warningPeriod)
- Sets the warning period used by the implementation to determine when to
call the resourceContentionWarning method in a registered
ResourceContentionHandler
. If the parameter is zero the implementation SHALL NOT call the resourceContentionWarning method. If the parameter is non-zero the implementation SHALL call the resourceContentionWarning method if it has enough information to do so. Setting the warningPeriod to non-zero MAY NOT cause the resourceContentionWarning method to be called for two reasons, 1) the implementation cannot determine when contention is going to happen, and 2) the warning period is longer than the duration to the contention.- Parameters:
warningPeriod
- New warning period in milli-seconds. If the value is smaller than the minimum clock resolution supported by the implementation, the implementation MAY round it up to the minimum.- Throws:
java.lang.IllegalArgumentException
- if the parameter is negative.java.lang.SecurityException
- if the caller does not have MonitorAppPermission("handler.resource").
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |