Interface BoundContext<S>
-
- Type Parameters:
S
- the type of the external instance storage
- All Superinterfaces:
AlterableContext
,Context
,WeldAlterableContext
- All Known Subinterfaces:
BoundConversationContext
,BoundRequestContext
,BoundSessionContext
,EjbRequestContext
,HttpConversationContext
,HttpRequestContext
,HttpSessionContext
- All Known Implementing Classes:
AbstractBoundContext
,AbstractConversationContext
,BoundConversationContextImpl
,BoundRequestContextImpl
,BoundSessionContextImpl
public interface BoundContext<S> extends WeldAlterableContext
Allows a thread-based context to be bound to some external instance storage (such as an HttpSession).
A context may be detachable in which case a call to
ManagedContext.invalidate()
will detach the context from it's associated storage. A detached context is still usable (instances may be added or removed) however changes will not be written through to the underlying data store.Normally, a detachable context will have it's underlying bean store attached on a call to
ManagedContext.activate()
and detached on a call toManagedContext.deactivate()
however a subtype ofBoundContext
may change this behavior.If you call
associate(Object)
you must ensure that you calldissociate(Object)
in all cases, otherwise you risk memory leaks.- Author:
- Pete Muir
- See Also:
ManagedContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
associate(S storage)
Associate the context with the storage (for this thread).boolean
dissociate(S storage)
Dissociate the context from the storage (for this thread).-
Methods inherited from interface jakarta.enterprise.context.spi.AlterableContext
destroy
-
Methods inherited from interface jakarta.enterprise.context.spi.Context
get, get, getScope, isActive
-
Methods inherited from interface org.jboss.weld.context.WeldAlterableContext
clearAndSet, getAllContextualInstances
-
-
-
-
Method Detail
-
associate
boolean associate(S storage)
Associate the context with the storage (for this thread). Onceassociate(Object)
has been called, further calls toassociate(Object)
will be ignored, until the context has been subsequentlydissociate(Object)
from the storage.- Parameters:
storage
- the external storage- Returns:
- true if the storage was attached, otherwise false
-
dissociate
boolean dissociate(S storage)
Dissociate the context from the storage (for this thread). The context will only dissociate from the same storage it associated with.- Parameters:
storage
- the external storage- Returns:
- true if the storage was dissociated
-
-