Class OperationHandleImpl<T extends Annotation>
java.lang.Object
org.glassfish.hk2.extras.operation.internal.OperationHandleImpl<T>
- All Implemented Interfaces:
OperationHandle<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final OperationIdentifier
<T> private final Object
private final SingleOperationManager
<T> private OperationState
private Object
-
Constructor Summary
ConstructorsConstructorDescriptionOperationHandleImpl
(SingleOperationManager<T> parent, OperationIdentifier<T> identifier, Object operationLock, ServiceLocator locator) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
void
suspends this Operation on all threads where it is associated and closes the operation.boolean
Gets a set of threads upon which this Operation is activeReturns a unique identifier for this operationGets arbitrary Operation data to be associated with this OperationgetState()
Gets the current state of this operationint
hashCode()
void
resume()
Resumes this operation on the current thread.void
resume
(long threadId) Resumes this operation on the given thread id.void
setOperationData
(Object data) Sets arbitrary Operation data to be associated with this Operation(package private) void
operationLock must be heldvoid
suspend()
Suspends this operation on the current thread.void
suspend
(long threadId) Suspends this operation on the given thread id.toString()
-
Field Details
-
parent
-
identifier
-
operationLock
-
state
-
activeThreads
-
userData
-
-
Constructor Details
-
OperationHandleImpl
OperationHandleImpl(SingleOperationManager<T> parent, OperationIdentifier<T> identifier, Object operationLock, ServiceLocator locator)
-
-
Method Details
-
getIdentifier
Description copied from interface:OperationHandle
Returns a unique identifier for this operation- Specified by:
getIdentifier
in interfaceOperationHandle<T extends Annotation>
- Returns:
- A non-null unique identifier for this operation
-
getState
Description copied from interface:OperationHandle
Gets the current state of this operation- Specified by:
getState
in interfaceOperationHandle<T extends Annotation>
- Returns:
- The current state of this operation
-
shutdownByFiat
void shutdownByFiat()operationLock must be held -
checkState
private void checkState() -
getActiveThreads
Description copied from interface:OperationHandle
Gets a set of threads upon which this Operation is active- Specified by:
getActiveThreads
in interfaceOperationHandle<T extends Annotation>
- Returns:
- The set of threads upon which this Operation is active
-
suspend
public void suspend(long threadId) Description copied from interface:OperationHandle
Suspends this operation on the given thread id. If this Operation is not associated with the given threadId this method does nothing- Specified by:
suspend
in interfaceOperationHandle<T extends Annotation>
- Parameters:
threadId
- The thread on which to suspend this operation
-
suspend
public void suspend()Description copied from interface:OperationHandle
Suspends this operation on the current thread. If this Operation is not associated with the current threadId this method does nothing- Specified by:
suspend
in interfaceOperationHandle<T extends Annotation>
-
resume
Description copied from interface:OperationHandle
Resumes this operation on the given thread id. If this Operation is already associated with the given threadId this method does nothing- Specified by:
resume
in interfaceOperationHandle<T extends Annotation>
- Parameters:
threadId
- The thread on which to resume this operation- Throws:
IllegalStateException
- if the Operation is closed or if the given thread is associated with a different Operation of the same type
-
resume
Description copied from interface:OperationHandle
Resumes this operation on the current thread. If this Operation is already associated with the current thread this method does nothing- Specified by:
resume
in interfaceOperationHandle<T extends Annotation>
- Throws:
IllegalStateException
- if the Operation is closed or if the current thread is associated with a different Operation of the same type
-
closeOperation
public void closeOperation()Description copied from interface:OperationHandle
suspends this Operation on all threads where it is associated and closes the operation. All resume calls on this handle after this is called will throw IllegalStateException. If this handle is already closed this method does nothing- Specified by:
closeOperation
in interfaceOperationHandle<T extends Annotation>
-
getOperationData
Description copied from interface:OperationHandle
Gets arbitrary Operation data to be associated with this Operation- Specified by:
getOperationData
in interfaceOperationHandle<T extends Annotation>
- Returns:
- Arbitrary (possibly null) data that is associated with this Operation
-
setOperationData
Description copied from interface:OperationHandle
Sets arbitrary Operation data to be associated with this Operation- Specified by:
setOperationData
in interfaceOperationHandle<T extends Annotation>
- Parameters:
data
- (possibly null) data that is associated with this Operation
-
hashCode
public int hashCode() -
equals
-
toString
-