We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 54b4fa5 commit 1eea9f6Copy full SHA for 1eea9f6
src/main/java/org/apache/ibatis/executor/ErrorContext.java
@@ -21,7 +21,7 @@
21
public class ErrorContext {
22
23
private static final String LINE_SEPARATOR = System.lineSeparator();
24
- private static final ThreadLocal<ErrorContext> LOCAL = new ThreadLocal<>();
+ private static final ThreadLocal<ErrorContext> LOCAL = ThreadLocal.withInitial(ErrorContext::new);
25
26
private ErrorContext stored;
27
private String resource;
@@ -35,12 +35,7 @@ private ErrorContext() {
35
}
36
37
public static ErrorContext instance() {
38
- ErrorContext context = LOCAL.get();
39
- if (context == null) {
40
- context = new ErrorContext();
41
- LOCAL.set(context);
42
- }
43
- return context;
+ return LOCAL.get();
44
45
46
public ErrorContext store() {
0 commit comments