Question

I'm using the BoneCP connection pool library and basically everything works fine. But there is one thing that I am not 100 percent sure about:

I have a connection pool that is open during the whole runtime. Do I have to add a shutdown hook that closes the connection pool? Or could I just do nothing when the application exists?

The shutdown hook would look like this:

Runtime.getRuntime().addShutdownHook(new Thread() {
    @Override
    public final void run() {
        connectionPool.shutdown(); //shutdown the connection pool
    }
});

But it gives me a not very good looking log message that mixes up with my logging system because the shutdown hooks run cuncurrent. So I would not want to call this. Do I have to?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top