Skip to content

Commit d134e2f

Browse files
Revert upgrade thrift file (#393)
1 parent 928b232 commit d134e2f

17 files changed

+171
-80
lines changed

src/main/java/com/uber/cadence/client/WorkflowOptions.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.cronutils.model.definition.CronDefinitionBuilder;
2626
import com.cronutils.parser.CronParser;
2727
import com.google.common.base.Strings;
28+
import com.uber.cadence.ChildPolicy;
2829
import com.uber.cadence.WorkflowIdReusePolicy;
2930
import com.uber.cadence.common.CronSchedule;
3031
import com.uber.cadence.common.MethodRetry;
@@ -59,6 +60,7 @@ public static WorkflowOptions merge(
5960
OptionsUtils.merge(
6061
a.executionStartToCloseTimeoutSeconds(), o.getExecutionStartToCloseTimeout()))
6162
.setTaskList(OptionsUtils.merge(a.taskList(), o.getTaskList(), String.class))
63+
.setChildPolicy(o.getChildPolicy())
6264
.setRetryOptions(RetryOptions.merge(methodRetry, o.getRetryOptions()))
6365
.setCronSchedule(OptionsUtils.merge(cronAnnotation, o.getCronSchedule(), String.class))
6466
.setMemo(o.getMemo())
@@ -78,6 +80,8 @@ public static final class Builder {
7880

7981
private String taskList;
8082

83+
private ChildPolicy childPolicy;
84+
8185
private RetryOptions retryOptions;
8286

8387
private String cronSchedule;
@@ -97,6 +101,7 @@ public Builder(WorkflowOptions o) {
97101
this.taskStartToCloseTimeout = o.taskStartToCloseTimeout;
98102
this.executionStartToCloseTimeout = o.executionStartToCloseTimeout;
99103
this.taskList = o.taskList;
104+
this.childPolicy = o.childPolicy;
100105
this.retryOptions = o.retryOptions;
101106
this.cronSchedule = o.cronSchedule;
102107
this.memo = o.memo;
@@ -169,6 +174,12 @@ public Builder setTaskList(String taskList) {
169174
return this;
170175
}
171176

177+
/** Specifies how children of this workflow react to this workflow death. */
178+
public Builder setChildPolicy(ChildPolicy childPolicy) {
179+
this.childPolicy = childPolicy;
180+
return this;
181+
}
182+
172183
public Builder setRetryOptions(RetryOptions retryOptions) {
173184
this.retryOptions = retryOptions;
174185
return this;
@@ -204,6 +215,7 @@ public WorkflowOptions build() {
204215
executionStartToCloseTimeout,
205216
taskStartToCloseTimeout,
206217
taskList,
218+
childPolicy,
207219
retryOptions,
208220
cronSchedule,
209221
memo,
@@ -250,6 +262,7 @@ public WorkflowOptions validateBuildWithDefaults() {
250262
roundUpToSeconds(
251263
taskStartToCloseTimeout, OptionsUtils.DEFAULT_TASK_START_TO_CLOSE_TIMEOUT),
252264
taskList,
265+
childPolicy,
253266
retryOptions,
254267
cronSchedule,
255268
memo,
@@ -267,6 +280,8 @@ public WorkflowOptions validateBuildWithDefaults() {
267280

268281
private final String taskList;
269282

283+
private final ChildPolicy childPolicy;
284+
270285
private RetryOptions retryOptions;
271286

272287
private String cronSchedule;
@@ -281,6 +296,7 @@ private WorkflowOptions(
281296
Duration executionStartToCloseTimeout,
282297
Duration taskStartToCloseTimeout,
283298
String taskList,
299+
ChildPolicy childPolicy,
284300
RetryOptions retryOptions,
285301
String cronSchedule,
286302
Map<String, Object> memo,
@@ -290,6 +306,7 @@ private WorkflowOptions(
290306
this.executionStartToCloseTimeout = executionStartToCloseTimeout;
291307
this.taskStartToCloseTimeout = taskStartToCloseTimeout;
292308
this.taskList = taskList;
309+
this.childPolicy = childPolicy;
293310
this.retryOptions = retryOptions;
294311
this.cronSchedule = cronSchedule;
295312
this.memo = memo;
@@ -316,6 +333,10 @@ public String getTaskList() {
316333
return taskList;
317334
}
318335

336+
public ChildPolicy getChildPolicy() {
337+
return childPolicy;
338+
}
339+
319340
public RetryOptions getRetryOptions() {
320341
return retryOptions;
321342
}
@@ -342,6 +363,7 @@ public boolean equals(Object o) {
342363
&& Objects.equals(executionStartToCloseTimeout, that.executionStartToCloseTimeout)
343364
&& Objects.equals(taskStartToCloseTimeout, that.taskStartToCloseTimeout)
344365
&& Objects.equals(taskList, that.taskList)
366+
&& childPolicy == that.childPolicy
345367
&& Objects.equals(retryOptions, that.retryOptions)
346368
&& Objects.equals(cronSchedule, that.cronSchedule)
347369
&& Objects.equals(memo, that.memo)
@@ -356,6 +378,7 @@ public int hashCode() {
356378
executionStartToCloseTimeout,
357379
taskStartToCloseTimeout,
358380
taskList,
381+
childPolicy,
359382
retryOptions,
360383
cronSchedule,
361384
memo,
@@ -377,6 +400,8 @@ public String toString() {
377400
+ ", taskList='"
378401
+ taskList
379402
+ '\''
403+
+ ", childPolicy="
404+
+ childPolicy
380405
+ ", retryOptions="
381406
+ retryOptions
382407
+ ", cronSchedule='"

src/main/java/com/uber/cadence/internal/common/StartWorkflowExecutionParameters.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.uber.cadence.internal.common;
1919

20+
import com.uber.cadence.ChildPolicy;
2021
import com.uber.cadence.WorkflowIdReusePolicy;
2122
import com.uber.cadence.WorkflowType;
2223
import com.uber.cadence.client.WorkflowOptions;
@@ -42,6 +43,8 @@ public final class StartWorkflowExecutionParameters {
4243

4344
private long taskStartToCloseTimeoutSeconds;
4445

46+
private ChildPolicy childPolicy;
47+
4548
private WorkflowIdReusePolicy workflowIdReusePolicy;
4649

4750
private RetryParameters retryParameters;
@@ -265,6 +268,19 @@ public StartWorkflowExecutionParameters withTaskStartToCloseTimeoutSeconds(
265268
return this;
266269
}
267270

271+
public ChildPolicy getChildPolicy() {
272+
return childPolicy;
273+
}
274+
275+
public void setChildPolicy(ChildPolicy childPolicy) {
276+
this.childPolicy = childPolicy;
277+
}
278+
279+
public StartWorkflowExecutionParameters withChildPolicy(ChildPolicy childPolicy) {
280+
this.childPolicy = childPolicy;
281+
return this;
282+
}
283+
268284
public RetryParameters getRetryParameters() {
269285
return retryParameters;
270286
}
@@ -308,6 +324,7 @@ public static StartWorkflowExecutionParameters fromWorkflowOptions(WorkflowOptio
308324
getSeconds(options.getExecutionStartToCloseTimeout()));
309325
parameters.setTaskStartToCloseTimeoutSeconds(getSeconds(options.getTaskStartToCloseTimeout()));
310326
parameters.setTaskList(options.getTaskList());
327+
parameters.setChildPolicy(options.getChildPolicy());
311328
parameters.setWorkflowIdReusePolicy(options.getWorkflowIdReusePolicy());
312329
RetryOptions retryOptions = options.getRetryOptions();
313330
if (retryOptions != null) {
@@ -359,6 +376,8 @@ public String toString() {
359376
+ executionStartToCloseTimeoutSeconds
360377
+ ", taskStartToCloseTimeoutSeconds="
361378
+ taskStartToCloseTimeoutSeconds
379+
+ ", childPolicy="
380+
+ childPolicy
362381
+ ", workflowIdReusePolicy="
363382
+ workflowIdReusePolicy
364383
+ ", retryParameters="
@@ -386,6 +405,7 @@ public boolean equals(Object o) {
386405
&& Objects.equals(workflowType, that.workflowType)
387406
&& Objects.equals(taskList, that.taskList)
388407
&& Arrays.equals(input, that.input)
408+
&& childPolicy == that.childPolicy
389409
&& workflowIdReusePolicy == that.workflowIdReusePolicy
390410
&& Objects.equals(retryParameters, that.retryParameters)
391411
&& Objects.equals(cronSchedule, that.cronSchedule)
@@ -402,6 +422,7 @@ public int hashCode() {
402422
taskList,
403423
executionStartToCloseTimeoutSeconds,
404424
taskStartToCloseTimeoutSeconds,
425+
childPolicy,
405426
workflowIdReusePolicy,
406427
retryParameters,
407428
cronSchedule,

src/main/java/com/uber/cadence/internal/common/TerminateWorkflowExecutionParameters.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,25 @@
1717

1818
package com.uber.cadence.internal.common;
1919

20+
import com.uber.cadence.ChildPolicy;
2021
import com.uber.cadence.WorkflowExecution;
2122

2223
public class TerminateWorkflowExecutionParameters {
2324

2425
private WorkflowExecution workflowExecution;
2526

27+
private ChildPolicy childPolicy;
28+
2629
private String reason;
2730

2831
private byte[] details;
2932

3033
public TerminateWorkflowExecutionParameters() {}
3134

3235
public TerminateWorkflowExecutionParameters(
33-
WorkflowExecution workflowExecution, String reason, byte[] details) {
36+
WorkflowExecution workflowExecution, ChildPolicy childPolicy, String reason, byte[] details) {
3437
this.workflowExecution = workflowExecution;
38+
this.childPolicy = childPolicy;
3539
this.reason = reason;
3640
this.details = details;
3741
}
@@ -50,6 +54,19 @@ public TerminateWorkflowExecutionParameters withWorkflowExecution(
5054
return this;
5155
}
5256

57+
public ChildPolicy getChildPolicy() {
58+
return childPolicy;
59+
}
60+
61+
public void setChildPolicy(ChildPolicy childPolicy) {
62+
this.childPolicy = childPolicy;
63+
}
64+
65+
public TerminateWorkflowExecutionParameters withChildPolicy(ChildPolicy childPolicy) {
66+
this.childPolicy = childPolicy;
67+
return this;
68+
}
69+
5370
public String getReason() {
5471
return reason;
5572
}

src/main/java/com/uber/cadence/internal/replay/DecisionContext.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.uber.cadence.internal.replay;
1919

20+
import com.uber.cadence.ChildPolicy;
2021
import com.uber.cadence.WorkflowExecution;
2122
import com.uber.cadence.WorkflowType;
2223
import com.uber.cadence.converter.DataConverter;
@@ -68,6 +69,8 @@ public interface DecisionContext extends ReplayAware {
6869

6970
Duration getDecisionTaskTimeout();
7071

72+
ChildPolicy getChildPolicy();
73+
7174
/**
7275
* Used to dynamically schedule an activity for execution
7376
*

src/main/java/com/uber/cadence/internal/replay/DecisionContextImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.uber.cadence.internal.replay;
1919

20+
import com.uber.cadence.ChildPolicy;
2021
import com.uber.cadence.DecisionTaskFailedCause;
2122
import com.uber.cadence.DecisionTaskFailedEventAttributes;
2223
import com.uber.cadence.HistoryEvent;
@@ -134,6 +135,11 @@ public Duration getDecisionTaskTimeout() {
134135
return Duration.ofSeconds(workflowContext.getDecisionTaskTimeoutSeconds());
135136
}
136137

138+
@Override
139+
public ChildPolicy getChildPolicy() {
140+
return workflowContext.getChildPolicy();
141+
}
142+
137143
@Override
138144
public String getTaskList() {
139145
return workflowContext.getTaskList();

src/main/java/com/uber/cadence/internal/replay/StartChildWorkflowExecutionParameters.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.uber.cadence.internal.replay;
1919

20+
import com.uber.cadence.ChildPolicy;
2021
import com.uber.cadence.WorkflowIdReusePolicy;
2122
import com.uber.cadence.WorkflowType;
2223
import com.uber.cadence.internal.common.RetryParameters;
@@ -43,6 +44,8 @@ public static final class Builder {
4344

4445
private WorkflowType workflowType;
4546

47+
private ChildPolicy childPolicy;
48+
4649
private WorkflowIdReusePolicy workflowIdReusePolicy;
4750

4851
private RetryParameters retryParameters;
@@ -90,6 +93,11 @@ public Builder setWorkflowType(WorkflowType workflowType) {
9093
return this;
9194
}
9295

96+
public Builder setChildPolicy(ChildPolicy childPolicy) {
97+
this.childPolicy = childPolicy;
98+
return this;
99+
}
100+
93101
public Builder setWorkflowIdReusePolicy(WorkflowIdReusePolicy workflowIdReusePolicy) {
94102
this.workflowIdReusePolicy = workflowIdReusePolicy;
95103
return this;
@@ -115,6 +123,7 @@ public StartChildWorkflowExecutionParameters build() {
115123
taskStartToCloseTimeoutSeconds,
116124
workflowId,
117125
workflowType,
126+
childPolicy,
118127
workflowIdReusePolicy,
119128
retryParameters,
120129
cronSchedule);
@@ -137,6 +146,8 @@ public StartChildWorkflowExecutionParameters build() {
137146

138147
private final WorkflowType workflowType;
139148

149+
private final ChildPolicy childPolicy;
150+
140151
private final WorkflowIdReusePolicy workflowIdReusePolicy;
141152

142153
private final RetryParameters retryParameters;
@@ -152,6 +163,7 @@ private StartChildWorkflowExecutionParameters(
152163
long taskStartToCloseTimeoutSeconds,
153164
String workflowId,
154165
WorkflowType workflowType,
166+
ChildPolicy childPolicy,
155167
WorkflowIdReusePolicy workflowIdReusePolicy,
156168
RetryParameters retryParameters,
157169
String cronSchedule) {
@@ -163,6 +175,7 @@ private StartChildWorkflowExecutionParameters(
163175
this.taskStartToCloseTimeoutSeconds = taskStartToCloseTimeoutSeconds;
164176
this.workflowId = workflowId;
165177
this.workflowType = workflowType;
178+
this.childPolicy = childPolicy;
166179
this.workflowIdReusePolicy = workflowIdReusePolicy;
167180
this.retryParameters = retryParameters;
168181
this.cronSchedule = cronSchedule;
@@ -200,6 +213,10 @@ public WorkflowType getWorkflowType() {
200213
return workflowType;
201214
}
202215

216+
public ChildPolicy getChildPolicy() {
217+
return childPolicy;
218+
}
219+
203220
public WorkflowIdReusePolicy getWorkflowIdReusePolicy() {
204221
return workflowIdReusePolicy;
205222
}
@@ -225,6 +242,7 @@ public boolean equals(Object o) {
225242
&& Objects.equals(taskList, that.taskList)
226243
&& Objects.equals(workflowId, that.workflowId)
227244
&& Objects.equals(workflowType, that.workflowType)
245+
&& childPolicy == that.childPolicy
228246
&& workflowIdReusePolicy == that.workflowIdReusePolicy
229247
&& Objects.equals(retryParameters, that.retryParameters)
230248
&& Objects.equals(cronSchedule, that.cronSchedule);
@@ -241,6 +259,7 @@ public int hashCode() {
241259
taskStartToCloseTimeoutSeconds,
242260
workflowId,
243261
workflowType,
262+
childPolicy,
244263
workflowIdReusePolicy,
245264
retryParameters,
246265
cronSchedule);
@@ -271,6 +290,8 @@ public String toString() {
271290
+ '\''
272291
+ ", workflowType="
273292
+ workflowType
293+
+ ", childPolicy="
294+
+ childPolicy
274295
+ ", workflowIdReusePolicy="
275296
+ workflowIdReusePolicy
276297
+ ", retryParameters="

src/main/java/com/uber/cadence/internal/replay/WorkflowContext.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ private WorkflowExecutionStartedEventAttributes getWorkflowStartedEventAttribute
120120
return startedAttributes;
121121
}
122122

123+
public ChildPolicy getChildPolicy() {
124+
return startedAttributes.getChildPolicy();
125+
}
126+
123127
void setCurrentRunId(String currentRunId) {
124128
this.currentRunId = currentRunId;
125129
}

0 commit comments

Comments
 (0)