@@ -30,20 +30,15 @@ public final class SingleWorkerOptions {
30
30
public static final class Builder {
31
31
32
32
private String identity ;
33
-
34
33
private DataConverter dataConverter ;
35
-
36
34
private int taskExecutorThreadPoolSize = 100 ;
37
-
35
+ private double taskListActivitiesPerSecond ;
38
36
private PollerOptions pollerOptions ;
39
-
40
37
/** TODO: Dynamic expiration based on activity timeout */
41
38
private RetryOptions reportCompletionRetryOptions ;
42
39
43
40
private RetryOptions reportFailureRetryOptions ;
44
-
45
41
private Scope metricsScope ;
46
-
47
42
private boolean enableLoggingInReplay ;
48
43
49
44
public Builder () {}
@@ -52,6 +47,7 @@ public Builder(SingleWorkerOptions options) {
52
47
this .identity = options .getIdentity ();
53
48
this .dataConverter = options .getDataConverter ();
54
49
this .pollerOptions = options .getPollerOptions ();
50
+ this .taskListActivitiesPerSecond = options .getTaskListActivitiesPerSecond ();
55
51
this .taskExecutorThreadPoolSize = options .getTaskExecutorThreadPoolSize ();
56
52
this .reportCompletionRetryOptions = options .getReportCompletionRetryOptions ();
57
53
this .reportFailureRetryOptions = options .getReportFailureRetryOptions ();
@@ -89,6 +85,21 @@ public Builder setEnableLoggingInReplay(boolean enableLoggingInReplay) {
89
85
return this ;
90
86
}
91
87
88
+ public Builder setTaskListActivitiesPerSecond (double taskListActivitiesPerSecond ) {
89
+ this .taskListActivitiesPerSecond = taskListActivitiesPerSecond ;
90
+ return this ;
91
+ }
92
+
93
+ public Builder setReportCompletionRetryOptions (RetryOptions reportCompletionRetryOptions ) {
94
+ this .reportCompletionRetryOptions = reportCompletionRetryOptions ;
95
+ return this ;
96
+ }
97
+
98
+ public Builder setReportFailureRetryOptions (RetryOptions reportFailureRetryOptions ) {
99
+ this .reportFailureRetryOptions = reportFailureRetryOptions ;
100
+ return this ;
101
+ }
102
+
92
103
public SingleWorkerOptions build () {
93
104
if (reportCompletionRetryOptions == null ) {
94
105
reportCompletionRetryOptions = Retryer .DEFAULT_SERVICE_OPERATION_RETRY_OPTIONS ;
@@ -119,44 +130,30 @@ public SingleWorkerOptions build() {
119
130
identity ,
120
131
dataConverter ,
121
132
taskExecutorThreadPoolSize ,
133
+ taskListActivitiesPerSecond ,
122
134
pollerOptions ,
123
135
reportCompletionRetryOptions ,
124
136
reportFailureRetryOptions ,
125
137
metricsScope ,
126
138
enableLoggingInReplay );
127
139
}
128
-
129
- public Builder setReportCompletionRetryOptions (RetryOptions reportCompletionRetryOptions ) {
130
- this .reportCompletionRetryOptions = reportCompletionRetryOptions ;
131
- return this ;
132
- }
133
-
134
- public Builder setReportFailureRetryOptions (RetryOptions reportFailureRetryOptions ) {
135
- this .reportFailureRetryOptions = reportFailureRetryOptions ;
136
- return this ;
137
- }
138
140
}
139
141
140
142
private final String identity ;
141
-
142
143
private final DataConverter dataConverter ;
143
-
144
144
private final int taskExecutorThreadPoolSize ;
145
-
145
+ private final double taskListActivitiesPerSecond ;
146
146
private final PollerOptions pollerOptions ;
147
-
148
147
private final RetryOptions reportCompletionRetryOptions ;
149
-
150
148
private final RetryOptions reportFailureRetryOptions ;
151
-
152
149
private final Scope metricsScope ;
153
-
154
150
private final boolean enableLoggingInReplay ;
155
151
156
152
private SingleWorkerOptions (
157
153
String identity ,
158
154
DataConverter dataConverter ,
159
155
int taskExecutorThreadPoolSize ,
156
+ double taskListActivitiesPerSecond ,
160
157
PollerOptions pollerOptions ,
161
158
RetryOptions reportCompletionRetryOptions ,
162
159
RetryOptions reportFailureRetryOptions ,
@@ -165,6 +162,7 @@ private SingleWorkerOptions(
165
162
this .identity = identity ;
166
163
this .dataConverter = dataConverter ;
167
164
this .taskExecutorThreadPoolSize = taskExecutorThreadPoolSize ;
165
+ this .taskListActivitiesPerSecond = taskListActivitiesPerSecond ;
168
166
this .pollerOptions = pollerOptions ;
169
167
this .reportCompletionRetryOptions = reportCompletionRetryOptions ;
170
168
this .reportFailureRetryOptions = reportFailureRetryOptions ;
@@ -180,22 +178,26 @@ public DataConverter getDataConverter() {
180
178
return dataConverter ;
181
179
}
182
180
183
- public int getTaskExecutorThreadPoolSize () {
181
+ int getTaskExecutorThreadPoolSize () {
184
182
return taskExecutorThreadPoolSize ;
185
183
}
186
184
187
- public PollerOptions getPollerOptions () {
185
+ PollerOptions getPollerOptions () {
188
186
return pollerOptions ;
189
187
}
190
188
191
- public RetryOptions getReportCompletionRetryOptions () {
189
+ RetryOptions getReportCompletionRetryOptions () {
192
190
return reportCompletionRetryOptions ;
193
191
}
194
192
195
- public RetryOptions getReportFailureRetryOptions () {
193
+ RetryOptions getReportFailureRetryOptions () {
196
194
return reportFailureRetryOptions ;
197
195
}
198
196
197
+ double getTaskListActivitiesPerSecond () {
198
+ return taskListActivitiesPerSecond ;
199
+ }
200
+
199
201
public Scope getMetricsScope () {
200
202
return metricsScope ;
201
203
}
0 commit comments