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

Check and fix H2NVCache.shutdown #224

Open
acaproni opened this issue Oct 22, 2024 · 0 comments
Open

Check and fix H2NVCache.shutdown #224

acaproni opened this issue Oct 22, 2024 · 0 comments

Comments

@acaproni
Copy link
Member

In coderabbit review of #205, coderabbit reported the following message that needs to be investigated and, if it is the case, fixed:

Improve connection management

The database connection is created in the init() method, but there's no explicit connection closing in the shutdown() method. Consider adding connection closing to prevent resource leaks:

override def shutdown(): Unit = {
  if (conn != null && !conn.isClosed) {
    conn.close()
  }
  DeleteDbFiles.execute(connectionData.folderName, connectionData.fileName, false)
}

Also, consider using a connection pool for better performance and resource management, especially if this cache might be used in a multi-threaded environment.

Also applies to: 249-251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant