Class ResourceContextFactory

    • Method Detail

      • isEnabled

        public static boolean isEnabled()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns true if and only if ResourceManagement is enabled. Refer to supportedResourceTypes() for the set of resources available.
        Returns:
        true if and only if ResourceManagement is enabled; otherwise false
        Throws:
        SecurityException - if a SecurityManager is installed and the RuntimePermission("jdk.management.resource.getResourceContextFactory) is denied
      • getInstance

        public static ResourceContextFactory getInstance()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the factory for ResourceContexts if enabled in the runtime.
        Returns:
        the factory for ResourceContexts
        Throws:
        SecurityException - if a SecurityManager is installed and the RuntimePermission("jdk.management.resource.getResourceContextFactory) is denied
      • create

        public ResourceContext create​(String name)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Create a new ResourceContext. A new empty ResourceContext with the specified name is created. The names of ResourceContexts must be unique. Use close to dispose of a ResourceContext.
        Parameters:
        name - a name for the ResourceContext
        Returns:
        a new ResourceContext
        Throws:
        IllegalArgumentException - if a ResourceContext with the name already exists.
        UnsupportedOperationException - if the number of ResourceContexts exceeds implementation limits
      • lookup

        public ResourceContext lookup​(String name)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the ResourceContext given by name.
        Parameters:
        name - the name
        Returns:
        the ResourceContext given by name; null if there is no ResourceContext with the name
      • getThreadContext

        public ResourceContext getThreadContext()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the ResourceContext associated with the current thread.
        Returns:
        the ResourceContext associated with the current thread; the unassigned context if the thread is not associated with any context
      • getThreadContext

        public ResourceContext getThreadContext​(Thread thread)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the ResourceContext associated with the thread.
        Parameters:
        thread - the thread to query
        Returns:
        the ResourceContext associated with the current thread; the unassigned context if the thread is not associated with any context
      • getResourceRequest

        public ResourceRequest getResourceRequest​(ResourceType type)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the ResourceRequest for the current ResourceContext and ResourceType. If there is no ResourceContext associated with the current thread, the unassigned context is used.
        Parameters:
        type - the ResourceType of the resource making the request
        Returns:
        a ResourceRequest; null if there is no ResourceMeter with the type in the ResourceContext
      • getUnassignedContext

        public ResourceContext getUnassignedContext()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns the ResourceContext that is the default when a thread is not associated with a ResourceContext.
        Returns:
        the unassigned ResourceContext
      • getTotalsContext

        public ResourceContext getTotalsContext()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns a ResourceContext that provides the totals for all ResourceContexts. The meters reflect the sum of all other ResourceContexts plus the final counts of removed ResourceContexts. These meters are read only and are only updated by changes to active ResourceContexts.
        Returns:
        the totals ResourceContext
      • contexts

        public Stream<ResourceContext> contexts()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns a Stream of the existing ResourceContexts.
        Returns:
        a Stream of the existing ResourceContexts
      • supportedResourceTypes

        public Set<ResourceType> supportedResourceTypes()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns a read-only Set of the builtin ResourceTypes available in the current runtime.
        Returns:
        a read-only Set of the builtin ResourceTypes available in the current runtime; non-null