Code example for TimeoutException

0
                throw new AssertionError(ex);
            } 
             
            if (!bVal && !done.get())
            {                                            
                throw new TimeoutException("Operation timed out.");
            } 
        } 
        finally 
        { 
            lock.unlock();
        } 
        return result;
    } 
 
    public void result(Message response)
    {         
        try 
        { 
            lock.lock();
            if (!done.get())