Skip to content

Commit 9e2cbd8

Browse files
committed
Flaky build due to a possible race condition #1449
Signed-off-by: christian.lutnik <[email protected]>
1 parent 43c06f3 commit 9e2cbd8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/dev/openfeature/sdk/Awaitable.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package dev.openfeature.sdk;
22

3+
/**
4+
* A class to help with synchronization
5+
*/
36
public class Awaitable {
47
public static final Awaitable FINISHED = new Awaitable(true);
58

@@ -11,6 +14,11 @@ private Awaitable(boolean isDone) {
1114
this.isDone = isDone;
1215
}
1316

17+
/**
18+
* Lets the calling thread wait until some other thread calls {@link Awaitable#wakeup()}. If
19+
* {@link Awaitable#wakeup()} has been called before the current thread invokes this method, it will return
20+
* immediately
21+
*/
1422
public void await() {
1523
if (isDone) {
1624
return;
@@ -25,6 +33,9 @@ public void await() {
2533
}
2634
}
2735

36+
/**
37+
* Wakes up all threads that have called {@link Awaitable#await()} and lets them proceed.
38+
*/
2839
public synchronized void wakeup() {
2940
isDone = true;
3041
this.notifyAll();

0 commit comments

Comments
 (0)