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 the createContext(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).
    • 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 create ThreadMonitor 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 create CPUMonitor 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 create DiskStorageMonitor 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 create MemoryMonitor 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 create SocketMonitor 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

      • createContext

        ResourceContext createContext​(java.lang.String name,
                                      ResourceContext template)
        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 the ResourceContext 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.