Java – when using Proxool, do you need to explicitly close each getconnection()?

I'm writing new database connection code and think I'll try Proxool as the connection pool implementer

Usually, programmers will ensure that each drivermanager Getconnection (...) followed by a connection close().

But when using Proxool, do you need to close it? I'm confused because:

One Proxool documentation here( http://proxool.sourceforge.net/quickStart.html )Display the close() being called,

Wan I read somewhere that Proxool adds and closes all connections when the close hook program exits

My program is most concerned about performance (up to 200 DB writes per second), so I'm not sure how Proxool's getconnection() / close() will affect performance

My question is:

>Do I need to close (), or can I rely on Proxool to close my connection? > If I had to call close () explicitly each time, wouldn't this have a negative impact on performance?

Thank you in advance

Solution

Database pools are usually subclass / decorated connections, so if an application calls the close () method, it will not actually close the connection, but release it back to the pool This is done for performance reasons, because the cost of establishing a new connection each time is very high, and in order to improve the user / connection rate

That is, you need to call connection Close (), so that the pool knows that you are no longer using it and that it can be provided to the next thread requesting it

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>