Class L1WriteSynchronizer
- java.lang.Object
-
- org.infinispan.interceptors.distribution.L1WriteSynchronizer
-
public class L1WriteSynchronizer extends Object
A write synchronizer that allows for a single thread to run the L1 update while others can block until it is completed. Also allows for someone to attempt to cancel the write to the L1. If they are unable to, they should really wait until the L1 write has completed so they can guarantee their update will be ordered properly.- Since:
- 6.0
- Author:
- wburns
-
-
Constructor Summary
Constructors Constructor Description L1WriteSynchronizer(org.infinispan.container.impl.InternalDataContainer dc, long l1Lifespan, StateTransferLock stateTransferLock, ClusteringDependentLogic cdl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
get()
Object
get(long time, TimeUnit unit)
void
retrievalEncounteredException(Throwable t)
void
runL1UpdateIfPossible(InternalCacheEntry ice)
Attempts to the L1 update and set the value.boolean
trySkipL1Update()
Attempts to mark the L1 update to only retrieve the value and not to actually update the L1 cache.
-
-
-
Constructor Detail
-
L1WriteSynchronizer
public L1WriteSynchronizer(org.infinispan.container.impl.InternalDataContainer dc, long l1Lifespan, StateTransferLock stateTransferLock, ClusteringDependentLogic cdl)
-
-
Method Detail
-
get
public Object get() throws InterruptedException, ExecutionException
-
get
public Object get(long time, TimeUnit unit) throws TimeoutException, InterruptedException, ExecutionException
-
trySkipL1Update
public boolean trySkipL1Update()
Attempts to mark the L1 update to only retrieve the value and not to actually update the L1 cache. If the L1 skipping is not successful, that means it is currently running, which means for consistency any writes should wait until this update completes since the update doesn't acquire any locks- Returns:
- Whether or not it was successful in skipping L1 update
-
retrievalEncounteredException
public void retrievalEncounteredException(Throwable t)
-
runL1UpdateIfPossible
public void runL1UpdateIfPossible(InternalCacheEntry ice)
Attempts to the L1 update and set the value. If the L1 update was marked as being skipped this will instead just set the value to release blockers. A null value can be provided which will not run the L1 update but will just alert other waiters that a null was given.
-
-