Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In BatchExecutor, close each statement right after it is executed. #1110

Merged
merged 2 commits into from
Oct 15, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/main/java/org/apache/ibatis/executor/BatchExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public List<BatchResult> doFlushStatements(boolean isRollback) throws SQLExcepti
keyGenerator.processAfter(this, ms, stmt, parameter);
}
}
closeStatement(stmt);
} catch (BatchUpdateException e) {
StringBuilder message = new StringBuilder();
message.append(batchResult.getMappedStatement().getId())
Expand All @@ -149,9 +150,6 @@ public List<BatchResult> doFlushStatements(boolean isRollback) throws SQLExcepti
}
return results;
} finally {
for (Statement stmt : statementList) {
Copy link
Member

@kazuki43zoo kazuki43zoo Oct 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this changes, If an exception occurred during statement execution, I think there is a case that statement does not close.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for review - you are right. I will improve the code.

closeStatement(stmt);
}
currentSql = null;
statementList.clear();
batchResultList.clear();
Expand Down