java.lang.Object
io.helidon.integrations.cdi.referencecountedcontext.ReferenceCountedContext
All Implemented Interfaces:
AlterableContext, Context

public final class ReferenceCountedContext extends Object implements AlterableContext
A somewhat special-purpose AlterableContext that destroys a contextual instance when its thread-specific reference count drops to zero or less than zero.

A contextual instance's thread-specific reference count is incremented when either the get(Contextual) or get(Contextual, CreationalContext) method is called. It is decremented when the obtained instance is passed to the decrementReferenceCount(Contextual) method, which is indirectly and solely responsible for that instance's ultimate removal from this ReferenceCountedContext.

Internally, the destroy(Contextual) method simply calls decrementReferenceCount(Contextual).

Thread Safety

Instances of this class are safe for concurrent use by multiple threads.

See Also: