Skip to content

Commit d417992

Browse files
committed
close and end in a finally block
1 parent d80c6cc commit d417992

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/main/java/org/mybatis/cdi/LocalTransactionInterceptor.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ public Object invoke(InvocationContext ctx) throws Exception {
6363
}
6464
finally {
6565
if (isInitiator) {
66-
if (needsRollback) {
67-
rollback(transactional);
68-
}
69-
else {
70-
commit(transactional);
66+
try {
67+
if (needsRollback) {
68+
rollback(transactional);
69+
}
70+
else {
71+
commit(transactional);
72+
}
73+
} finally {
74+
close();
75+
endJta(isExternalJta, needsRollback);
7176
}
72-
close();
73-
endJta(isExternalJta, needsRollback);
7477
}
7578
}
7679
return result;

0 commit comments

Comments
 (0)