Interface ResourceMonitoringService
-
public interface ResourceMonitoringService
It 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.String
FRAMEWORK_CONTEXT_NAME
The name of the special, optional resource context, representing the whole OSGi framework.static 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.static 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.static 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.static 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.static 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.static java.lang.String
SYSTEM_CONTEXT_NAME
The name of the Resource Context associated with System bundle (bundle 0).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ResourceContext
createContext(java.lang.String name, ResourceContext template)
Creates a newResourceContext
.ResourceContext
getContext(long bundleId)
Returns theResourceContext
associated to the provided bundle id.ResourceContext
getContext(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.ResourceMonitoringService
implementations must createThreadMonitor
instances 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.ResourceMonitoringService
implementations must createCPUMonitor
instances 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.ResourceMonitoringService
implementations must createDiskStorageMonitor
instances 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.ResourceMonitoringService
implementations must createMemoryMonitor
instances 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.ResourceMonitoringService
implementations must createSocketMonitor
instances 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_NAME
context and theSYSTEM_CONTEXT_NAME
context, if it is supported.- Returns:
- An array of
ResourceContext
objects, or an empty array, if no contexts have been created.
-
createContext
ResourceContext createContext(java.lang.String name, ResourceContext template)
Creates a newResourceContext
.A
ResourceContextEvent
with typeResourceContextEvent.RESOURCE_CONTEXT_CREATED
will 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
ResourceContext
instance. - 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
ResourceContext
with the specified name, or null if such a context doesn't exist
-
getContext
ResourceContext getContext(long bundleId)
Returns theResourceContext
associated to the provided bundle id.- Parameters:
bundleId
- bundle identifier- Returns:
- the
ResourceContext
associated 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
ResourceMonitoringService
implementation supports.
-
-