Skip to content

Commit

Permalink
[JENKINS-47725] Make the access to WeakHashMap synchronized
Browse files Browse the repository at this point in the history
  • Loading branch information
fbelzunc committed Oct 30, 2017
1 parent 1d1c683 commit 2f3eb3c
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -35,6 +35,7 @@
import hudson.slaves.ComputerListener;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.logging.Level;
Expand Down Expand Up @@ -112,7 +113,7 @@ private FilePathUtils() {}
@Restricted(NoExternalUse.class)
@Extension public static final class Listener extends ComputerListener {

private static final Map<VirtualChannel,String> channelNames = new WeakHashMap<>();
private static final Map<VirtualChannel,String> channelNames = Collections.synchronizedMap(new WeakHashMap<VirtualChannel,String>());

// TODO: sync access?
static String getChannelName(@Nonnull VirtualChannel channel) {
Expand Down

0 comments on commit 2f3eb3c

Please sign in to comment.