diff --git a/common/reactive/src/main/java/io/helidon/common/reactive/Awaitable.java b/common/reactive/src/main/java/io/helidon/common/reactive/Awaitable.java index 5b2a0e606ea..3a3c621b740 100644 --- a/common/reactive/src/main/java/io/helidon/common/reactive/Awaitable.java +++ b/common/reactive/src/main/java/io/helidon/common/reactive/Awaitable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021 Oracle and/or its affiliates. + * Copyright (c) 2020, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,9 @@ default T await() { * @throws java.util.concurrent.CancellationException if this future was cancelled * @throws java.util.concurrent.CompletionException if this future completed exceptionally, * was interrupted while waiting or the wait timed out + * @deprecated use {@link #await(Duration)} instead */ + @Deprecated(since = "4.0.0") default T await(long timeout, TimeUnit unit) { try { return this.toCompletableFuture().get(timeout, unit); diff --git a/common/reactive/src/main/java/io/helidon/common/reactive/IoMulti.java b/common/reactive/src/main/java/io/helidon/common/reactive/IoMulti.java index 11c1bdf0cd3..67f9502f083 100644 --- a/common/reactive/src/main/java/io/helidon/common/reactive/IoMulti.java +++ b/common/reactive/src/main/java/io/helidon/common/reactive/IoMulti.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021 Oracle and/or its affiliates. + * Copyright (c) 2020, 2022 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -446,12 +446,26 @@ private OutputStreamMultiBuilder() { * @param timeout the maximum time to block * @param unit the time unit of the timeout argument * @return this builder + * @deprecated use {@link #timeout(Duration)} instead */ + @Deprecated(since = "4.0.0") public OutputStreamMultiBuilder timeout(long timeout, TimeUnit unit) { this.timeout = Duration.of(timeout, unit.toChronoUnit()); return this; } + /** + * Set max timeout for which is allowed to block write methods, + * in case there is no demand from downstream. + * + * @param timeout the maximum time to block + * @return this builder + */ + public OutputStreamMultiBuilder timeout(Duration timeout) { + this.timeout = timeout; + return this; + } + /** * Callback executed when request signal from downstream arrive. *