try {
long start = System.currentTimeMillis();
while (!done.get() && !renderJob.cancel() && start + 2000 < System.currentTimeMillis())
synchronized (done) {
try {
done.wait(200);
} catch (InterruptedException e) {
throw (RuntimeException) new RuntimeException().initCause(e);
}
}
if (!done.get() && !renderJob.cancel()) {