开发者

DBCP: removeAbandoned VS eviction

开发者 https://www.devze.com 2023-03-18 18:39 出处:网络
I fail to figure out the difference between removeAbandoned and eviction. I read somewhere that removeAbandoned was deprecated, but it is not mentionned anywhere in the official doc (http://commons.ap

I fail to figure out the difference between removeAbandoned and eviction. I read somewhere that removeAbandoned was deprecated, but it is not mentionned anywhere in the official doc (http://commons.apache.org/dbcp/configuration.html).

So, if some开发者_如何学运维one could enlighten me, it would be greatly appreciated :)

Thanks!


They mean different things:

  • "eviction" occurs when a database connection is unused by the application (idle in the pool) for a long enough period of time at which point it's discarded
  • "abandoned connection" refers to database connection that is still in use by an application after some period of time, usually long enough to indicate that the connection is leaking

Eviction does not indicate a problem with your code (it's just that the application needs fewer connections after a burst of connections) but abandoned connections means that the application is holding on to a connection and is not returning to the pool.

0

精彩评论

暂无评论...
验证码 换一张
取 消