Interface ResourceLifecycleManagement


  • public interface ResourceLifecycleManagement
    Resource management interface. Some resource pool such as JCR session pool can expose an implementation of this interface, and then the container can register disposable resources and unregister the disposable resources after serving request.
    Version:
    $Id$
    • Method Detail

      • isActive

        boolean isActive()
        Returns true if resource lifecycle management is turned on or forced to be turned on.
        Returns:
        true if resource lifecycle management is turned on or forced to be turned on.
      • setActive

        void setActive​(boolean active)
        Turns on or off the resource lifecycle management.
        Parameters:
        active -
      • isAlwaysActive

        boolean isAlwaysActive()
        Returns true if resource lifecycle management is forced to be turned on.
        Returns:
        true if resource lifecycle management is forced to be turned on.
      • setAlwaysActive

        void setAlwaysActive​(boolean alwaysActive)
        Forces to turn on or off the resource lifecycle management.
        Parameters:
        alwaysActive -
      • registerResource

        void registerResource​(Object resource)
        Registers a disposable resource.
        Parameters:
        resource -
      • unregisterResource

        void unregisterResource​(Object resource)
        Unregisters the disposable resource.
        Parameters:
        resource -
      • disposeResource

        void disposeResource​(Object resource)
        Dispose the specified resource.
        Parameters:
        resource -
      • containsResource

        boolean containsResource​(Object resource)
      • disposeAllResources

        void disposeAllResources()
        Dispose all the resources.
      • disposeResourcesAndReset

        void disposeResourcesAndReset()
        Dispose all the resources and reset this ResourceLifecycleManagement, for example clearing any thread local state
      • visitResources

        Object visitResources​(ResourceVisitor visitor)
        Traverses all the resource, calling the visitor's visit method at each one.
        Parameters:
        visitor - The visitor to call back to
        Returns:
        The return value from a visitor which halted the traversal, or null if the entire traversal occurred