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 theRESOURCE_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 togetType()
. The type MUST be unique (two Resource Monitor Factory instances MUST not have the same type).- Version:
- 1.0
- Author:
- $Id: 18d6e38893b8bef39ab3658af7635d997d4c7e4c $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
RESOURCE_TYPE_PROPERTY
Resource type property.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ResourceMonitor<T>
createResourceMonitor(ResourceContext resourceContext)
Creates a new ResourceMonitor instance.java.lang.String
getType()
Returns the type of ResourceMonitor instance this factory is able to create.
-
-
-
Field Detail
-
RESOURCE_TYPE_PROPERTY
static final java.lang.String RESOURCE_TYPE_PROPERTY
Resource type property. The value is of typeString
. For example,ResourceMonitoringService.RES_TYPE_CPU
- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
java.lang.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
-
-