Use computeIfAbsent in SpelCompiler and AdvisedSupport

See gh-26028
This commit is contained in:
hzmpay
2020-11-04 15:00:11 +08:00
committed by Stephane Nicoll
parent 178cb429a8
commit cde476f90e
2 changed files with 3 additions and 13 deletions

View File

@@ -233,11 +233,7 @@ public final class SpelCompiler implements Opcodes {
if (compiler == null) {
// Full lock now since we're creating a child ClassLoader
synchronized (compilers) {
compiler = compilers.get(clToUse);
if (compiler == null) {
compiler = new SpelCompiler(clToUse);
compilers.put(clToUse, compiler);
}
return compilers.computeIfAbsent(clToUse, SpelCompiler::new);
}
}
return compiler;