Mathieu
Mathieu

Reputation: 1677

DBCP: removeAbandoned VS eviction

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 someone could enlighten me, it would be greatly appreciated :)

Thanks!

Upvotes: 12

Views: 6962

Answers (1)

Clement P
Clement P

Reputation: 3273

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.

Upvotes: 28

Related Questions