ServerRoutineInvocation invocation,
boolean topLevel, boolean success) {
boolean close = topLevel;
if ((transaction != null) && (commitMode == CommitMode.MANUAL)) {
if (success) {
context.warnClient(new EmbeddedResourceLeakException("Connection with setAutoCommit(false) was not closed"));
success = false; // One warning is enough.
}
close = true;
}
if (close) {
if (!openResultSets.isEmpty()) {
if (success) {
List<String> stmts = new ArrayList<>(openResultSets.size());
for (JDBCResultSet resultSet : openResultSets) {
stmts.add(resultSet.statement.sql);
}
context.warnClient(new EmbeddedResourceLeakException("ResultSet was not closed: " + stmts));
}
try {
while (!openResultSets.isEmpty()) {
openResultSets.get(0).close();
}