private boolean await0()

in repository/service/src/main/java/org/apache/karaf/cave/repository/service/maven/DefaultFuture.java [143:178]


    private boolean await0(long timeoutMillis, boolean interruptable) throws InterruptedException {
        long endTime = System.currentTimeMillis() + timeoutMillis;

        synchronized (lock) {
            if (ready) {
                return true;
            } else if (timeoutMillis <= 0) {
                return false;
            }

            waiters++;
            try {
                for (; ;) {
                    try {
                        long timeOut = Math.min(timeoutMillis, DEAD_LOCK_CHECK_INTERVAL);
                        lock.wait(timeOut);
                    } catch (InterruptedException e) {
                        if (interruptable) {
                            throw e;
                        }
                    }

                    if (ready) {
                        return true;
                    } else if (endTime < System.currentTimeMillis()) {
                        return false;
                    }
                }
            } finally {
                waiters--;
                if (!ready) {
                    checkDeadLock();
                }
            }
        }
    }