Skip to content

Commit c62fc73

Browse files
authored
fix: config service override executor service concurrent reconcilation numbers (#1485)
1 parent 83fc1e9 commit c62fc73

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverrider.java

+20-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.Optional;
44
import java.util.Set;
55
import java.util.concurrent.ExecutorService;
6+
import java.util.concurrent.Executors;
67
import java.util.function.Consumer;
78

89
import io.fabric8.kubernetes.client.Config;
@@ -16,7 +17,8 @@ public class ConfigurationServiceOverrider {
1617
private Metrics metrics;
1718
private Config clientConfig;
1819
private Boolean checkCR;
19-
private Integer threadNumber;
20+
private Integer concurrentReconciliationThreads;
21+
private Integer concurrentWorkflowExecutorThreads;
2022
private Cloner cloner;
2123
private Integer timeoutSeconds;
2224
private Boolean closeClientOnStop;
@@ -40,7 +42,12 @@ public ConfigurationServiceOverrider checkingCRDAndValidateLocalModel(boolean ch
4042
}
4143

4244
public ConfigurationServiceOverrider withConcurrentReconciliationThreads(int threadNumber) {
43-
this.threadNumber = threadNumber;
45+
this.concurrentReconciliationThreads = threadNumber;
46+
return this;
47+
}
48+
49+
public ConfigurationServiceOverrider withConcurrentWorkflowExecutorThreads(int threadNumber) {
50+
this.concurrentWorkflowExecutorThreads = threadNumber;
4451
return this;
4552
}
4653

@@ -105,7 +112,14 @@ public boolean checkCRDAndValidateLocalModel() {
105112

106113
@Override
107114
public int concurrentReconciliationThreads() {
108-
return threadNumber != null ? threadNumber : original.concurrentReconciliationThreads();
115+
return concurrentReconciliationThreads != null ? concurrentReconciliationThreads
116+
: original.concurrentReconciliationThreads();
117+
}
118+
119+
@Override
120+
public int concurrentWorkflowExecutorThreads() {
121+
return concurrentWorkflowExecutorThreads != null ? concurrentWorkflowExecutorThreads
122+
: original.concurrentWorkflowExecutorThreads();
109123
}
110124

111125
@Override
@@ -125,13 +139,14 @@ public boolean closeClientOnStop() {
125139

126140
@Override
127141
public ExecutorService getExecutorService() {
128-
return executorService != null ? executorService : original.getExecutorService();
142+
return executorService != null ? executorService
143+
: Executors.newFixedThreadPool(concurrentReconciliationThreads());
129144
}
130145

131146
@Override
132147
public ExecutorService getWorkflowExecutorService() {
133148
return workflowExecutorService != null ? workflowExecutorService
134-
: original.getWorkflowExecutorService();
149+
: Executors.newFixedThreadPool(concurrentWorkflowExecutorThreads());
135150
}
136151

137152
@Override

0 commit comments

Comments
 (0)