Class ConcurrencyUtils


  • public final class ConcurrencyUtils
    extends java.lang.Object
    Concurrency utilities.
    Since:
    2.19
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ConcurrencyUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void runIfZeroCountDown​(java.lang.Runnable runner, java.util.concurrent.atomic.AtomicInteger counter)
      Decreases counter to zero, or does not change the counter if negative.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConcurrencyUtils

        private ConcurrencyUtils()
    • Method Detail

      • runIfZeroCountDown

        public static void runIfZeroCountDown​(java.lang.Runnable runner,
                                              java.util.concurrent.atomic.AtomicInteger counter)
        Decreases counter to zero, or does not change the counter if negative. This method pretends been atomic. Only one thread can succeed setting the counter to zero.
        Parameters:
        runner - run if this Thread has concurrently decremented the counter down to zero
        counter - atomic counter