From 54af70f0674f93d76d399701da1a0f03647d4bac Mon Sep 17 00:00:00 2001 From: Brian Roach Date: Mon, 21 Jan 2013 19:48:06 -0700 Subject: [PATCH] Bootstrap thread safety Changed options and attrs from LinkedHashMap to ConcurrentHashMap to avoid a possible ConcurrentModificationException if a thread was adding/removing options/attrs while another was calling Bootstrap.init() or Bootstrap.duplicate() --- .../src/main/java/io/netty/bootstrap/AbstractBootstrap.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java b/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java index e0bc7c32c3..16bce3b995 100644 --- a/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java +++ b/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java @@ -28,8 +28,8 @@ import io.netty.util.AttributeKey; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.SocketAddress; -import java.util.LinkedHashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * {@link AbstractBootstrap} is a helper class that makes it easy to bootstrap a {@link Channel}. It support @@ -40,8 +40,8 @@ public abstract class AbstractBootstrap> { private EventLoopGroup group; private ChannelFactory factory; private SocketAddress localAddress; - private final Map, Object> options = new LinkedHashMap, Object>(); - private final Map, Object> attrs = new LinkedHashMap, Object>(); + private final Map, Object> options = new ConcurrentHashMap, Object>(); + private final Map, Object> attrs = new ConcurrentHashMap, Object>(); private ChannelHandler handler; /**