Code example for Semaphore

Methods: acquireUninterruptibly

0
	* running at the same time. 
	* After calling this function, release() MUST be called, so make sure that 
	* every error scenario releases the lock at some point. 
	*/ 
	public void enqueueAndWait() { 
		semaphore.acquireUninterruptibly();
	} 
	 
	/** 
	* Signal that the build is done and a new one can get access. 
	*/ 
	public void release() { 
		semaphore.release();
	} 
	 
	/** 
	* Test if the lock is available, without blocking. 
	*/	 
	public boolean available() { 
		return semaphore.availablePermits() > 0;
	}