src/main/java/org/jboss/util/Semaphore.java
public void acquire() throws InterruptedException
   {
      synchronized (this)
      {
         logAcquire();
			
         // One user more called acquire, increase users
         ++m_users;
         boolean waitSuccessful = false;
         while (m_allowed <= 0)
         {
            waitSuccessful = waitImpl(this);
            if (!waitSuccessful) 
            {
               // Dealock was detected, restore status, 'cause it's like a release()
               // that will probably be never called
               --m_users;
               ++m_allowed;
            }
         }
         --m_allowed;
      }
   }
public void acquire() throws InterruptedException
   {
      synchronized (this)
      {
         logAcquire();
			
         // One user more called acquire, increase users
         ++m_users;
         boolean waitSuccessful = false;
         while (m_allowed <= 0)
         {
            waitSuccessful = waitImpl(this);
            if (!waitSuccessful) 
            {
               // Dealock was detected, restore status, 'cause it's like a release()
               // that will probably be never called
               --m_users;
               ++m_allowed;
            }
         }
         --m_allowed;
      }
   }
Sync implementation ----------------------------------------------