Our current waiting logic could be improved. It is a working wait logic, but it might not be the most elegant solution.
|
public static void busyWaitAndCheck(final Long deadline, final Supplier<Boolean> connectedSupplier) |
|
throws InterruptedException { |
|
long start = System.currentTimeMillis(); |
|
|
|
do { |
|
if (deadline <= System.currentTimeMillis() - start) { |
|
throw new GeneralError(String.format( |
|
"Deadline exceeded. Condition did not complete within the %d " + "deadline", deadline)); |
|
} |
|
|
|
Thread.sleep(50L); |
|
} while (!connectedSupplier.get()); |
|
} |
This task aims to migrate to an approach with notify() and wait(). As suggested by @chrfwow within #1115.
Our current waiting logic could be improved. It is a working wait logic, but it might not be the most elegant solution.
java-sdk-contrib/providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/resolver/common/Util.java
Lines 26 to 38 in cd0ea9e
This task aims to migrate to an approach with
notify()andwait(). As suggested by @chrfwow within #1115.