in qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/ProgressiveProviderFuture.java [115:165]
public void sync() throws ProviderException {
try {
if (isComplete()) {
failOnError();
return;
}
int idleCount = 0;
if (Thread.currentThread().isInterrupted()) {
throw new InterruptedException();
}
while (true) {
if (isComplete()) {
failOnError();
return;
}
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()) {
failOnError();
return;
}
waiting++;
try {
wait();
} finally {
waiting--;
}
}
}
}
} catch (InterruptedException e) {
Thread.interrupted();
throw ProviderExceptionSupport.createOrPassthroughFatal(e);
}
}