Skip to content

Commit

Permalink
Using Thread#id instead of the name.
Browse files Browse the repository at this point in the history
  • Loading branch information
emacarron committed Sep 3, 2013
1 parent b9c9473 commit 86ea1c1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ResultLoader {
protected final CacheKey cacheKey;
protected final BoundSql boundSql;
protected final ResultExtractor resultExtractor;
protected final String creatorThread;
protected final long creatorThreadId;

protected boolean loaded;
protected Object resultObject;
Expand All @@ -60,7 +60,7 @@ public ResultLoader(Configuration config, Executor executor, MappedStatement map
this.cacheKey = cacheKey;
this.boundSql = boundSql;
this.resultExtractor = new ResultExtractor(configuration, objectFactory);
this.creatorThread = Thread.currentThread().getName();
this.creatorThreadId = Thread.currentThread().getId();
}

public Object loadResult() throws SQLException {
Expand All @@ -71,7 +71,7 @@ public Object loadResult() throws SQLException {

private <E> List<E> selectList() throws SQLException {
Executor localExecutor = executor;
if (localExecutor.isClosed() || !Thread.currentThread().getName().equals(this.creatorThread)) {
if (Thread.currentThread().getId() != this.creatorThreadId || localExecutor.isClosed()) {
localExecutor = newExecutor();
}
try {
Expand Down

0 comments on commit 86ea1c1

Please sign in to comment.