21
21
import com .uber .cadence .converter .DataConverter ;
22
22
import com .uber .cadence .converter .JsonDataConverter ;
23
23
import com .uber .cadence .internal .metrics .NoopScope ;
24
+ import com .uber .cadence .worker .ThreadFactoryWrapper ;
24
25
import com .uber .m3 .tally .Scope ;
25
26
import io .opentracing .Tracer ;
26
27
import java .time .Duration ;
@@ -46,6 +47,7 @@ public static final class Builder {
46
47
private boolean enableLoggingInReplay ;
47
48
private List <ContextPropagator > contextPropagators ;
48
49
private Tracer tracer ;
50
+ private ThreadFactoryWrapper threadFactoryWrapper ;
49
51
50
52
private Builder () {}
51
53
@@ -59,6 +61,7 @@ public Builder(SingleWorkerOptions options) {
59
61
this .enableLoggingInReplay = options .getEnableLoggingInReplay ();
60
62
this .contextPropagators = options .getContextPropagators ();
61
63
this .tracer = options .getTracer ();
64
+ this .threadFactoryWrapper = options .getThreadFactoryWrapper ();
62
65
}
63
66
64
67
public Builder setIdentity (String identity ) {
@@ -107,6 +110,11 @@ public Builder setTracer(Tracer tracer) {
107
110
return this ;
108
111
}
109
112
113
+ public Builder setThreadFactoryWrapper (ThreadFactoryWrapper threadFactoryWrapper ) {
114
+ this .threadFactoryWrapper = threadFactoryWrapper ;
115
+ return this ;
116
+ }
117
+
110
118
public SingleWorkerOptions build () {
111
119
if (pollerOptions == null ) {
112
120
pollerOptions =
@@ -134,7 +142,8 @@ public SingleWorkerOptions build() {
134
142
metricsScope ,
135
143
enableLoggingInReplay ,
136
144
contextPropagators ,
137
- tracer );
145
+ tracer ,
146
+ threadFactoryWrapper );
138
147
}
139
148
}
140
149
@@ -147,6 +156,7 @@ public SingleWorkerOptions build() {
147
156
private final boolean enableLoggingInReplay ;
148
157
private List <ContextPropagator > contextPropagators ;
149
158
private final Tracer tracer ;
159
+ private final ThreadFactoryWrapper threadFactoryWrapper ;
150
160
151
161
private SingleWorkerOptions (
152
162
String identity ,
@@ -157,7 +167,8 @@ private SingleWorkerOptions(
157
167
Scope metricsScope ,
158
168
boolean enableLoggingInReplay ,
159
169
List <ContextPropagator > contextPropagators ,
160
- Tracer tracer ) {
170
+ Tracer tracer ,
171
+ ThreadFactoryWrapper threadFactoryWrapper ) {
161
172
this .identity = identity ;
162
173
this .dataConverter = dataConverter ;
163
174
this .taskExecutorThreadPoolSize = taskExecutorThreadPoolSize ;
@@ -167,6 +178,7 @@ private SingleWorkerOptions(
167
178
this .enableLoggingInReplay = enableLoggingInReplay ;
168
179
this .contextPropagators = contextPropagators ;
169
180
this .tracer = tracer ;
181
+ this .threadFactoryWrapper = threadFactoryWrapper ;
170
182
}
171
183
172
184
public String getIdentity () {
@@ -204,4 +216,8 @@ public List<ContextPropagator> getContextPropagators() {
204
216
public Tracer getTracer () {
205
217
return tracer ;
206
218
}
219
+
220
+ public ThreadFactoryWrapper getThreadFactoryWrapper () {
221
+ return threadFactoryWrapper ;
222
+ }
207
223
}
0 commit comments