Package org.infinispan.util.concurrent
Class NonBlockingOrderer
- java.lang.Object
-
- org.infinispan.util.concurrent.NonBlockingOrderer
-
public class NonBlockingOrderer extends java.lang.ObjectOrdering 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNonBlockingOrderer.OPERATION
-
Constructor Summary
Constructors Constructor Description NonBlockingOrderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompleteOperation(java.lang.Object key, java.util.concurrent.CompletableFuture<NonBlockingOrderer.OPERATION> registeredFuture, NonBlockingOrderer.OPERATION operation)Completes a given operation by freeing any memory for the future and completing itjava.util.concurrent.CompletionStage<NonBlockingOrderer.OPERATION>orderOn(java.lang.Object key, java.util.concurrent.CompletionStage<NonBlockingOrderer.OPERATION> register)Registers the provided Stage to be next in line to do an operation on behalf of the provided key.
-
-
-
Method Detail
-
orderOn
public java.util.concurrent.CompletionStage<NonBlockingOrderer.OPERATION> orderOn(java.lang.Object key, java.util.concurrent.CompletionStage<NonBlockingOrderer.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(java.lang.Object key, java.util.concurrent.CompletableFuture<NonBlockingOrderer.OPERATION> registeredFuture, NonBlockingOrderer.OPERATION operation)Completes a given operation by freeing any memory for the future and completing it- Parameters:
key- delineating identifier for an operationregisteredFuture- previously registered future that is removed from memory as neededoperation- the type of operation
-
-