Java Code Examples for org.apache.ibatis.executor.Executor#close()

The following examples show how to use org.apache.ibatis.executor.Executor#close() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResultLoader.java    From mybaties with Apache License 2.0 5 votes vote down vote up
private <E> List<E> selectList() throws SQLException {
  Executor localExecutor = executor;
  //如果executor已经被关闭了,则创建一个新的
  if (Thread.currentThread().getId() != this.creatorThreadId || localExecutor.isClosed()) {
    localExecutor = newExecutor();
  }
  try {
    //又调回Executor.query去了,比较巧妙
    return localExecutor.<E> query(mappedStatement, parameterObject, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER, cacheKey, boundSql);
  } finally {
    if (localExecutor != executor) {
      localExecutor.close(false);
    }
  }
}
 
Example 2
Source File: ResultLoader.java    From mybatis with Apache License 2.0 5 votes vote down vote up
private <E> List<E> selectList() throws SQLException {
  Executor localExecutor = executor;
  //如果executor已经被关闭了,则创建一个新的
  if (Thread.currentThread().getId() != this.creatorThreadId || localExecutor.isClosed()) {
    localExecutor = newExecutor();
  }
  try {
    //又调回Executor.query去了,比较巧妙
    return localExecutor.<E> query(mappedStatement, parameterObject, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER, cacheKey, boundSql);
  } finally {
    if (localExecutor != executor) {
      localExecutor.close(false);
    }
  }
}