Class 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 Detail

      • OperationContextImpl

        public OperationContextImpl​(Executor executor)
    • Method Detail

      • clearContext

        public static void clearContext()
      • executeOnCompletion

        public void executeOnCompletion​(IOCallback runnable)
        Description copied from interface: OperationContext
        Execute the task when all IO operations are complete, Or execute it immediately if nothing is pending.
        Specified by:
        executeOnCompletion in interface OperationContext
        Parameters:
        runnable - the tas to be executed.
      • executeOnCompletion

        public void executeOnCompletion​(IOCallback completion,
                                        boolean storeOnly)
        Description copied from interface: OperationContext
        Execute the task when all IO operations are complete, Or execute it immediately if nothing is pending.
        Specified by:
        executeOnCompletion in interface OperationContext
        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()
        Description copied from interface: IOCallback
        Method 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:
        done in interface IOCallback
      • complete

        public void complete()
      • onError

        public void onError​(int errorCode,
                            String errorMessage)
        Description copied from interface: IOCallback
        Method 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:
        onError in interface IOCallback