Class QueuedSemaphore

    • Method Detail

      • acquire

        public void acquire()
                     throws java.lang.InterruptedException
        Description copied from class: Semaphore
        Wait until a permit is available, and take one
        Specified by:
        acquire in interface Sync
        Overrides:
        acquire in class Semaphore
        Throws:
        java.lang.InterruptedException
      • attempt

        public boolean attempt​(long msecs)
                        throws java.lang.InterruptedException
        Description copied from class: Semaphore
        Wait at most msecs millisconds for a permit.
        Specified by:
        attempt in interface Sync
        Overrides:
        attempt in class Semaphore
        Parameters:
        msecs - the number of milleseconds to wait. An argument less than or equal to zero means not to wait at all. However, this may still require access to a synchronization lock, which can impose unbounded delay if there is a lot of contention among threads.
        Returns:
        true if acquired
        Throws:
        java.lang.InterruptedException
      • precheck

        protected boolean precheck()
      • release

        public void release​(long n)
        Release N permits
        Overrides:
        release in class Semaphore