Skip to content

Commit b4ad5c8

Browse files
authored
Merge pull request kubernetes-client#807 from ahadas/shared_thread_pool
Extract thread pool shutdown to a separate method
2 parents b9ca92a + 8417334 commit b4ad5c8

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

util/src/main/java/io/kubernetes/client/informer/SharedInformerFactory.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,17 @@ public synchronized void startAllRegisteredInformers() {
178178
});
179179
}
180180

181-
/** Stop all registered informers. */
181+
/** Stop all registered informers and shut down the thread pool. */
182182
public synchronized void stopAllRegisteredInformers() {
183+
stopAllRegisteredInformers(true);
184+
}
185+
186+
/**
187+
* Stop all registered informers.
188+
*
189+
* @param shutdownThreadPool whether or not to shut down the thread pool.
190+
*/
191+
public synchronized void stopAllRegisteredInformers(boolean shutdownThreadPool) {
183192
if (MapUtils.isEmpty(informers)) {
184193
return;
185194
}
@@ -190,6 +199,8 @@ public synchronized void stopAllRegisteredInformers() {
190199
informer.stop();
191200
}
192201
});
193-
informerExecutor.shutdown();
202+
if (shutdownThreadPool) {
203+
informerExecutor.shutdown();
204+
}
194205
}
195206
}

0 commit comments

Comments
 (0)