瀏覽代碼

Fix NPE bug when creating connection group in ConnectionManager

- The NPE will occur when multiple threads are trying to create the connection group for the same namespace

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
master
Eric Zhao 5 年之前
父節點
當前提交
cd02fad290
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. +1
    -1
      sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/connection/ConnectionManager.java

+ 1
- 1
sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/connection/ConnectionManager.java 查看文件

@@ -55,7 +55,7 @@ public final class ConnectionManager {
ConnectionGroup group = CONN_MAP.get(namespace); ConnectionGroup group = CONN_MAP.get(namespace);
if (group == null) { if (group == null) {
synchronized (CREATE_LOCK) { synchronized (CREATE_LOCK) {
if (CONN_MAP.get(namespace) == null) {
if ((group = CONN_MAP.get(namespace)) == null) {
group = new ConnectionGroup(namespace); group = new ConnectionGroup(namespace);
CONN_MAP.put(namespace, group); CONN_MAP.put(namespace, group);
} }


Loading…
取消
儲存