Package org.infinispan.util.concurrent
Class DataOperationOrderer
java.lang.Object
org.infinispan.util.concurrent.DataOperationOrderer
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.
- Since:
- 10.0
- Author:
- wburns
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
completeOperation
(Object key, CompletableFuture<DataOperationOrderer.Operation> registeredFuture, DataOperationOrderer.Operation operation) Completes a given operation and removes all internal references from the orderergetCurrentStage
(Object key) For testing purposes onlyorderOn
(Object key, CompletionStage<DataOperationOrderer.Operation> register) Registers the provided Stage to be next in line to do an operation on behalf of the provided key.int
Returns how many keys have pending operations waiting for their completion
-
Constructor Details
-
DataOperationOrderer
public DataOperationOrderer()
-
-
Method Details
-
pendingOperations
public int pendingOperations()Returns how many keys have pending operations waiting for their completion- Returns:
- number of keys with pending operations
-
orderOn
public CompletionStage<DataOperationOrderer.Operation> orderOn(Object key, 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.- Parameters:
key
- delineating identifier for an operationregister
- stage to register for others to wait upon for future registrations- Returns:
- 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(Object key, CompletableFuture<DataOperationOrderer.Operation> registeredFuture, DataOperationOrderer.Operation operation) Completes a given operation and removes all internal references from the orderer- Parameters:
key
- delineating identifier for an operationregisteredFuture
- previously registered future that is removed from memory as neededoperation
- the type of operation
-
getCurrentStage
For testing purposes only
-