Code example for Lock

Methods: newCondition

0
    private long startTime;
    private InetAddress from;
 
    public AsyncResult() 
    {         
        condition = lock.newCondition();
        startTime = System.currentTimeMillis();
    }     
             
    public byte[] get(long timeout, TimeUnit tu) throws TimeoutException
    { 
        lock.lock();
        try 
        {             
            boolean bVal = true;
            try 
            { 
                if (!done.get())
                { 
                    timeout = TimeUnit.MILLISECONDS.convert(timeout, tu);
                    long overall_timeout = timeout - (System.currentTimeMillis() - startTime);