Class OperationContextImpl
java.lang.Object
org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl
- All Implemented Interfaces:
IOCallback,IOCompletion,OperationContext
Each instance of OperationContextImpl is associated with an executor (usually an ordered Executor).
Tasks are hold until the operations are complete and executed in the natural order as soon as the operations are returned from replication and storage.
If there are no pending IO operations, the tasks are just executed at the callers thread without any context switch.
So, if you are doing operations that are not dependent on IO (e.g NonPersistentMessages) you wouldn't have any context switch.
If you need to track store operations you can set the system property "ARTEMIS_OPCONTEXT_MAX_DEBUG_TRACKERS" with the max number of trackers that you want to keep in memory.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidvoidcomplete()voiddone()Method for sync notifications.voidexecuteOnCompletion(IOCallback runnable) Execute the task when all IO operations are complete, Or execute it immediately if nothing is pending.voidexecuteOnCompletion(IOCallback completion, OperationConsistencyLevel consistencyLevel) Execute the task when all IO operations are complete, Or execute it immediately if nothing is pending.static final OperationContextstatic OperationContextgetContext(ExecutorFactory executorFactory) protected org.apache.commons.collections.Bufferprotected static intlonggetPaged()longlonglonglonglongvoidMethod for error notifications.voidvoidvoidvoidvoidreset()static voidsetContext(OperationContext context) protected static voidsetMaxDebugTrackers(int maxDebugTrackers) voidtoString()voidbooleanwaitCompletion(long timeout) Wait for the completion of this operation.
-
Constructor Details
-
OperationContextImpl
-
-
Method Details
-
clearContext
public static void clearContext() -
getContext
-
getContext
-
setContext
-
getReplicationLineUpField
public long getReplicationLineUpField() -
getReplicated
public long getReplicated() -
getStoreLineUpField
public long getStoreLineUpField() -
getStored
public long getStored() -
getPagedLinedUpField
public long getPagedLinedUpField() -
getPaged
public long getPaged() -
getMaxDebugTrackers
protected static int getMaxDebugTrackers() -
setMaxDebugTrackers
protected static void setMaxDebugTrackers(int maxDebugTrackers) -
getDebugTrackers
protected org.apache.commons.collections.Buffer getDebugTrackers() -
pageSyncLineUp
public void pageSyncLineUp()- Specified by:
pageSyncLineUpin interfaceOperationContext
-
pageSyncDone
public void pageSyncDone()- Specified by:
pageSyncDonein interfaceOperationContext
-
storeLineUp
public void storeLineUp()- Specified by:
storeLineUpin interfaceIOCompletion
-
replicationLineUp
public void replicationLineUp()- Specified by:
replicationLineUpin interfaceOperationContext
-
replicationDone
public void replicationDone()- Specified by:
replicationDonein interfaceOperationContext
-
executeOnCompletion
Description copied from interface:OperationContextExecute the task when all IO operations are complete, Or execute it immediately if nothing is pending.- Specified by:
executeOnCompletionin interfaceOperationContext- Parameters:
runnable- the tas to be executed.
-
executeOnCompletion
Description copied from interface:OperationContextExecute the task when all IO operations are complete, Or execute it immediately if nothing is pending. Notice it's possible to pass a consistencyLevel to what should be waited before completing the operation.- Specified by:
executeOnCompletionin interfaceOperationContext
-
done
public void done()Description copied from interface:IOCallbackMethod for sync notifications. When this callback method is called, there is a guarantee the data is written on the disk.Note:Leave this method as soon as possible, or you would be blocking the whole notification thread
- Specified by:
donein interfaceIOCallback
-
complete
public void complete() -
onError
Description copied from interface:IOCallbackMethod for error notifications. Observation: The whole file will be probably failing if this happens. Like, if you delete the file, you will start to get errors for these operations- Specified by:
onErrorin interfaceIOCallback
-
waitCompletion
- Specified by:
waitCompletionin interfaceOperationContext- Throws:
Exception
-
waitCompletion
Description copied from interface:OperationContextWait for the completion of this operation.- Specified by:
waitCompletionin interfaceOperationContext- Parameters:
timeout- how long to wait in milliseconds- Returns:
trueif the operation completed within the specified timeout;falseif not- Throws:
InterruptedExceptionActiveMQException
-
toString
-
reset
public void reset()- Specified by:
resetin interfaceOperationContext
-