We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3aa2058 commit 510071aCopy full SHA for 510071a
core/src/main/java/com/taobao/arthas/core/util/RegexCacheManager.java
@@ -39,17 +39,11 @@ public Pattern getPattern(String regex) {
39
return pattern;
40
}
41
42
- // 使用双重检查锁,避免并发情况下重复编译相同的正则
43
- synchronized (regexCache) {
44
- pattern = regexCache.get(regex);
45
- if (pattern == null) {
46
- // 缓存未命中,编译正则表达式
47
- // 不捕获PatternSyntaxException,让异常向上抛出,以便及时发现无效的正则表达式
48
- pattern = Pattern.compile(regex);
49
- // 缓存编译结果
50
- regexCache.put(regex, pattern);
51
- }
52
+ // 缓存未命中,编译正则表达式
+ // 不捕获PatternSyntaxException,让异常向上抛出,以便及时发现无效的正则表达式
+ pattern = Pattern.compile(regex);
+ // 缓存编译结果
+ regexCache.put(regex, pattern);
53
54
55
0 commit comments