mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-19 18:05:41 -05:00
fix(core): deprecate Await util (#13369)
This reverts commit 9fa94deba9.
This commit is contained in:
@@ -160,7 +160,7 @@ public class RunnerUtils {
|
||||
executionEmitter.run();
|
||||
|
||||
if (duration == null) {
|
||||
Await.untilWithSleepInterval(() -> receive.get() != null, Duration.ofMillis(10));
|
||||
Await.until(() -> receive.get() != null, Duration.ofMillis(10));
|
||||
} else {
|
||||
Await.until(() -> receive.get() != null, Duration.ofMillis(10), duration);
|
||||
}
|
||||
|
||||
@@ -6,18 +6,18 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @deprecated use {@link org.awaitility.Awaitility} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public class Await {
|
||||
private static final Duration defaultSleep = Duration.ofMillis(100);
|
||||
|
||||
public static void until(BooleanSupplier condition) {
|
||||
Await.untilWithSleepInterval(condition, null);
|
||||
Await.until(condition, null);
|
||||
}
|
||||
|
||||
public static void untilWithTimeout(BooleanSupplier condition, Duration timeout) throws TimeoutException {
|
||||
until(condition, null, timeout);
|
||||
}
|
||||
|
||||
public static void untilWithSleepInterval(BooleanSupplier condition, Duration sleep) {
|
||||
public static void until(BooleanSupplier condition, Duration sleep) {
|
||||
if (sleep == null) {
|
||||
sleep = defaultSleep;
|
||||
}
|
||||
@@ -78,10 +78,10 @@ public class Await {
|
||||
return result.get();
|
||||
}
|
||||
|
||||
public static <T> T untilWithSleepInterval(Supplier<T> supplier, Duration sleep) {
|
||||
public static <T> T until(Supplier<T> supplier, Duration sleep) {
|
||||
AtomicReference<T> result = new AtomicReference<>();
|
||||
|
||||
Await.untilWithSleepInterval(untilSupplier(supplier, result), sleep);
|
||||
Await.until(untilSupplier(supplier, result), sleep);
|
||||
|
||||
return result.get();
|
||||
}
|
||||
|
||||
@@ -1098,7 +1098,7 @@ public class DefaultWorker implements Worker {
|
||||
);
|
||||
|
||||
// wait for task completion
|
||||
Await.untilWithSleepInterval(
|
||||
Await.until(
|
||||
() -> {
|
||||
ServiceState serviceState = shutdownState.get();
|
||||
if (serviceState == TERMINATED_FORCED || serviceState == TERMINATED_GRACEFULLY) {
|
||||
|
||||
Reference in New Issue
Block a user