Code example for Semaphore

Methods: acquireUninterruptibly

0
 
    /** 
     * Blocks until the service has responded. 
     */ 
    public void waitForCompletion() { 
        stoplight.acquireUninterruptibly();
    } 
 
    /** 
     * Blocks until the service has responded or the thread is interrupted. 
     * 
     * @throws InterruptedException The thread has been interrupted while 
     *             waiting. 
     */ 
    public void waitInterruptiblyForCompletion() throws InterruptedException { 
        stoplight.acquire();
    } 
 
    @Override 
    public void heartbeatSucceeded(int reqId) throws RemoteException {
        // FIXME: currently no external callback