Class OperationContext<T extends Annotation>
- All Implemented Interfaces:
org.glassfish.hk2.api.Context<T>
Context for an Operation.
An operation is defined as a unit of work that can be associated with one or more java threads, but where two operations of the same type may not be associated with the same thread at the same time. Examples of such an operation might be a RequestScope or a TenantRequesteOperation. An operation is a more general concept than the normal Java EE request scope, since it does not require a Java EE container
Users of this API generally create a Scope annotation
and extend this class, implementing the Context.getScope()
and making sure the parameterized type is the Scope annotation.
The Scope annotation for an Operation is usually
Proxiable but does not have to be. As with all implementations
of Context the subclass of this class must be in the SingletonInjectsPerRequest
scope. The user code then uses the OperationManager and OperationHandle
to start and stop Operations and to associate and dis-associate
threads with Operations
Classes extending this class may also choose to override the method
Context.supportsNullCreation() which returns false by default
- Author:
- jwells
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseOperation(OperationHandleImpl<T> operation) booleancontainsKey(org.glassfish.hk2.api.ActiveDescriptor<?> descriptor) voiddestroyOne(org.glassfish.hk2.api.ActiveDescriptor<?> descriptor) <U> UfindOrCreate(org.glassfish.hk2.api.ActiveDescriptor<U> activeDescriptor, org.glassfish.hk2.api.ServiceHandle<?> root) booleanisActive()voidsetOperationManager(SingleOperationManager<T> manager) voidshutdown()booleantoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.glassfish.hk2.api.Context
getScope
-
Constructor Details
-
OperationContext
public OperationContext()
-
-
Method Details
-
findOrCreate
public <U> U findOrCreate(org.glassfish.hk2.api.ActiveDescriptor<U> activeDescriptor, org.glassfish.hk2.api.ServiceHandle<?> root) - Specified by:
findOrCreatein interfaceorg.glassfish.hk2.api.Context<T extends Annotation>
-
containsKey
public boolean containsKey(org.glassfish.hk2.api.ActiveDescriptor<?> descriptor) - Specified by:
containsKeyin interfaceorg.glassfish.hk2.api.Context<T extends Annotation>
-
destroyOne
public void destroyOne(org.glassfish.hk2.api.ActiveDescriptor<?> descriptor) - Specified by:
destroyOnein interfaceorg.glassfish.hk2.api.Context<T extends Annotation>
-
closeOperation
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceorg.glassfish.hk2.api.Context<T extends Annotation>
-
supportsNullCreation
public boolean supportsNullCreation()- Specified by:
supportsNullCreationin interfaceorg.glassfish.hk2.api.Context<T extends Annotation>
-
isActive
public boolean isActive()- Specified by:
isActivein interfaceorg.glassfish.hk2.api.Context<T extends Annotation>
-
setOperationManager
-
toString
-