标签:
1.这个方法使用键值作为锁对象,缩小了同步范围,提升了效率。
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value) { if (childOption == null) { throw new NullPointerException("childOption"); } if (value == null) { synchronized (childOptions) { childOptions.remove(childOption); } } else { synchronized (childOptions) { childOptions.put(childOption, value); } } return this; }
标签:
原文地址:http://www.cnblogs.com/barker/p/5174832.html