File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/main/java/dev/openfeature/sdk Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 11package dev .openfeature .sdk ;
22
3+ /**
4+ * A class to help with synchronization
5+ */
36public 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 ();
You can’t perform that action at this time.
0 commit comments