justinmclean commented on code in PR #8210:
URL: https://github.com/apache/gravitino/pull/8210#discussion_r2287626419
##########
core/src/main/java/org/apache/gravitino/storage/relational/session/SqlSessions.java:
##########
@@ -111,4 +89,19 @@ public static void closeSqlSession() {
public static <T> T getMapper(Class<T> className) {
return getSqlSession().getMapper(className);
}
+
+ private static void executeAndCleanupSession(Consumer<SqlSession> consumer) {
+ SqlSession sqlSession = sessions.get();
+
+ if (sqlSession == null) {
+ getSessions().remove();
+ return;
+ }
+
+ try (sqlSession) {
+ consumer.accept(sqlSession);
+ } finally {
+ sessions.remove();
+ }
+ }
}
Review Comment:
Sorry, I missed that and just saw the close() method had been removed. You
are correct, it will call close if needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]