Permalink
Browse files

switch watcher map to Concurrent, clear out after loop to close vs. i…

…n loop
  • Loading branch information...
gabemontero committed Apr 6, 2018
1 parent 8c252cc commit 195c49d21df6d48c7af3c56618d0beb0267a87b8
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/main/java/io/fabric8/jenkins/openshiftsync/BaseWatcher.java
@@ -19,8 +19,8 @@
import io.fabric8.kubernetes.client.KubernetesClientException;
import io.fabric8.kubernetes.client.Watch;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
@@ -38,7 +38,7 @@
@SuppressFBWarnings("EI_EXPOSE_REP2")
public BaseWatcher(String[] namespaces) {
this.namespaces = namespaces;
watches = new HashMap<String, Watch>();
watches = new ConcurrentHashMap<String, Watch>();
}
public abstract Runnable getStartTimerTask();
@@ -68,8 +68,8 @@ public synchronized void stop() {
for (Map.Entry<String, Watch> entry : watches.entrySet()) {
entry.getValue().close();
watches.remove(entry.getKey());
}
watches.clear();
}
public synchronized void onClose(KubernetesClientException e, String namespace) {

0 comments on commit 195c49d

Please sign in to comment.