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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
containsResource(Object resource)
void
disposeAllResources()
Dispose all the resources.void
disposeResource(Object resource)
Dispose the specified resource.void
disposeResourcesAndReset()
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
isAlwaysActive()
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.Object
visitResources(ResourceVisitor visitor)
Traverses all the resource, calling the visitor's visit method at each one.
-
-
-
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 thisResourceLifecycleManagement
, 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
-
-