Skip to content

Commit 81e2803

Browse files
committed
PR feedback
Signed-off-by: Cassandra Coyle <[email protected]>
1 parent 5b6bb56 commit 81e2803

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

client/src/main/java/io/dapr/durabletask/TaskOptions.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ public final class TaskOptions {
1010
private final RetryHandler retryHandler;
1111
private final String appID;
1212

13-
private TaskOptions(Builder builder) {
14-
this.retryPolicy = builder.retryPolicy;
15-
this.retryHandler = builder.retryHandler;
16-
this.appID = builder.appID;
13+
private TaskOptions(RetryPolicy retryPolicy, RetryHandler retryHandler, String appID) {
14+
this.retryPolicy = retryPolicy;
15+
this.retryHandler = retryHandler;
16+
this.appID = appID;
1717
}
1818

1919
/**
@@ -142,7 +142,7 @@ public Builder appID(String appID) {
142142
* @return a new TaskOptions instance
143143
*/
144144
public TaskOptions build() {
145-
return new TaskOptions(this);
145+
return new TaskOptions(this.retryPolicy, this.retryHandler, this.appID);
146146
}
147147
}
148148
}

client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ public String getAppId() {
147147
return this.appId;
148148
}
149149

150+
private void setAppId(String appId) {
151+
this.appId = appId;
152+
}
153+
150154
@Override
151155
public Instant getCurrentInstant() {
152156
// TODO: Throw if instant is null
@@ -874,7 +878,7 @@ private void processEvent(HistoryEvent e) {
874878
this.setInput(executionStarted.getInput().getValue());
875879
this.setInstanceId(executionStarted.getOrchestrationInstance().getInstanceId());
876880
this.logger.fine(() -> this.instanceId + ": Workflow execution started");
877-
this.appId = e.getRouter().getSourceAppID();
881+
this.setAppId(e.getRouter().getSourceAppID());
878882

879883
// Create and invoke the workflow orchestrator
880884
TaskOrchestrationFactory factory = TaskOrchestrationExecutor.this.orchestrationFactories.get(executionStarted.getName());

client/src/test/java/io/dapr/durabletask/TaskOptionsTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,16 @@ public boolean handle(RetryContext context) {
121121

122122
@Test
123123
void taskOptionsWithBuilderChaining() {
124-
RetryPolicy retryPolicy = new RetryPolicy(2, Duration.ofSeconds(30));
125-
RetryHandler retryHandler = new RetryHandler() {
126-
@Override
127-
public boolean handle(RetryContext context) {
128-
return context.getLastAttemptNumber() < 1;
129-
}
130-
};
124+
RetryPolicy retryPolicy = new RetryPolicy(3, Duration.ofSeconds(1));
125+
RetryHandler retryHandler = context -> true;
131126

132127
TaskOptions options = TaskOptions.builder()
133128
.retryPolicy(retryPolicy)
134129
.retryHandler(retryHandler)
135130
.appID("test-app")
136131
.build();
137132

133+
assertNotNull(options);
138134
assertTrue(options.hasRetryPolicy());
139135
assertEquals(retryPolicy, options.getRetryPolicy());
140136
assertTrue(options.hasRetryHandler());

0 commit comments

Comments
 (0)