Skip to content

Commit

Permalink
Related to #116. Make sure that the cache is updated (even with null) so
Browse files Browse the repository at this point in the history
that BlockingCache works when an exception is thrown when running the
statement.
  • Loading branch information
emacarron authored and hazendaz committed Jul 12, 2014
1 parent 068c659 commit f73fffd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/org/apache/ibatis/executor/CachingExecutor.java
Expand Up @@ -87,8 +87,11 @@ public <E> List<E> query(MappedStatement ms, Object parameterObject, RowBounds r
@SuppressWarnings("unchecked")
List<E> list = (List<E>) tcm.getObject(cache, key);
if (list == null) {
list = delegate.<E> query(ms, parameterObject, rowBounds, resultHandler, key, boundSql);
tcm.putObject(cache, key, list); // issue #578. Query must be not synchronized to prevent deadlocks
try {
list = delegate.<E> query(ms, parameterObject, rowBounds, resultHandler, key, boundSql);
} finally {
tcm.putObject(cache, key, list); // issue #578 and #116
}
}
return list;
}
Expand Down

0 comments on commit f73fffd

Please sign in to comment.