Skip to content

Commit 5d8d055

Browse files
committed
Remaining two default overloads of execute/executeAsync, and remove redundant Impl implementations.
1 parent d0cc4b4 commit 5d8d055

2 files changed

Lines changed: 8 additions & 58 deletions

File tree

temporal-sdk/src/main/java/io/temporal/client/ActivityClient.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,10 @@ <R> ActivityHandle<R> start(
14531453
* @param args activity arguments
14541454
* @throws ActivityFailedException if the activity failed, timed out, or was cancelled
14551455
*/
1456-
void execute(String activityType, StartActivityOptions options, @Nullable Object... args);
1456+
default void execute(
1457+
String activityType, StartActivityOptions options, @Nullable Object... args) {
1458+
start(activityType, options, args).getResult(Void.class);
1459+
}
14571460

14581461
/**
14591462
* Starts a standalone activity and blocks until it completes, returning the typed result.
@@ -1504,8 +1507,10 @@ default <R> R execute(
15041507
* @param args activity arguments
15051508
* @return a future that completes when the activity completes
15061509
*/
1507-
CompletableFuture<Void> executeAsync(
1508-
String activityType, StartActivityOptions options, @Nullable Object... args);
1510+
default CompletableFuture<Void> executeAsync(
1511+
String activityType, StartActivityOptions options, @Nullable Object... args) {
1512+
return start(activityType, options, args).getResultAsync(Void.class);
1513+
}
15091514

15101515
/**
15111516
* Starts a standalone activity and returns a future that completes with the typed result.

temporal-sdk/src/main/java/io/temporal/client/ActivityClientImpl.java

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.HashMap;
2121
import java.util.List;
2222
import java.util.Map;
23-
import java.util.concurrent.CompletableFuture;
2423
import java.util.stream.Stream;
2524
import javax.annotation.Nullable;
2625

@@ -318,60 +317,6 @@ public <R> ActivityHandle<R> start(
318317
return ActivityHandle.fromUntyped(untyped, resultClass, resultType);
319318
}
320319

321-
// ---- String-based execute ----
322-
323-
@Override
324-
@SuppressWarnings("unchecked")
325-
public void execute(String activityType, StartActivityOptions options, @Nullable Object... args) {
326-
start(activityType, options, args).getResult(Void.class);
327-
}
328-
329-
@Override
330-
public <R> R execute(
331-
String activityType,
332-
Class<R> resultClass,
333-
StartActivityOptions options,
334-
@Nullable Object... args) {
335-
return start(activityType, resultClass, options, args).getResult();
336-
}
337-
338-
@Override
339-
public <R> R execute(
340-
String activityType,
341-
Class<R> resultClass,
342-
Type resultType,
343-
StartActivityOptions options,
344-
@Nullable Object... args) {
345-
return start(activityType, resultClass, resultType, options, args).getResult();
346-
}
347-
348-
// ---- String-based executeAsync ----
349-
350-
@Override
351-
public CompletableFuture<Void> executeAsync(
352-
String activityType, StartActivityOptions options, @Nullable Object... args) {
353-
return start(activityType, options, args).getResultAsync(Void.class);
354-
}
355-
356-
@Override
357-
public <R> CompletableFuture<R> executeAsync(
358-
String activityType,
359-
Class<R> resultClass,
360-
StartActivityOptions options,
361-
@Nullable Object... args) {
362-
return start(activityType, resultClass, options, args).getResultAsync();
363-
}
364-
365-
@Override
366-
public <R> CompletableFuture<R> executeAsync(
367-
String activityType,
368-
Class<R> resultClass,
369-
Type resultType,
370-
StartActivityOptions options,
371-
@Nullable Object... args) {
372-
return start(activityType, resultClass, resultType, options, args).getResultAsync();
373-
}
374-
375320
// ---- Handle lookup ----
376321

377322
@Override

0 commit comments

Comments
 (0)