ResourceMonitor objects are returned by the
ResourceContext#getMonitor(String) method.
The ResourceMonitor object may be used to:
A resource monitor can have a sampling period, a monitored period, or both. For example, for CPU monitoring, the resource monitor implementation can get the CPU usage of the running threads once per minute, and calculate the CPU usage per context in percentages based on the last ten such measurements. This could make a 60 000 milliseconds sampling period, and a 600 000 milliseconds monitored period.
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | disable()
Disable the monitoring of this resource type for the resource context associated with this monitor instance. |
| public void | enable()
Enable the monitoring of this resource type for the resource context associated with this monitor instance. |
| public boolean | |
| public ResourceContext | Returns: The associatedResourceContextReturns the resource context that this monitor belongs to |
| public long | Returns: The monitored period in milliseconds, or-1 if a
monitored period is not relevant for this resource type.Returns the time period for which the usage of this resource type is monitored. |
| public String | Returns: The name of the monitored resource typeThe name of the resource type that this monitor represents |
| public long | Returns: The sampling period in milliseconds, or-1 if a
sampling period is not relevant for this resource type.Returns the sampling period for this resource type. |
| public Comparable | Returns: The current usage of this resource type.Returns an object representing the current usage of this resource type by this resource context. |
| public int | |
| public boolean | |
| public boolean | Returns: true if monitoring for this resource type is enabled
for this context, false otherwiseChecks if the monitoring for this resource type is enabled for this resource context |
| delete | back to summary |
|---|---|
| public void delete() throws ResourceMonitorException Disable and delete this instance of Resource Monitor. This method MUST update the list of ResourceMonitor instances hold by the Resource Context (getContext().removeMonitor(this)).
| |
| disable | back to summary |
|---|---|
| public void disable() throws ResourceMonitorException Disable the monitoring of this resource type for the resource context associated with this monitor instance. The resource usage is not available until it is enabled again.
| |
| enable | back to summary |
|---|---|
| public void enable() throws ResourceMonitorException Enable the monitoring of this resource type for the resource context associated with this monitor instance. This method SHOULD also update the current resource consumption value (to take into account all previous resource allocations and releases occurred during the time the monitor was disabled).
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object resourceMonitor) Checks if resourceMonitor is equals to the current instance. A ResourceMonitor rm1 is equals to a ResourceMonitor rm2 if rm1.getContext().equals(rm2.getContext()) and r1.getType().equals(rm2.getType()).
| |
| getContext | back to summary |
|---|---|
| public ResourceContext getContext() Returns the resource context that this monitor belongs to
| |
| getMonitoredPeriod | back to summary |
|---|---|
| public long getMonitoredPeriod() Returns the time period for which the usage of this resource type is monitored.
| |
| getResourceType | back to summary |
|---|---|
| public String getResourceType() The name of the resource type that this monitor represents
| |
| getSamplingPeriod | back to summary |
|---|---|
| public long getSamplingPeriod() Returns the sampling period for this resource type.
| |
| getUsage | back to summary |
|---|---|
| public Comparable Returns an object representing the current usage of this resource type by this resource context.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Retrieves the hashCode value of this ResourceMonitor. The hashCode value is based on the hashCode value of the associated ResourceContext and the hashCode value of the type.
| |
| isDeleted | back to summary |
|---|---|
| public boolean isDeleted() Returns true if the ResourceMonitor instance has been deleted, that is the
| |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled() Checks if the monitoring for this resource type is enabled for this resource context
| |