Class OperationManagerImpl
- java.lang.Object
-
- org.glassfish.hk2.extras.operation.internal.OperationManagerImpl
-
- All Implemented Interfaces:
OperationManager
@Singleton public class OperationManagerImpl extends Object implements OperationManager
- Author:
- jwells
-
-
Constructor Summary
Constructors Constructor Description OperationManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Annotation>
OperationHandle<T>createAndStartOperation(T scope)
Creates an OperationHandle that will be associated with the thread calling this method.<T extends Annotation>
OperationHandle<T>createOperation(T scope)
Creates an OperationHandle.<T extends Annotation>
OperationHandle<T>getCurrentOperation(T scope)
Gets the current operation of scope type on the current thread.<T extends Annotation>
Set<OperationHandle<T>>getCurrentOperations(T scope)
Gets a set of all Operations that are in stateOperationState.ACTIVE
orOperationState.SUSPENDED
.void
shutdownAllOperations(Annotation scope)
This method will suspend all currently open operations on all threads and then close them.
-
-
-
Method Detail
-
createOperation
public <T extends Annotation> OperationHandle<T> createOperation(T scope)
Description copied from interface:OperationManager
Creates an OperationHandle. The returned handle will not be associated with any threads. The scope parameter is normally created withAnnotationLiteral
- Specified by:
createOperation
in interfaceOperationManager
- Parameters:
scope
- The scope annotation for this operation type- Returns:
- A non-null OperationHandle that can be used to associate threads with the Operation
-
createAndStartOperation
public <T extends Annotation> OperationHandle<T> createAndStartOperation(T scope)
Description copied from interface:OperationManager
Creates an OperationHandle that will be associated with the thread calling this method. The scope parameter is normally created withAnnotationLiteral
- Specified by:
createAndStartOperation
in interfaceOperationManager
- Parameters:
scope
- The scope annotation for this operation type- Returns:
- A non-null OperationHandle that can be used to associate threads with the Operation
-
getCurrentOperations
public <T extends Annotation> Set<OperationHandle<T>> getCurrentOperations(T scope)
Description copied from interface:OperationManager
Gets a set of all Operations that are in stateOperationState.ACTIVE
orOperationState.SUSPENDED
. Operations that are in theOperationState.CLOSED
state are no longer tracked by the Manager. The scope parameter is normally created withAnnotationLiteral
- Specified by:
getCurrentOperations
in interfaceOperationManager
- Parameters:
scope
- The scope annotation for this operation type- Returns:
- A non-null but possibly empty set of OperationHandles that have not been closed
-
getCurrentOperation
public <T extends Annotation> OperationHandle<T> getCurrentOperation(T scope)
Description copied from interface:OperationManager
Gets the current operation of scope type on the current thread. The scope parameter is normally created withAnnotationLiteral
- Specified by:
getCurrentOperation
in interfaceOperationManager
- Parameters:
scope
- The scope annotation for this operation type- Returns:
- The current operation of the given type on this thread. May be null if there is no active operation on this thread of this type
-
shutdownAllOperations
public void shutdownAllOperations(Annotation scope)
Description copied from interface:OperationManager
This method will suspend all currently open operations on all threads and then close them. This will also remove all entities associated with this operation type, including the OperationHandle associated with this scope from the HK2 locator service registry. Therefore this mechanism of shutting down the operations should be used with care, and would normally only be used when the Operation type can never be used again.The scope parameter is normally created with
AnnotationLiteral
- Specified by:
shutdownAllOperations
in interfaceOperationManager
- Parameters:
scope
- The scope annotation for this operation type
-
-