File tree Expand file tree Collapse file tree
util/src/main/java/io/kubernetes/client/informer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,11 +171,9 @@ public synchronized void startAllRegisteredInformers() {
171171 return ;
172172 }
173173 informers .forEach (
174- (informerType , informer ) -> {
175- if (!startedInformers .containsKey (informerType )) {
176- startedInformers .put (informerType , informerExecutor .submit (informer ::run ));
177- }
178- });
174+ (informerType , informer ) ->
175+ startedInformers .computeIfAbsent (
176+ informerType , key -> informerExecutor .submit (informer ::run )));
179177 }
180178
181179 /** Stop all registered informers and shut down the thread pool. */
@@ -194,8 +192,7 @@ public synchronized void stopAllRegisteredInformers(boolean shutdownThreadPool)
194192 }
195193 informers .forEach (
196194 (informerType , informer ) -> {
197- if (startedInformers .containsKey (informerType )) {
198- startedInformers .remove (informerType );
195+ if (startedInformers .remove (informerType ) != null ) {
199196 informer .stop ();
200197 }
201198 });
You can’t perform that action at this time.
0 commit comments