diff --git a/temporal-sdk/src/main/java/io/temporal/common/interceptors/WorkflowOutboundCallsInterceptor.java b/temporal-sdk/src/main/java/io/temporal/common/interceptors/WorkflowOutboundCallsInterceptor.java index d515817b2..6b6ebef69 100644 --- a/temporal-sdk/src/main/java/io/temporal/common/interceptors/WorkflowOutboundCallsInterceptor.java +++ b/temporal-sdk/src/main/java/io/temporal/common/interceptors/WorkflowOutboundCallsInterceptor.java @@ -738,6 +738,8 @@ public DynamicUpdateHandler getHandler() { void sleep(Duration duration); + void sleep(Duration duration, TimerOptions options); + boolean await(Duration timeout, String reason, Supplier unblockCondition); void await(String reason, Supplier unblockCondition); diff --git a/temporal-sdk/src/main/java/io/temporal/common/interceptors/WorkflowOutboundCallsInterceptorBase.java b/temporal-sdk/src/main/java/io/temporal/common/interceptors/WorkflowOutboundCallsInterceptorBase.java index 9d99d4c78..7186b9543 100644 --- a/temporal-sdk/src/main/java/io/temporal/common/interceptors/WorkflowOutboundCallsInterceptorBase.java +++ b/temporal-sdk/src/main/java/io/temporal/common/interceptors/WorkflowOutboundCallsInterceptorBase.java @@ -65,6 +65,11 @@ public void sleep(Duration duration) { next.sleep(duration); } + @Override + public void sleep(Duration duration, TimerOptions options) { + next.sleep(duration, options); + } + @Override public boolean await(Duration timeout, String reason, Supplier unblockCondition) { return next.await(timeout, reason, unblockCondition); diff --git a/temporal-sdk/src/main/java/io/temporal/internal/sync/SyncWorkflowContext.java b/temporal-sdk/src/main/java/io/temporal/internal/sync/SyncWorkflowContext.java index 977d9754e..e67f798b3 100644 --- a/temporal-sdk/src/main/java/io/temporal/internal/sync/SyncWorkflowContext.java +++ b/temporal-sdk/src/main/java/io/temporal/internal/sync/SyncWorkflowContext.java @@ -1315,6 +1315,11 @@ public void sleep(Duration duration) { newTimer(duration).get(); } + @Override + public void sleep(Duration duration, TimerOptions options) { + newTimer(duration, options).get(); + } + @Override public boolean await(Duration timeout, String reason, Supplier unblockCondition) { Promise timer = newTimer(timeout); diff --git a/temporal-testing/src/main/java/io/temporal/testing/TestActivityEnvironmentInternal.java b/temporal-testing/src/main/java/io/temporal/testing/TestActivityEnvironmentInternal.java index 1221dec55..80d68cb20 100644 --- a/temporal-testing/src/main/java/io/temporal/testing/TestActivityEnvironmentInternal.java +++ b/temporal-testing/src/main/java/io/temporal/testing/TestActivityEnvironmentInternal.java @@ -384,6 +384,11 @@ public void sleep(Duration duration) { throw new UnsupportedOperationException("not implemented"); } + @Override + public void sleep(Duration duration, TimerOptions options) { + throw new UnsupportedOperationException("not implemented"); + } + @Override public boolean await(Duration timeout, String reason, Supplier unblockCondition) { throw new UnsupportedOperationException("not implemented"); diff --git a/temporal-testing/src/main/java/io/temporal/testing/internal/TracingWorkerInterceptor.java b/temporal-testing/src/main/java/io/temporal/testing/internal/TracingWorkerInterceptor.java index 77d82bdae..cf10914a8 100644 --- a/temporal-testing/src/main/java/io/temporal/testing/internal/TracingWorkerInterceptor.java +++ b/temporal-testing/src/main/java/io/temporal/testing/internal/TracingWorkerInterceptor.java @@ -217,6 +217,14 @@ public void sleep(Duration duration) { next.sleep(duration); } + @Override + public void sleep(Duration duration, TimerOptions options) { + if (!WorkflowUnsafe.isReplaying()) { + trace.add("sleep " + duration); + } + next.sleep(duration, options); + } + @Override public boolean await(Duration timeout, String reason, Supplier unblockCondition) { if (!WorkflowUnsafe.isReplaying()) {