4
4
import java .util .Optional ;
5
5
import java .util .Set ;
6
6
import java .util .concurrent .ExecutorService ;
7
+ import java .util .concurrent .Executors ;
7
8
import java .util .function .Consumer ;
8
9
9
10
import org .slf4j .Logger ;
24
25
import io .javaoperatorsdk .operator .processing .dependent .kubernetes .KubernetesDependent ;
25
26
import io .javaoperatorsdk .operator .processing .dependent .workflow .ManagedWorkflowFactory ;
26
27
27
- import static io .javaoperatorsdk .operator .api .config .ExecutorServiceManager .newThreadPoolExecutor ;
28
-
29
28
/** An interface from which to retrieve configuration information. */
30
29
public interface ConfigurationService {
31
30
@@ -127,14 +126,18 @@ default boolean checkCRDAndValidateLocalModel() {
127
126
return false ;
128
127
}
129
128
130
- int DEFAULT_RECONCILIATION_THREADS_NUMBER = 200 ;
129
+ int DEFAULT_RECONCILIATION_THREADS_NUMBER = 50 ;
130
+ /**
131
+ * @deprecated Not used anymore in the default implementation
132
+ */
133
+ @ Deprecated (forRemoval = true )
131
134
int MIN_DEFAULT_RECONCILIATION_THREADS_NUMBER = 10 ;
132
135
133
136
/**
134
- * The maximum number of threads the operator can spin out to dispatch reconciliation requests to
135
- * reconcilers
137
+ * The number of threads the operator can spin out to dispatch reconciliation requests to
138
+ * reconcilers with the default executors
136
139
*
137
- * @return the maximum number of concurrent reconciliation threads
140
+ * @return the number of concurrent reconciliation threads
138
141
*/
139
142
default int concurrentReconciliationThreads () {
140
143
return DEFAULT_RECONCILIATION_THREADS_NUMBER ;
@@ -143,17 +146,24 @@ default int concurrentReconciliationThreads() {
143
146
/**
144
147
* The minimum number of threads the operator starts in the thread pool for reconciliations.
145
148
*
149
+ * @deprecated not used anymore by default executor implementation
146
150
* @return the minimum number of concurrent reconciliation threads
147
151
*/
152
+ @ Deprecated (forRemoval = true )
148
153
default int minConcurrentReconciliationThreads () {
149
154
return MIN_DEFAULT_RECONCILIATION_THREADS_NUMBER ;
150
155
}
151
156
152
157
int DEFAULT_WORKFLOW_EXECUTOR_THREAD_NUMBER = DEFAULT_RECONCILIATION_THREADS_NUMBER ;
158
+ /**
159
+ * @deprecated Not used anymore in the default implementation
160
+ */
161
+ @ Deprecated (forRemoval = true )
153
162
int MIN_DEFAULT_WORKFLOW_EXECUTOR_THREAD_NUMBER = MIN_DEFAULT_RECONCILIATION_THREADS_NUMBER ;
154
163
155
164
/**
156
- * Retrieves the maximum number of threads the operator can spin out to be used in the workflows.
165
+ * Number of threads the operator can spin out to be used in the workflows with the default
166
+ * executor.
157
167
*
158
168
* @return the maximum number of concurrent workflow threads
159
169
*/
@@ -164,8 +174,10 @@ default int concurrentWorkflowExecutorThreads() {
164
174
/**
165
175
* The minimum number of threads the operator starts in the thread pool for workflows.
166
176
*
177
+ * @deprecated not used anymore by default executor implementation
167
178
* @return the minimum number of concurrent workflow threads
168
179
*/
180
+ @ Deprecated (forRemoval = true )
169
181
default int minConcurrentWorkflowExecutorThreads () {
170
182
return MIN_DEFAULT_WORKFLOW_EXECUTOR_THREAD_NUMBER ;
171
183
}
@@ -191,13 +203,11 @@ default Metrics getMetrics() {
191
203
}
192
204
193
205
default ExecutorService getExecutorService () {
194
- return newThreadPoolExecutor (minConcurrentReconciliationThreads (),
195
- concurrentReconciliationThreads ());
206
+ return Executors .newFixedThreadPool (concurrentReconciliationThreads ());
196
207
}
197
208
198
209
default ExecutorService getWorkflowExecutorService () {
199
- return newThreadPoolExecutor (minConcurrentWorkflowExecutorThreads (),
200
- concurrentWorkflowExecutorThreads ());
210
+ return Executors .newFixedThreadPool (concurrentWorkflowExecutorThreads ());
201
211
}
202
212
203
213
default boolean closeClientOnStop () {
0 commit comments