Class SynchronizedLimitedInt


  • public class SynchronizedLimitedInt
    extends Object
    Limited sync int var.
    • Field Detail

      • value_

        protected int value_
      • limit_

        protected int limit_
      • lock_

        protected final Object lock_
      • destroyed

        protected boolean destroyed
    • Constructor Detail

      • SynchronizedLimitedInt

        public SynchronizedLimitedInt​(int initialValue,
                                      int limit)
        Make a new SynchronizedLimitedInt with the given initial value, and using its own internal lock.
      • SynchronizedLimitedInt

        public SynchronizedLimitedInt​(int initialValue,
                                      int limit,
                                      Object lock)
        Make a new SynchronizedLimitedInt with the given initial value, and using the supplied lock.
    • Method Detail

      • get

        public final int get()
        Return the current value
      • increment

        public int increment()
        Increment the value.
        Returns:
        the new value
      • increment

        public int increment​(boolean doNotBlock)
        Increment the value.
        Returns:
        the new value
      • decrement

        public int decrement()
        Decrement the value.
        Returns:
        the new value
      • destroy

        public void destroy()
        Destroy this instance - wakeup and disable all sync waits.