Skip to content
Permalink
Browse files
Merge pull request #58 from fbelzunc/JENKINS-47725
[FIXED JENKINS-47725] Make the access to WeakHashMap synchronized
  • Loading branch information
svanoort committed Oct 30, 2017
2 parents 1d1c683 + 6fd5902 commit 76f501eb688095d032bc5b9e4c9a55d0aa6b4bdd
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/main/java/org/jenkinsci/plugins/workflow/FilePathUtils.java
@@ -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;
@@ -112,9 +113,8 @@ 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) {
String channelName = channelNames.get(channel);

0 comments on commit 76f501e

Please sign in to comment.