Skip to content

Commit 4d70435

Browse files
committed
Reverting as this is just a test
This test has unusual structure. If we want to remove `synchronized`, we should be able to rewrite the test without using `synchronized` like other tests.
1 parent 1e9eb69 commit 4d70435

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/test/java/org/apache/ibatis/submitted/primitive_result_type/IbatisConfig.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,27 +21,24 @@
2121
import org.apache.ibatis.session.SqlSession;
2222
import org.apache.ibatis.session.SqlSessionFactory;
2323
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
24-
import org.apache.ibatis.util.LockKit;
2524

2625
public class IbatisConfig {
27-
private static final LockKit.ComputedOnce computedOnce = new LockKit.ComputedOnce();
26+
2827
private static SqlSessionFactory sqlSessionFactory;
2928

3029
private IbatisConfig() {
3130
}
3231

33-
private static void init() {
34-
computedOnce.runOnce(() -> {
35-
if (sqlSessionFactory == null) {
36-
try {
37-
final String resource = "org/apache/ibatis/submitted/primitive_result_type/ibatis.xml";
38-
Reader reader = Resources.getResourceAsReader(resource);
39-
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
40-
} catch (Exception e) {
41-
throw new RuntimeException(e);
42-
}
32+
private static synchronized void init() {
33+
if (sqlSessionFactory == null) {
34+
try {
35+
final String resource = "org/apache/ibatis/submitted/primitive_result_type/ibatis.xml";
36+
Reader reader = Resources.getResourceAsReader(resource);
37+
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
38+
} catch (Exception e) {
39+
throw new RuntimeException(e);
4340
}
44-
});
41+
}
4542
}
4643

4744
public static SqlSession getSession() {

0 commit comments

Comments
 (0)