@@ -64,6 +64,8 @@ public static final class Builder {
64
64
65
65
private Thread .UncaughtExceptionHandler uncaughtExceptionHandler ;
66
66
67
+ private PollerAutoScalerOptions pollerAutoScalerOptions ;
68
+
67
69
private Builder () {}
68
70
69
71
private Builder (PollerOptions o ) {
@@ -79,6 +81,7 @@ private Builder(PollerOptions o) {
79
81
this .pollThreadNamePrefix = o .getPollThreadNamePrefix ();
80
82
this .pollOnlyIfExecutorHasCapacity = o .getPollOnlyIfExecutorHasCapacity ();
81
83
this .uncaughtExceptionHandler = o .getUncaughtExceptionHandler ();
84
+ this .pollerAutoScalerOptions = o .getPollerAutoScalerOptions ();
82
85
}
83
86
84
87
/** Defines interval for measuring poll rate. Larger the interval more spiky can be the load. */
@@ -145,6 +148,11 @@ public Builder setPollOnlyIfExecutorHasCapacity(boolean pollOnlyIfExecutorHasCap
145
148
return this ;
146
149
}
147
150
151
+ public Builder setPollerAutoScalerOptions (PollerAutoScalerOptions pollerAutoScalerOptions ) {
152
+ this .pollerAutoScalerOptions = pollerAutoScalerOptions ;
153
+ return this ;
154
+ }
155
+
148
156
public PollerOptions build () {
149
157
if (uncaughtExceptionHandler == null ) {
150
158
uncaughtExceptionHandler = (t , e ) -> log .error ("uncaught exception" , e );
@@ -158,7 +166,8 @@ public PollerOptions build() {
158
166
pollThreadCount ,
159
167
uncaughtExceptionHandler ,
160
168
pollThreadNamePrefix ,
161
- pollOnlyIfExecutorHasCapacity );
169
+ pollOnlyIfExecutorHasCapacity ,
170
+ pollerAutoScalerOptions );
162
171
}
163
172
}
164
173
@@ -180,6 +189,8 @@ public PollerOptions build() {
180
189
181
190
private final Boolean pollOnlyIfExecutorHasCapacity ;
182
191
192
+ private final PollerAutoScalerOptions pollerAutoScalerOptions ;
193
+
183
194
private PollerOptions (
184
195
int maximumPollRateIntervalMilliseconds ,
185
196
double maximumPollRatePerSecond ,
@@ -189,7 +200,8 @@ private PollerOptions(
189
200
int pollThreadCount ,
190
201
Thread .UncaughtExceptionHandler uncaughtExceptionHandler ,
191
202
String pollThreadNamePrefix ,
192
- boolean pollOnlyIfExecutorHasCapacity ) {
203
+ boolean pollOnlyIfExecutorHasCapacity ,
204
+ PollerAutoScalerOptions pollerAutoScalerOptions ) {
193
205
this .maximumPollRateIntervalMilliseconds = maximumPollRateIntervalMilliseconds ;
194
206
this .maximumPollRatePerSecond = maximumPollRatePerSecond ;
195
207
this .pollBackoffCoefficient = pollBackoffCoefficient ;
@@ -199,6 +211,7 @@ private PollerOptions(
199
211
this .uncaughtExceptionHandler = uncaughtExceptionHandler ;
200
212
this .pollThreadNamePrefix = pollThreadNamePrefix ;
201
213
this .pollOnlyIfExecutorHasCapacity = pollOnlyIfExecutorHasCapacity ;
214
+ this .pollerAutoScalerOptions = pollerAutoScalerOptions ;
202
215
}
203
216
204
217
public int getMaximumPollRateIntervalMilliseconds () {
@@ -237,6 +250,10 @@ public Boolean getPollOnlyIfExecutorHasCapacity() {
237
250
return pollOnlyIfExecutorHasCapacity ;
238
251
}
239
252
253
+ public PollerAutoScalerOptions getPollerAutoScalerOptions () {
254
+ return pollerAutoScalerOptions ;
255
+ }
256
+
240
257
@ Override
241
258
public String toString () {
242
259
return "PollerOptions{"
@@ -256,6 +273,8 @@ public String toString() {
256
273
+ pollThreadNamePrefix
257
274
+ ", pollOnlyIfExecutorHasCapacity='"
258
275
+ pollOnlyIfExecutorHasCapacity
276
+ + ", pollerAutoScalerOptions='"
277
+ + pollerAutoScalerOptions
259
278
+ '\''
260
279
+ '}' ;
261
280
}
0 commit comments