Class DataOperationOrderer

  • public class DataOperationOrderer
    extends java.lang.Object
    Ordering construct allowing concurrent operations that wish to do operations upon the same key to wait until the most recently registered operation is complete in a non blocking way.
    • Constructor Detail

      • DataOperationOrderer

        public DataOperationOrderer()
    • Method Detail

      • orderOn

        public java.util.concurrent.CompletionStage<DataOperationOrderer.Operation> orderOn​(java.lang.Object key,
                                                                                            java.util.concurrent.CompletionStage<DataOperationOrderer.Operation> register)
        Registers the provided Stage to be next in line to do an operation on behalf of the provided key. Returns a different Stage that when complete signals that this operation should continue or null if there is no wait required.
        key - delineating identifier for an operation
        register - stage to register for others to wait upon for future registrations
        stage that signals when the operation that is registering its own future may continue or null if nothing to wait on
      • completeOperation

        public void completeOperation​(java.lang.Object key,
                                      java.util.concurrent.CompletableFuture<DataOperationOrderer.Operation> registeredFuture,
                                      DataOperationOrderer.Operation operation)
        Completes a given operation and removes all internal references from the orderer
        key - delineating identifier for an operation
        registeredFuture - previously registered future that is removed from memory as needed
        operation - the type of operation