Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,15 @@ void waitsForContextCreationBeforeClosingTheHandle() throws Exception {
assertTrue(creating.await(10, TimeUnit.SECONDS));
updateThread.start();
long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(10);
// keep the observed state: a parked thread can transiently leave WAITING, so don't resample
boolean blocked = false;
while (!update.isDone()
&& !blockedInHandleReplacement(updateThread)
&& !(blocked = blockedInHandleReplacement(updateThread))
&& System.nanoTime() < deadline) {
Thread.yield();
}
assertFalse(update.isDone(), "reload must wait for context creation");
assertTrue(blockedInHandleReplacement(updateThread));
assertTrue(blocked, "reload must be parked in initOrUpdateWafHandle");
assertTrue(initialHandle.isOnline(), "handle must remain online during context creation");
} finally {
finishCreation.countDown();
Expand Down
Loading