Class CreditsSemaphore


  • public class CreditsSemaphore
    extends java.lang.Object
    • Constructor Detail

      • CreditsSemaphore

        public CreditsSemaphore​(int initialCredits)
    • Method Detail

      • acquire

        public void acquire()
                     throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • tryAcquire

        public boolean tryAcquire()
      • release

        public void release()
                     throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • release

        public void release​(int credits)
                     throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • setCredits

        public void setCredits​(int credits)
      • getCredits

        public int getCredits()
      • hasQueuedThreads

        public boolean hasQueuedThreads()