C3P0: unreturnedConnectionTimeout in production?

匆匆过客 提交于 2019-12-22 06:56:37

问题


The parameter unreturnedConnectionTimeout times out unreturned connections after a given period of time. I'm trying to decide whether I should use this in my production persistence.xml? A big plus of using this is that the Connection Pool will be able to recover from leaky connections. A big minus is that leaky connections will be very difficult to detect.

Should I use unreturnedConnectionTimeout in production applications? If yes, what should its value be? Are there any other pros/cons I should consider?


回答1:


You should debug your Connection leaks, and then not use unreturnedConnectionTimeout in production, ideally.

To debug Connection leaks, set both unreturnedConnectionTimeout and debugUnreturnedConnectionStackTraces, see http://www.mchange.com/projects/c3p0/#configuring_to_debug_and_workaround_broken_clients (archived here). Then, when you have no more leaks, unset both of these parameters.

You would set unreturnedConnectionTimeout in production mostly if for some reason you can't debug and fix the application whose Connections are leaking, in which case it's a reasonable workaround to just set unreturnedConnectionTimeout and let c3p0 clean up what your application forgets to.



来源:https://stackoverflow.com/questions/29614549/c3p0-unreturnedconnectiontimeout-in-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!