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 boolean countDownToZero​(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

      • countDownToZero

        public static boolean countDownToZero​(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:
        counter - atomic counter
        Returns:
        true if this Thread modified concurrent counter from any positive number down to zero.