Package org.hippoecm.hst.core
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 Summary
Modifier and TypeMethodDescriptionboolean
containsResource
(Object resource) void
Dispose all the resources.void
disposeResource
(Object resource) Dispose the specified resource.void
Dispose all the resources and reset thisResourceLifecycleManagement
, for example clearing any thread local stateboolean
isActive()
Returns true if resource lifecycle management is turned on or forced to be turned on.boolean
Returns true if resource lifecycle management is forced to be turned on.void
registerResource
(Object resource) Registers a disposable resource.void
setActive
(boolean active) Turns on or off the resource lifecycle management.void
setAlwaysActive
(boolean alwaysActive) Forces to turn on or off the resource lifecycle management.void
unregisterResource
(Object resource) Unregisters the disposable resource.visitResources
(ResourceVisitor visitor) Traverses all the resource, calling the visitor's visit method at each one.
-
Method Details
-
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
Registers a disposable resource.- Parameters:
resource
-
-
unregisterResource
Unregisters the disposable resource.- Parameters:
resource
-
-
disposeResource
Dispose the specified resource.- Parameters:
resource
-
-
containsResource
-
disposeAllResources
void disposeAllResources()Dispose all the resources. -
disposeResourcesAndReset
void disposeResourcesAndReset()Dispose all the resources and reset thisResourceLifecycleManagement
, for example clearing any thread local state -
visitResources
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
-