Przeglądaj źródła

Fix the bug of misplaced locks in ContextUtil and ClusterNode (#1429)

- which may lead to IllegalMonitorStateException in unlock() when unchecked error occurs during lock()
master
haifeng GitHub 4 lat temu
rodzic
commit
04a1d065dd
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 2 dodań i 2 usunięć
  1. +1
    -1
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/context/ContextUtil.java
  2. +1
    -1
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/ClusterNode.java

+ 1
- 1
sentinel-core/src/main/java/com/alibaba/csp/sentinel/context/ContextUtil.java Wyświetl plik

@@ -127,8 +127,8 @@ public class ContextUtil {
setNullContext();
return NULL_CONTEXT;
} else {
LOCK.lock();
try {
LOCK.lock();
node = contextNameNodeMap.get(name);
if (node == null) {
if (contextNameNodeMap.size() > Constants.MAX_CONTEXT_NAME_SIZE) {


+ 1
- 1
sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/ClusterNode.java Wyświetl plik

@@ -101,8 +101,8 @@ public class ClusterNode extends StatisticNode {
public Node getOrCreateOriginNode(String origin) {
StatisticNode statisticNode = originCountMap.get(origin);
if (statisticNode == null) {
lock.lock();
try {
lock.lock();
statisticNode = originCountMap.get(origin);
if (statisticNode == null) {
// The node is absent, create a new node for the origin.


Ładowanie…
Anuluj
Zapisz