|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable
public class AvailabilityCollectorRunnable
A class that can be used by plugins whose components may not be able to collect availability statuses fast enough.
Typically, availability checks are very fast (sub-second). However, the plugin container puts a time limit
on how long it will wait for a plugin's resource component to return availability status from calls to
AvailabilityFacet.getAvailability()
. This time limit is typically on the order of several seconds.
The purpose of this time limit is to avoid having a rogue or misbehaving plugin from causing delays in availability
reporting for the rest of the resources being managed within the system.
This class provides an implementation to help resource components that can't guarantee how fast its
availability checks will be. Some managed resources simply can't respond to avaiability checks fast enough. In this
case, this class will provide an asynchronous method that will collect availability without a timeout being involved
(in other words, availability will be retrieved by waiting as long as it takes). In order to tell the plugin container
what the managed resource's current availability is, this class will provide a fast method to return the last known
availability of the resource. In other words, it will be able to return the last know availability that was last retrieved
by the asynchronous task - this retrieval of the last known availability will be very fast.
Field Summary | |
---|---|
static long |
MIN_INTERVAL
The minimum interval allowed between availability checks, in milliseconds. |
Constructor Summary | |
---|---|
AvailabilityCollectorRunnable(AvailabilityFacet availabilityChecker,
long interval,
ClassLoader contextClassloader,
Executor threadPool)
Creates a collector instance that will perform availability checking for a particular managed resource. |
Method Summary | |
---|---|
AvailabilityType |
getLastKnownAvailability()
This returns the last known availability status that was most recently retrieved from the managed resource. |
void |
run()
Performs the actual availability checking. |
void |
start()
For those resource components using this availability collector utility, their ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext) method must call this
to start the availability checking that this object performs. |
void |
stop()
For those resource components using this availability collector utility, their ResourceComponent#stop() method must call this
to stop the availability checking that this object performs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long MIN_INTERVAL
Constructor Detail |
---|
public AvailabilityCollectorRunnable(AvailabilityFacet availabilityChecker, long interval, ClassLoader contextClassloader, Executor threadPool)
MIN_INTERVAL
.
availabilityChecker
- the object that is used to periodically check the managed resource (must not be null
)interval
- the interval, in millis, between checking availabilities.contextClassloader
- the context classloader that will be used when checking availabilitythreadPool
- the thread pool to be used to submit this runnable when it needs to startMethod Detail |
---|
public AvailabilityType getLastKnownAvailability()
AvailabilityFacet.getAvailability()
method should simply be calling this method.
AvailabilityType.UP
if the resource can be accessed; otherwise AvailabilityType.DOWN
public void start()
ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
method must call this
to start the availability checking that this object performs.
public void stop()
ResourceComponent#stop()
method must call this
to stop the availability checking that this object performs.
public void run()
submitted to the thread pool
.
You should not be calling this method directly - use start()
instead.
run
in interface Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |