Interface ResourceMonitorFactory<T>
- Type Parameters:
T
- The type for the Resource.
public interface ResourceMonitorFactory<T>
A Resource Monitor Factory is a service that provides Resource Monitor
instances of a specific resource type (for example, CPUMonitor, MemoryMonitor...)
for every Resource Context.
Every Resource Monitor Factory service is registered with the
RESOURCE_TYPE_PROPERTY
mandatory property. This property indicates
which type of Resource Monitor a Resource Monitor Factory is able to create.
The type can also be retrieved through a call to getType()
. The type
MUST be unique (two Resource Monitor Factory instances MUST not have the same
type).-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateResourceMonitor
(ResourceContext resourceContext) Creates a new ResourceMonitor instance.getType()
Returns the type of ResourceMonitor instance this factory is able to create.
-
Field Details
-
RESOURCE_TYPE_PROPERTY
Resource type property. The value is of typeString
. For example,ResourceMonitoringService.RES_TYPE_CPU
- See Also:
-
-
Method Details
-
getType
String getType()Returns the type of ResourceMonitor instance this factory is able to create.- Returns:
- factory type
-
createResourceMonitor
ResourceMonitor<T> createResourceMonitor(ResourceContext resourceContext) throws ResourceMonitorException Creates a new ResourceMonitor instance. This instance is associated with the ResourceContext instance provided as argument (ResourceContext.addResourceMonitor(ResourceMonitor)
is called by the factory). The newly ResourceMonitor instance is disabled. It can be enabled by callingResourceMonitor.enable()
.- Parameters:
resourceContext
- ResourceContext instance associated with the newly created ResourceMonitor instance- Returns:
- a ResourceMonitor instance
- Throws:
ResourceMonitorException
- If the factory is unable to create a ResourceMonitor For example, when a ResourceMonitor of this type already exists for this ResourceContext
-