yuqi1129 commented on PR #8210:
URL: https://github.com/apache/gravitino/pull/8210#issuecomment-3208816552
@kitoha
```
public static <T, R> R doWithoutCommitAndFetchResult(Class<T> mapperClazz,
Function<T, R> func) {
// This line will open a new SqlSession if it does not exists
T mapper = SqlSessions.getMapper(mapperClazz);
// Use the sqlSession to perform SQL operations and DO NOT close session
return func.apply(mapper);
}
```
The method `doWithoutCommitAndFetchResult` and `doWithoutCommit` is designed
to be wrapped with `doMultipleWithCommit` and let `doMultipleWithCommit` close
the session automatically. However, in some places
like for example, `PolicyMetaService#listPoliciesForMetadataObject`, the
method is not called within `doMultipleWithCommit` and will lead to connections
leak.
If you have problem with this, please let me know, then try to fix it
another PR and rollback the lastes commit
`[7c26c8d](https://github.com/apache/gravitino/pull/8210/commits/7c26c8dd4a3c859324e11ad53723e900952cc472)`
--
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]