Skip to content

Commit f6ced94

Browse files
committed
undo defaultContextProp changes
1 parent dd73a62 commit f6ced94

File tree

1 file changed

+5
-43
lines changed

1 file changed

+5
-43
lines changed

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

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@
3030
import com.uber.cadence.common.MethodRetry;
3131
import com.uber.cadence.common.RetryOptions;
3232
import com.uber.cadence.context.ContextPropagator;
33-
import com.uber.cadence.context.OpenTelemetryContextPropagator;
3433
import com.uber.cadence.internal.common.OptionsUtils;
3534
import com.uber.cadence.workflow.WorkflowMethod;
3635
import java.time.Duration;
37-
import java.util.ArrayList;
3836
import java.util.List;
3937
import java.util.Map;
4038
import java.util.Objects;
@@ -68,7 +66,6 @@ public static WorkflowOptions merge(
6866
.setMemo(o.getMemo())
6967
.setSearchAttributes(o.getSearchAttributes())
7068
.setContextPropagators(o.getContextPropagators())
71-
.setDefaultContextPropagators(o.useDefaultContextPropagators)
7269
.validateBuildWithDefaults();
7370
}
7471

@@ -94,8 +91,6 @@ public static final class Builder {
9491

9592
private List<ContextPropagator> contextPropagators;
9693

97-
private Boolean useDefaultContextPropagators;
98-
9994
public Builder() {}
10095

10196
public Builder(WorkflowOptions o) {
@@ -112,7 +107,6 @@ public Builder(WorkflowOptions o) {
112107
this.memo = o.memo;
113108
this.searchAttributes = o.searchAttributes;
114109
this.contextPropagators = o.contextPropagators;
115-
this.useDefaultContextPropagators = o.useDefaultContextPropagators;
116110
}
117111

118112
/**
@@ -220,13 +214,6 @@ public Builder setContextPropagators(List<ContextPropagator> contextPropagators)
220214
return this;
221215
}
222216

223-
/** Specifies that the default context propagators should not be used. */
224-
public Builder setDefaultContextPropagators(Boolean useDefaultContextPropagators) {
225-
this.useDefaultContextPropagators =
226-
(useDefaultContextPropagators == null || useDefaultContextPropagators);
227-
return this;
228-
}
229-
230217
public WorkflowOptions build() {
231218
return new WorkflowOptions(
232219
workflowId,
@@ -238,8 +225,7 @@ public WorkflowOptions build() {
238225
cronSchedule,
239226
memo,
240227
searchAttributes,
241-
contextPropagators,
242-
useDefaultContextPropagators);
228+
contextPropagators);
243229
}
244230

245231
/**
@@ -275,20 +261,6 @@ public WorkflowOptions validateBuildWithDefaults() {
275261
cron.validate();
276262
}
277263

278-
if (useDefaultContextPropagators == null || useDefaultContextPropagators) {
279-
// Add OpenTelemetry propagator if not already present.
280-
if (contextPropagators != null) {
281-
contextPropagators = new ArrayList(contextPropagators);
282-
} else {
283-
contextPropagators = new ArrayList<>();
284-
}
285-
286-
OpenTelemetryContextPropagator otelPropagator = new OpenTelemetryContextPropagator();
287-
if (!contextPropagators.contains(otelPropagator)) {
288-
contextPropagators.add(otelPropagator);
289-
}
290-
}
291-
292264
return new WorkflowOptions(
293265
workflowId,
294266
policy,
@@ -300,8 +272,7 @@ public WorkflowOptions validateBuildWithDefaults() {
300272
cronSchedule,
301273
memo,
302274
searchAttributes,
303-
contextPropagators,
304-
useDefaultContextPropagators);
275+
contextPropagators);
305276
}
306277
}
307278

@@ -325,8 +296,6 @@ public WorkflowOptions validateBuildWithDefaults() {
325296

326297
private List<ContextPropagator> contextPropagators;
327298

328-
private Boolean useDefaultContextPropagators;
329-
330299
private WorkflowOptions(
331300
String workflowId,
332301
WorkflowIdReusePolicy workflowIdReusePolicy,
@@ -337,8 +306,7 @@ private WorkflowOptions(
337306
String cronSchedule,
338307
Map<String, Object> memo,
339308
Map<String, Object> searchAttributes,
340-
List<ContextPropagator> contextPropagators,
341-
Boolean useDefaultContextPropagators) {
309+
List<ContextPropagator> contextPropagators) {
342310
this.workflowId = workflowId;
343311
this.workflowIdReusePolicy = workflowIdReusePolicy;
344312
this.executionStartToCloseTimeout = executionStartToCloseTimeout;
@@ -349,7 +317,6 @@ private WorkflowOptions(
349317
this.memo = memo;
350318
this.searchAttributes = searchAttributes;
351319
this.contextPropagators = contextPropagators;
352-
this.useDefaultContextPropagators = useDefaultContextPropagators;
353320
}
354321

355322
public String getWorkflowId() {
@@ -406,9 +373,7 @@ public boolean equals(Object o) {
406373
&& Objects.equals(cronSchedule, that.cronSchedule)
407374
&& Objects.equals(memo, that.memo)
408375
&& Objects.equals(searchAttributes, that.searchAttributes)
409-
&& Objects.equals(contextPropagators, that.contextPropagators)
410-
&& (useDefaultContextPropagators == null || useDefaultContextPropagators)
411-
== (that.useDefaultContextPropagators == null || that.useDefaultContextPropagators);
376+
&& Objects.equals(contextPropagators, that.contextPropagators);
412377
}
413378

414379
@Override
@@ -423,8 +388,7 @@ public int hashCode() {
423388
cronSchedule,
424389
memo,
425390
searchAttributes,
426-
contextPropagators,
427-
useDefaultContextPropagators);
391+
contextPropagators);
428392
}
429393

430394
@Override
@@ -454,8 +418,6 @@ public String toString() {
454418
+ searchAttributes
455419
+ ", contextPropagators='"
456420
+ contextPropagators
457-
+ ", useDefaultContextPropagators='"
458-
+ useDefaultContextPropagators
459421
+ '\''
460422
+ '}';
461423
}

0 commit comments

Comments
 (0)