Skip to content

Commit 86ea1c1

Browse files
committed
Using Thread#id instead of the name.
1 parent b9c9473 commit 86ea1c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/apache/ibatis/executor/loader/ResultLoader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class ResultLoader {
4545
protected final CacheKey cacheKey;
4646
protected final BoundSql boundSql;
4747
protected final ResultExtractor resultExtractor;
48-
protected final String creatorThread;
48+
protected final long creatorThreadId;
4949

5050
protected boolean loaded;
5151
protected Object resultObject;
@@ -60,7 +60,7 @@ public ResultLoader(Configuration config, Executor executor, MappedStatement map
6060
this.cacheKey = cacheKey;
6161
this.boundSql = boundSql;
6262
this.resultExtractor = new ResultExtractor(configuration, objectFactory);
63-
this.creatorThread = Thread.currentThread().getName();
63+
this.creatorThreadId = Thread.currentThread().getId();
6464
}
6565

6666
public Object loadResult() throws SQLException {
@@ -71,7 +71,7 @@ public Object loadResult() throws SQLException {
7171

7272
private <E> List<E> selectList() throws SQLException {
7373
Executor localExecutor = executor;
74-
if (localExecutor.isClosed() || !Thread.currentThread().getName().equals(this.creatorThread)) {
74+
if (Thread.currentThread().getId() != this.creatorThreadId || localExecutor.isClosed()) {
7575
localExecutor = newExecutor();
7676
}
7777
try {

0 commit comments

Comments
 (0)