Interface ResourceMonitoringService
-
public interface ResourceMonitoringServiceIt manages the Resource Context instances. It is available through the OSGi service registry. This service holds the existing Resource Context instances. Resource Context instances are created by calling thecreateContext(String, ResourceContext)method.- Version:
- 1.0
- Author:
- $Id: 71758040cb5746f9763dc3421f177c6009532a8c $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFRAMEWORK_CONTEXT_NAMEThe name of the special, optional resource context, representing the whole OSGi framework.static java.lang.StringRES_TYPE_CPUThe name of the CPU resource type, used to monitor and control the CPU time used by a resource context.static java.lang.StringRES_TYPE_DISK_STORAGEThe name of the disk storage resource type, used to monitor and control the size of the persistent storage used by a resource context.static java.lang.StringRES_TYPE_MEMORYThe name of the memory resource type, used to monitor and control the size of the java heap used by a resource context.static java.lang.StringRES_TYPE_SOCKETThe name of the socket resource type, used to monitor and control the number of existing sockets used by a resource context.static java.lang.StringRES_TYPE_THREADSThe name of the threads resource type, used to monitor and control the number of threads created by a resource context.static java.lang.StringSYSTEM_CONTEXT_NAMEThe name of the Resource Context associated with System bundle (bundle 0).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ResourceContextcreateContext(java.lang.String name, ResourceContext template)Creates a newResourceContext.ResourceContextgetContext(long bundleId)Returns theResourceContextassociated to the provided bundle id.ResourceContextgetContext(java.lang.String name)Returns the context with the specified resource context name.java.lang.String[]getSupportedTypes()Returns a list with the supported resource type names.ResourceContext[]listContext()Lists all availableresource contexts.
-
-
-
Field Detail
-
RES_TYPE_THREADS
static final java.lang.String RES_TYPE_THREADS
The name of the threads resource type, used to monitor and control the number of threads created by a resource context.ResourceMonitoringServiceimplementations must createThreadMonitorinstances for this resource type.- See Also:
- Constant Field Values
-
RES_TYPE_CPU
static final java.lang.String RES_TYPE_CPU
The name of the CPU resource type, used to monitor and control the CPU time used by a resource context.ResourceMonitoringServiceimplementations must createCPUMonitorinstances for this resource type.- See Also:
- Constant Field Values
-
RES_TYPE_DISK_STORAGE
static final java.lang.String RES_TYPE_DISK_STORAGE
The name of the disk storage resource type, used to monitor and control the size of the persistent storage used by a resource context.ResourceMonitoringServiceimplementations must createDiskStorageMonitorinstances for this resource type.- See Also:
- Constant Field Values
-
RES_TYPE_MEMORY
static final java.lang.String RES_TYPE_MEMORY
The name of the memory resource type, used to monitor and control the size of the java heap used by a resource context.ResourceMonitoringServiceimplementations must createMemoryMonitorinstances for this resource type.- See Also:
- Constant Field Values
-
RES_TYPE_SOCKET
static final java.lang.String RES_TYPE_SOCKET
The name of the socket resource type, used to monitor and control the number of existing sockets used by a resource context.ResourceMonitoringServiceimplementations must createSocketMonitorinstances for this resource type.- See Also:
- Constant Field Values
-
FRAMEWORK_CONTEXT_NAME
static final java.lang.String FRAMEWORK_CONTEXT_NAME
The name of the special, optional resource context, representing the whole OSGi framework.- See Also:
- Constant Field Values
-
SYSTEM_CONTEXT_NAME
static final java.lang.String SYSTEM_CONTEXT_NAME
The name of the Resource Context associated with System bundle (bundle 0).- See Also:
- Constant Field Values
-
-
Method Detail
-
listContext
ResourceContext[] listContext()
Lists all availableresource contexts. The list will contain the specialFRAMEWORK_CONTEXT_NAMEcontext and theSYSTEM_CONTEXT_NAMEcontext, if it is supported.- Returns:
- An array of
ResourceContextobjects, or an empty array, if no contexts have been created.
-
createContext
ResourceContext createContext(java.lang.String name, ResourceContext template)
Creates a newResourceContext.A
ResourceContextEventwith typeResourceContextEvent.RESOURCE_CONTEXT_CREATEDwill be sent.- Parameters:
name- The name identifying the context. Names must be unique within the framework instance.template- If a template is provided, the new resource context will inherit all resource monitoring settings (enabled monitors, thresholds) from the template.- Returns:
- A new
ResourceContextinstance. - Throws:
java.lang.IllegalArgumentException- if a problem occurred, for example if the name is already used.
-
getContext
ResourceContext getContext(java.lang.String name)
Returns the context with the specified resource context name.- Parameters:
name- The resource context name- Returns:
- An existing
ResourceContextwith the specified name, or null if such a context doesn't exist
-
getContext
ResourceContext getContext(long bundleId)
Returns theResourceContextassociated to the provided bundle id.- Parameters:
bundleId- bundle identifier- Returns:
- the
ResourceContextassociated to bundle b or null if the bundle b does not belong to a Resource Context.
-
getSupportedTypes
java.lang.String[] getSupportedTypes()
Returns a list with the supported resource type names.- Returns:
- An array containing the names of all resource types that this
ResourceMonitoringServiceimplementation supports.
-
-