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

HikariCP and exiting a program #108

Closed
JohnMerlino1 opened this issue Jul 10, 2014 · 1 comment
Closed

HikariCP and exiting a program #108

JohnMerlino1 opened this issue Jul 10, 2014 · 1 comment
Labels

Comments

@JohnMerlino1
Copy link

I am wondering if I need to call System.exit(1) in my program, do I need to perform any kind of cleanup with HikariCP, kind of like flushing a buffer with files or running shutdown with executorservice? Currently, when I call getConnection() on HikariDataSource, I have a finally block that closes the statement, result and connection (actually I assume the connection is returned to the pool):

        if (stmt != null)  
            {  
                stmt.close();
            }  

            if (result != null)  
            {  
                result.close();  
            }  

            if (conn != null)  
            {  
                conn.close();  
            } 

I would like to know if I need to do anything else when I exit my program.

@brettwooldridge
Copy link
Owner

You should call close() or shutdown() on the HikariDataSource before you exit. This will ensure that all connections to the database in the pool are closed.

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

No branches or pull requests

2 participants