Code example for Semaphore

Methods: release

0
            return newMember;
        } catch (RuntimeException e) {
            _sem.release();
            throw e;
        } catch (Error e) {
            _sem.release();
            throw e;
        } 
    } 
 
    private boolean permitAcquired(final long waitTime) throws InterruptedException {
        if (waitTime > 0) {
            return _sem.tryAcquire(waitTime, TimeUnit.MILLISECONDS);
        } else if (waitTime < 0) {
            _sem.acquire();
            return true; 
        } else { 
            return _sem.tryAcquire();
        } 
    } 
Connect your IDE to all the code out there  Get Codota for Java