File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
main/java/dev/openfeature/sdk
test/java/dev/openfeature/sdk Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 11package dev .openfeature .sdk ;
22
33/**
4- * A class to help with synchronization
4+ * A class to help with synchronization.
55 */
66public class Awaitable {
77 public static final Awaitable FINISHED = new Awaitable (true );
@@ -17,7 +17,7 @@ private Awaitable(boolean isDone) {
1717 /**
1818 * Lets the calling thread wait until some other thread calls {@link Awaitable#wakeup()}. If
1919 * {@link Awaitable#wakeup()} has been called before the current thread invokes this method, it will return
20- * immediately
20+ * immediately.
2121 */
2222 public void await () {
2323 if (isDone ) {
Original file line number Diff line number Diff line change 11package dev .openfeature .sdk ;
22
3+ import static org .awaitility .Awaitility .await ;
34import static org .junit .jupiter .api .Assertions .assertTrue ;
45import static org .junit .jupiter .api .Assertions .fail ;
56
7+ import java .util .concurrent .TimeUnit ;
68import java .util .concurrent .atomic .AtomicBoolean ;
79import java .util .concurrent .atomic .AtomicInteger ;
810import org .junit .jupiter .api .Test ;
@@ -62,9 +64,7 @@ void callingWakeUpWakesUpAllWaitingThreads() throws InterruptedException {
6264 threads [i ].start ();
6365 }
6466
65- while (isRunning .get () < numThreads ) {
66- Thread .sleep (1 );
67- }
67+ await ().atMost (1 , TimeUnit .SECONDS ).until (() -> isRunning .get () == numThreads );
6868
6969 awaitable .wakeup ();
7070
You can’t perform that action at this time.
0 commit comments