Class SingleOperationManager<T extends java.lang.annotation.Annotation>
- java.lang.Object
-
- org.glassfish.hk2.extras.operation.internal.SingleOperationManager<T>
-
public class SingleOperationManager<T extends java.lang.annotation.Annotation> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
closed
private OperationContext<T>
context
private static java.lang.String
ID_PREAMBLE
private ServiceLocator
locator
private java.util.HashMap<OperationIdentifier<T>,OperationHandleImpl<T>>
openScopes
private ActiveDescriptor<?>
operationDescriptor
private java.lang.Object
operationLock
private T
scope
private long
scopedIdentifier
private java.util.HashMap<java.lang.Long,OperationHandleImpl<T>>
threadToHandleMap
-
Constructor Summary
Constructors Constructor Description SingleOperationManager(T scope, ServiceLocator locator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private OperationIdentifierImpl<T>
allocateNewIdentifier()
(package private) void
associateWithThread(long threadId, OperationHandleImpl<T> handle)
OperationLock must be held(package private) void
closeOperation(OperationHandleImpl<T> closeMe)
Called with the operationLock heldOperationHandleImpl<T>
createOperation()
(package private) void
disassociateThread(long threadId, OperationHandleImpl<T> toRemove)
OperationLock must be held(package private) void
disposeAllOperationServices(OperationHandleImpl<T> closeMe)
Explicitly called WITHOUT the operationLock held to avoid any deadlock with the context lock(package private) java.util.Set<OperationHandle<T>>
getAllOperations()
OperationHandleImpl<T>
getCurrentOperationOnThisThread()
OperationLock need NOT be held(package private) OperationHandleImpl<T>
getCurrentOperationOnThisThread(long threadId)
OperationLock must be held(package private) void
shutdown()
java.lang.String
toString()
-
-
-
Field Detail
-
ID_PREAMBLE
private static final java.lang.String ID_PREAMBLE
- See Also:
- Constant Field Values
-
operationLock
private final java.lang.Object operationLock
-
scope
private final T extends java.lang.annotation.Annotation scope
-
openScopes
private final java.util.HashMap<OperationIdentifier<T extends java.lang.annotation.Annotation>,OperationHandleImpl<T extends java.lang.annotation.Annotation>> openScopes
-
threadToHandleMap
private final java.util.HashMap<java.lang.Long,OperationHandleImpl<T extends java.lang.annotation.Annotation>> threadToHandleMap
-
locator
private final ServiceLocator locator
-
context
private final OperationContext<T extends java.lang.annotation.Annotation> context
-
scopedIdentifier
private long scopedIdentifier
-
operationDescriptor
private final ActiveDescriptor<?> operationDescriptor
-
closed
private boolean closed
-
-
Constructor Detail
-
SingleOperationManager
SingleOperationManager(T scope, ServiceLocator locator)
-
-
Method Detail
-
allocateNewIdentifier
private OperationIdentifierImpl<T> allocateNewIdentifier()
-
createOperation
public OperationHandleImpl<T> createOperation()
-
closeOperation
void closeOperation(OperationHandleImpl<T> closeMe)
Called with the operationLock held- Parameters:
closeMe
- The non-null operation to close
-
disposeAllOperationServices
void disposeAllOperationServices(OperationHandleImpl<T> closeMe)
Explicitly called WITHOUT the operationLock held to avoid any deadlock with the context lock- Parameters:
closeMe
- The non-null operation to close
-
associateWithThread
void associateWithThread(long threadId, OperationHandleImpl<T> handle)
OperationLock must be held- Parameters:
threadId
- The threadId to associate with this handlehandle
- The handle to be associated with this thread
-
disassociateThread
void disassociateThread(long threadId, OperationHandleImpl<T> toRemove)
OperationLock must be held- Parameters:
threadId
- The threadId to disassociate with this handle
-
getCurrentOperationOnThisThread
OperationHandleImpl<T> getCurrentOperationOnThisThread(long threadId)
OperationLock must be held- Returns:
- The operation associated with the given thread
-
getCurrentOperationOnThisThread
public OperationHandleImpl<T> getCurrentOperationOnThisThread()
OperationLock need NOT be held- Returns:
- The operation associated with the current thread
-
getAllOperations
java.util.Set<OperationHandle<T>> getAllOperations()
-
shutdown
void shutdown()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-