@@ -30,20 +30,15 @@ public final class SingleWorkerOptions {
3030 public static final class Builder {
3131
3232 private String identity ;
33-
3433 private DataConverter dataConverter ;
35-
3634 private int taskExecutorThreadPoolSize = 100 ;
37-
35+ private double taskListActivitiesPerSecond ;
3836 private PollerOptions pollerOptions ;
39-
4037 /** TODO: Dynamic expiration based on activity timeout */
4138 private RetryOptions reportCompletionRetryOptions ;
4239
4340 private RetryOptions reportFailureRetryOptions ;
44-
4541 private Scope metricsScope ;
46-
4742 private boolean enableLoggingInReplay ;
4843
4944 public Builder () {}
@@ -52,6 +47,7 @@ public Builder(SingleWorkerOptions options) {
5247 this .identity = options .getIdentity ();
5348 this .dataConverter = options .getDataConverter ();
5449 this .pollerOptions = options .getPollerOptions ();
50+ this .taskListActivitiesPerSecond = options .getTaskListActivitiesPerSecond ();
5551 this .taskExecutorThreadPoolSize = options .getTaskExecutorThreadPoolSize ();
5652 this .reportCompletionRetryOptions = options .getReportCompletionRetryOptions ();
5753 this .reportFailureRetryOptions = options .getReportFailureRetryOptions ();
@@ -89,6 +85,21 @@ public Builder setEnableLoggingInReplay(boolean enableLoggingInReplay) {
8985 return this ;
9086 }
9187
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+
92103 public SingleWorkerOptions build () {
93104 if (reportCompletionRetryOptions == null ) {
94105 reportCompletionRetryOptions = Retryer .DEFAULT_SERVICE_OPERATION_RETRY_OPTIONS ;
@@ -119,44 +130,30 @@ public SingleWorkerOptions build() {
119130 identity ,
120131 dataConverter ,
121132 taskExecutorThreadPoolSize ,
133+ taskListActivitiesPerSecond ,
122134 pollerOptions ,
123135 reportCompletionRetryOptions ,
124136 reportFailureRetryOptions ,
125137 metricsScope ,
126138 enableLoggingInReplay );
127139 }
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- }
138140 }
139141
140142 private final String identity ;
141-
142143 private final DataConverter dataConverter ;
143-
144144 private final int taskExecutorThreadPoolSize ;
145-
145+ private final double taskListActivitiesPerSecond ;
146146 private final PollerOptions pollerOptions ;
147-
148147 private final RetryOptions reportCompletionRetryOptions ;
149-
150148 private final RetryOptions reportFailureRetryOptions ;
151-
152149 private final Scope metricsScope ;
153-
154150 private final boolean enableLoggingInReplay ;
155151
156152 private SingleWorkerOptions (
157153 String identity ,
158154 DataConverter dataConverter ,
159155 int taskExecutorThreadPoolSize ,
156+ double taskListActivitiesPerSecond ,
160157 PollerOptions pollerOptions ,
161158 RetryOptions reportCompletionRetryOptions ,
162159 RetryOptions reportFailureRetryOptions ,
@@ -165,6 +162,7 @@ private SingleWorkerOptions(
165162 this .identity = identity ;
166163 this .dataConverter = dataConverter ;
167164 this .taskExecutorThreadPoolSize = taskExecutorThreadPoolSize ;
165+ this .taskListActivitiesPerSecond = taskListActivitiesPerSecond ;
168166 this .pollerOptions = pollerOptions ;
169167 this .reportCompletionRetryOptions = reportCompletionRetryOptions ;
170168 this .reportFailureRetryOptions = reportFailureRetryOptions ;
@@ -180,22 +178,26 @@ public DataConverter getDataConverter() {
180178 return dataConverter ;
181179 }
182180
183- public int getTaskExecutorThreadPoolSize () {
181+ int getTaskExecutorThreadPoolSize () {
184182 return taskExecutorThreadPoolSize ;
185183 }
186184
187- public PollerOptions getPollerOptions () {
185+ PollerOptions getPollerOptions () {
188186 return pollerOptions ;
189187 }
190188
191- public RetryOptions getReportCompletionRetryOptions () {
189+ RetryOptions getReportCompletionRetryOptions () {
192190 return reportCompletionRetryOptions ;
193191 }
194192
195- public RetryOptions getReportFailureRetryOptions () {
193+ RetryOptions getReportFailureRetryOptions () {
196194 return reportFailureRetryOptions ;
197195 }
198196
197+ double getTaskListActivitiesPerSecond () {
198+ return taskListActivitiesPerSecond ;
199+ }
200+
199201 public Scope getMetricsScope () {
200202 return metricsScope ;
201203 }
0 commit comments