Skip to content

Commit

Permalink
Adapt to latest changes in the locking model for context close
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkinsona committed Dec 14, 2023
1 parent 60ebb32 commit 8c5b7a8
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -113,7 +114,7 @@ void runWhenContextIsBeingClosedInAnotherThreadWaitsUntilContextIsInactive() thr
Thread shutdownThread = new Thread(shutdownHook);
shutdownThread.start();
// Shutdown thread should start waiting for context to become inactive
Awaitility.await().atMost(Duration.ofSeconds(30)).until(shutdownThread::getState, State.TIMED_WAITING::equals);
Awaitility.await().atMost(Duration.ofSeconds(30)).until(shutdownThread::getState, State.WAITING::equals);
// Allow context thread to proceed, unblocking shutdown thread
proceedWithClose.countDown();
contextThread.join();
Expand Down Expand Up @@ -252,7 +253,7 @@ protected void onClose() {
}
if (this.proceedWithClose != null) {
try {
this.proceedWithClose.await();
this.proceedWithClose.await(1, TimeUnit.MINUTES);
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Expand Down

0 comments on commit 8c5b7a8

Please sign in to comment.