|
56 | 56 | * |
57 | 57 | * <h2>Thread safety</h2> |
58 | 58 | * |
59 | | - * This interface MUST NOT be accessed concurrently since it can lead to different orderings of user |
60 | | - * actions, corrupting the execution of the invocation. |
| 59 | + * This interface <b>MUST NOT</b> be accessed concurrently since it can lead to different orderings |
| 60 | + * of user actions, corrupting the execution of the invocation. |
61 | 61 | */ |
62 | 62 | public interface Context { |
63 | 63 |
|
@@ -142,21 +142,6 @@ default DurableFuture<Void> timer(Duration duration) { |
142 | 142 | */ |
143 | 143 | DurableFuture<Void> timer(String name, Duration duration); |
144 | 144 |
|
145 | | - /** |
146 | | - * Like {@link #run(String, TypeTag, ThrowingSupplier)}, but using a custom retry policy. |
147 | | - * |
148 | | - * <p>When a retry policy is not specified, the {@code run} will be retried using the <a |
149 | | - * href="https://docs.restate.dev/operate/configuration/server">Restate invoker retry policy</a>, |
150 | | - * which by default retries indefinitely. |
151 | | - * |
152 | | - * @see RetryPolicy |
153 | | - */ |
154 | | - default <T> T run( |
155 | | - String name, TypeTag<T> typeTag, RetryPolicy retryPolicy, ThrowingSupplier<T> action) |
156 | | - throws TerminalException { |
157 | | - return runAsync(name, typeTag, retryPolicy, action).await(); |
158 | | - } |
159 | | - |
160 | 145 | /** |
161 | 146 | * Execute a non-deterministic closure, recording the result value in the journal. The result |
162 | 147 | * value will be re-played in case of re-invocation (e.g. because of failure recovery or |
@@ -221,6 +206,22 @@ default <T> T run(String name, Class<T> clazz, ThrowingSupplier<T> action) |
221 | 206 | return run(name, TypeTag.of(clazz), action); |
222 | 207 | } |
223 | 208 |
|
| 209 | + /** |
| 210 | + * Like {@link #run(String, TypeTag, ThrowingSupplier)}, but using a custom retry policy. |
| 211 | + * |
| 212 | + * <p>When a retry policy is not specified, the {@code run} will be retried using the <a |
| 213 | + * href="https://docs.restate.dev/operate/configuration/server">Restate invoker retry policy</a>, |
| 214 | + * which by default retries indefinitely. |
| 215 | + * |
| 216 | + * @see #run(String, Class, ThrowingSupplier) |
| 217 | + * @see RetryPolicy |
| 218 | + */ |
| 219 | + default <T> T run( |
| 220 | + String name, TypeTag<T> typeTag, RetryPolicy retryPolicy, ThrowingSupplier<T> action) |
| 221 | + throws TerminalException { |
| 222 | + return runAsync(name, typeTag, retryPolicy, action).await(); |
| 223 | + } |
| 224 | + |
224 | 225 | /** |
225 | 226 | * Like {@link #run(String, Class, ThrowingSupplier)}, but using a custom retry policy. |
226 | 227 | * |
@@ -325,7 +326,7 @@ default void run(ThrowingRunnable runnable) throws TerminalException { |
325 | 326 | * .toList(); |
326 | 327 | * |
327 | 328 | * // Await all of them |
328 | | - * Awaitable.all(resultFutures).await(); |
| 329 | + * DurableFuture.all(resultFutures).await(); |
329 | 330 | * |
330 | 331 | * // Fan in - Aggregate the results |
331 | 332 | * var results = resultFutures.stream() |
@@ -477,6 +478,8 @@ default <T> Awakeable<T> awakeable(Class<T> clazz) { |
477 | 478 | AwakeableHandle awakeableHandle(String id); |
478 | 479 |
|
479 | 480 | /** |
| 481 | + * Returns a deterministic random. |
| 482 | + * |
480 | 483 | * @see RestateRandom |
481 | 484 | */ |
482 | 485 | RestateRandom random(); |
|
0 commit comments