Class L1WriteSynchronizer


  • public class L1WriteSynchronizer
    extends java.lang.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 Detail

      • L1WriteSynchronizer

        public L1WriteSynchronizer​(org.infinispan.container.impl.InternalDataContainer dc,
                                   long l1Lifespan,
                                   StateTransferLock stateTransferLock,
                                   ClusteringDependentLogic cdl,
                                   java.util.concurrent.Executor persistenceExecutor)
    • Method Detail

      • get

        public java.lang.Object get()
                             throws java.lang.InterruptedException,
                                    java.util.concurrent.ExecutionException
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • get

        public java.lang.Object get​(long time,
                                    java.util.concurrent.TimeUnit unit)
                             throws java.util.concurrent.TimeoutException,
                                    java.lang.InterruptedException,
                                    java.util.concurrent.ExecutionException
        Throws:
        java.util.concurrent.TimeoutException
        java.lang.InterruptedException
        java.util.concurrent.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​(java.lang.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.