Condition await - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Condition await method.

This code example shows how to use the following methods:await
    } 
 
    public void await(long timeout) throws InterruptedException { 
        try { 
            reentrantLock.lock(); 
            loadDataFromNetworkHasBeenExecuted.await(timeout, 
                TimeUnit.MILLISECONDS); 
        } finally { 
            reentrantLock.unlock(); 
        } 
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:await
    } 
 
    public void await( long millisecond ) throws InterruptedException {
        lock.lock();
        try { 
            requestFinishedCondition.await( millisecond, TimeUnit.MILLISECONDS );
        } finally { 
            lock.unlock();
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:await
    } 
 
    public void await(long millisecond) throws InterruptedException {
        lock.lock();
        try { 
            requestFinishedCondition.await(millisecond, TimeUnit.MILLISECONDS);
        } finally { 
            lock.unlock();
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:await
    } 
 
    public void await(long millisecond) throws InterruptedException {
        lock.lock();
        try { 
            requestFinishedCondition.await(millisecond, TimeUnit.MILLISECONDS);
        } finally { 
            lock.unlock();
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:convert
            boolean bVal = true;
            try 
            { 
                if (!done.get())
                { 
                    timeout = TimeUnit.MILLISECONDS.convert(timeout, tu);
                    long overall_timeout = timeout - (System.currentTimeMillis() - startTime);
                    bVal = overall_timeout > 0 && condition.await(overall_timeout, TimeUnit.MILLISECONDS);
                } 
            } 
            catch (InterruptedException ex)
            { 
                throw new AssertionError(ex);
            } 
             
            if (!bVal && !done.get())
            {                                            
                throw new TimeoutException("Operation timed out.");
            } 
        } 
6
CodeRank
This code example shows how to use the following methods:await
    } 
 
    public void await(long millisecond) throws InterruptedException {
        lock.lock();
        try { 
            requestFinishedCondition.await(millisecond, TimeUnit.MILLISECONDS);
        } finally { 
            lock.unlock();
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:convert
            boolean bVal = true;
            try 
            { 
                if (!done.get())
                { 
                    timeout = TimeUnit.MILLISECONDS.convert(timeout, tu);
                    long overall_timeout = timeout - (System.currentTimeMillis() - startTime);
                    bVal = overall_timeout > 0 && condition.await(overall_timeout, TimeUnit.MILLISECONDS);
                } 
            } 
            catch (InterruptedException ex)
            { 
                throw new AssertionError(ex);
            } 
             
            if (!bVal && !done.get())
            {                                            
                throw new TimeoutException("Operation timed out.");
            } 
        } 
5
CodeRank
This code example shows how to use the following methods:await
    try { 
      lock.lock();
      if (ready) {
        return true; 
      } 
      return condition.await(60, TimeUnit.SECONDS);
    } finally { 
      lock.unlock();
    } 
  } 
 
  public void registerUIAScript() { 
    try { 
      lock.lock();
      ready = true;
      condition.signal();
    } finally { 
      lock.unlock();
    } 
  } 
5
CodeRank
This code example shows how to use the following methods:await
    try { 
      simLock.lock();
      if (driver.getPages() != null && driver.getPages().size() > 0) {
        return; 
      } 
      simSentPages.await(5, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
      throw new WebDriverException("InterruptedException before getting the pages."); 
    } finally { 
      simLock.unlock();
    } 
  } 
 
  public void waitForSimToRegister() { 
    try { 
      simLock.lock();
      if (driver.getDevice() != null) {
        return; 
      } 
      simRegistered.await(5, TimeUnit.SECONDS);
5
CodeRank
This code example shows how to use the following methods:await
        available.await();
    } 
 
    @Override 
    public void await(long timeout, TimeUnit unit) throws InterruptedException {
        available.await(timeout, unit);
    } 
 
    @Override 
    public long awaitNanos(long nanos) throws InterruptedException {
        return available.awaitNanos(nanos);
    } 
} 
5
CodeRank

Related Condition await Questions & Answers:

await Method Overview
Causes the current thread to wait until it is signalled or interrupted.
See Code Examples for other Java 8 Condition Methods: