public V get()

in protonj2-client/src/main/java/org/apache/qpid/protonj2/client/futures/ProgressiveClientFuture.java [114:155]


    public V get() throws InterruptedException, ExecutionException {
        if (isNotComplete()) {
            int idleCount = 0;

            while (isNotComplete()) {
                if (idleCount < SPIN_COUNT) {
                    idleCount++;
                } else if (idleCount < YIELD_COUNT) {
                    Thread.yield();
                    idleCount++;
                } else if (idleCount < TINY_PARK_COUNT) {
                    LockSupport.parkNanos(TINY_PARK_NANOS);
                    idleCount++;
                } else if (idleCount < SMALL_PARK_COUNT) {
                    LockSupport.parkNanos(SMALL_PARK_NANOS);
                    idleCount++;
                } else {
                    synchronized (this) {
                        if (isComplete()) {
                            break;
                        } else if (getState() < COMPLETING) {
                            waiting++;
                            try {
                                wait();
                            } catch (InterruptedException e) {
                                Thread.interrupted();
                                throw e;
                            } finally {
                                waiting--;
                            }
                        }
                    }
                }
            }
        }

        if (error != null) {
            throw error;
        } else {
            return getResult();
        }
    }