Class OperationContextImpl
- java.lang.Object
-
- org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl
-
- All Implemented Interfaces:
IOCallback,IOCompletion,OperationContext
public class OperationContextImpl extends Object implements 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.
-
-
Constructor Summary
Constructors Constructor Description OperationContextImpl(Executor executor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclearContext()voidcomplete()voiddone()voidexecuteOnCompletion(IOCallback runnable)Execute the task when all IO operations are complete, Or execute it immediately if nothing is pending.voidexecuteOnCompletion(IOCallback completion, boolean storeOnly)Execute the task when all IO operations are complete, Or execute it immediately if nothing is pending.static OperationContextgetContext()static OperationContextgetContext(ExecutorFactory executorFactory)voidonError(int errorCode, String errorMessage)voidpageSyncDone()voidpageSyncLineUp()voidreplicationDone()voidreplicationLineUp()static voidsetContext(OperationContext context)voidstoreLineUp()StringtoString()voidwaitCompletion()booleanwaitCompletion(long timeout)
-
-
-
Constructor Detail
-
OperationContextImpl
public OperationContextImpl(Executor executor)
-
-
Method Detail
-
clearContext
public static void clearContext()
-
getContext
public static final OperationContext getContext()
-
getContext
public static OperationContext getContext(ExecutorFactory executorFactory)
-
setContext
public static void setContext(OperationContext context)
-
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
public void executeOnCompletion(IOCallback runnable)
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
public void executeOnCompletion(IOCallback completion, boolean storeOnly)
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:
completion- the tas to be executed.storeOnly- There are tasks that won't need to wait on replication or paging and will need to be completed as soon as the response from the journal is received. An example would be the DuplicateCache
-
done
public void done()
- Specified by:
donein interfaceIOCallback
-
complete
public void complete()
-
onError
public void onError(int errorCode, String errorMessage)- Specified by:
onErrorin interfaceIOCallback
-
waitCompletion
public void waitCompletion() throws Exception- Specified by:
waitCompletionin interfaceOperationContext- Throws:
Exception
-
waitCompletion
public boolean waitCompletion(long timeout) throws InterruptedException, ActiveMQException- Specified by:
waitCompletionin interfaceOperationContext- Parameters:
timeout- in milliseconds- Returns:
- Throws:
InterruptedExceptionActiveMQException
-
-