public void blockUntilRespond() throws InterruptedException { // Block thread by trying to acquire the semaphore a second time. boolean acquired = semaphore.tryAcquire(TIMEOUT, TimeUnit.MINUTES); if (acquired) { // Release the semaphore previously acquired. semaphore.release(); } else { LOG.error( "No response sent to " + "request '" + request.getRequestURI() + "' " + "with ICEfaces ID '" + request.getParameter("ice.session") + "' " + "from " + request.getRemoteAddr() + " " + "in " + TIMEOUT + " minutes. " + "Unblocking " + "thread '" + Thread.currentThread().getName() + "'."); // Release the semaphore; most probably respondWith() method was not invoked. semaphore.release(); } }