Skip to content

Commit aefcbc6

Browse files
committed
explicit scheduled executor service
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent d7d484e commit aefcbc6

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public class ExecutorServiceManager {
4040
private static final Logger log = LoggerFactory.getLogger(ExecutorServiceManager.class);
4141
private ExecutorService executor;
4242
private ExecutorService workflowExecutor;
43-
private ScheduledExecutorService cachingExecutorService;
43+
private ExecutorService cachingExecutorService;
44+
private ScheduledExecutorService scheduledExecutorService;
4445
private boolean started;
4546
private ConfigurationService configurationService;
4647

@@ -123,14 +124,19 @@ private synchronized void lazyInitWorkflowExecutorService() {
123124
}
124125
}
125126

126-
public ScheduledExecutorService cachingExecutorService() {
127+
public ExecutorService cachingExecutorService() {
127128
return cachingExecutorService;
128129
}
129130

131+
public ScheduledExecutorService scheduledExecutorService() {
132+
return scheduledExecutorService;
133+
}
134+
130135
public void start(ConfigurationService configurationService) {
131136
if (!started) {
132137
this.configurationService = configurationService; // used to lazy init workflow executor
133-
this.cachingExecutorService = Executors.newScheduledThreadPool(0);
138+
this.cachingExecutorService = Executors.newCachedThreadPool();
139+
this.scheduledExecutorService = Executors.newScheduledThreadPool(0);
134140
this.executor = new InstrumentedExecutorService(configurationService.getExecutorService());
135141
started = true;
136142
}

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public synchronized void start() {
160160
controllerConfiguration
161161
.getConfigurationService()
162162
.getExecutorServiceManager()
163-
.cachingExecutorService(),
163+
.scheduledExecutorService(),
164164
this);
165165
this.cache = new InformerManager<>(client, configuration, this);
166166
cache.setControllerConfiguration(controllerConfiguration);

test.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Copyright Java Operator SDK Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
mci -Dlicense.skip jib:dockerBuild && kind load docker-image leader-election-operator:latest

0 commit comments

Comments
 (0)