public class OperationHandleImpl<T extends java.lang.annotation.Annotation> extends java.lang.Object implements OperationHandle<T>
| Modifier and Type | Field and Description |
|---|---|
private java.util.HashSet<java.lang.Long> |
activeThreads |
private OperationIdentifier<T> |
identifier |
private java.lang.Object |
operationLock |
private SingleOperationManager<T> |
parent |
private OperationState |
state |
private java.lang.Object |
userData |
| Constructor and Description |
|---|
OperationHandleImpl(SingleOperationManager<T> parent,
OperationIdentifier<T> identifier,
java.lang.Object operationLock,
ServiceLocator locator) |
| Modifier and Type | Method and Description |
|---|---|
private void |
checkState() |
void |
closeOperation()
suspends this Operation on all threads where it is associated
and closes the operation.
|
boolean |
equals(java.lang.Object o) |
java.util.Set<java.lang.Long> |
getActiveThreads()
Gets a set of threads upon which this Operation is active
|
OperationIdentifier<T> |
getIdentifier()
Returns a unique identifier for this operation
|
java.lang.Object |
getOperationData()
Gets arbitrary Operation data to be associated
with this Operation
|
OperationState |
getState()
Gets the current state of this operation
|
int |
hashCode() |
void |
resume()
Resumes this operation on the current thread.
|
void |
resume(long threadId)
Resumes this operation on the given thread id.
|
void |
setOperationData(java.lang.Object data)
Sets arbitrary Operation data to be associated
with this Operation
|
(package private) void |
shutdownByFiat()
operationLock must be held
|
void |
suspend()
Suspends this operation on the current thread.
|
void |
suspend(long threadId)
Suspends this operation on the given thread id.
|
java.lang.String |
toString() |
private final SingleOperationManager<T extends java.lang.annotation.Annotation> parent
private final OperationIdentifier<T extends java.lang.annotation.Annotation> identifier
private final java.lang.Object operationLock
private OperationState state
private final java.util.HashSet<java.lang.Long> activeThreads
private java.lang.Object userData
OperationHandleImpl(SingleOperationManager<T> parent, OperationIdentifier<T> identifier, java.lang.Object operationLock, ServiceLocator locator)
public OperationIdentifier<T> getIdentifier()
OperationHandlegetIdentifier in interface OperationHandle<T extends java.lang.annotation.Annotation>public OperationState getState()
OperationHandlegetState in interface OperationHandle<T extends java.lang.annotation.Annotation>void shutdownByFiat()
private void checkState()
public java.util.Set<java.lang.Long> getActiveThreads()
OperationHandlegetActiveThreads in interface OperationHandle<T extends java.lang.annotation.Annotation>public void suspend(long threadId)
OperationHandlesuspend in interface OperationHandle<T extends java.lang.annotation.Annotation>threadId - The thread on which to suspend this operationpublic void suspend()
OperationHandlesuspend in interface OperationHandle<T extends java.lang.annotation.Annotation>public void resume(long threadId)
throws java.lang.IllegalStateException
OperationHandleresume in interface OperationHandle<T extends java.lang.annotation.Annotation>threadId - The thread on which to resume this operationjava.lang.IllegalStateException - if the Operation is closed or
if the given thread is associated with a different Operation
of the same typepublic void resume()
throws java.lang.IllegalStateException
OperationHandleresume in interface OperationHandle<T extends java.lang.annotation.Annotation>java.lang.IllegalStateException - if the Operation is closed or
if the current thread is associated with a different Operation
of the same typepublic void closeOperation()
OperationHandlecloseOperation in interface OperationHandle<T extends java.lang.annotation.Annotation>public java.lang.Object getOperationData()
OperationHandlegetOperationData in interface OperationHandle<T extends java.lang.annotation.Annotation>public void setOperationData(java.lang.Object data)
OperationHandlesetOperationData in interface OperationHandle<T extends java.lang.annotation.Annotation>data - (possibly null) data that
is associated with this Operationpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object