hibernate - force database connections to re-connect -
i'm using hibernate c3p0 connection pooling.
the problem we're facing periodically perform database upgrades not take effect active connections - hence running applications need purge open connections , re-connect.
i know there maxage connections in c3p0, don't think wise set value less 30 seconds.
is there mechanism can tell applications disconnect/reconnect immediately?
i'm not sure how maybe test query leveraged?
ideas welcome.
p.
c3p0 pooleddatasources offer hardreset()
method , series of softreset methods, replace connections in pools new connections. see
http://www.mchange.com/projects/c3p0/apidocs/com/mchange/v2/c3p0/pooleddatasource.html
hardreset()
sure , , disruptive: close()
connections under clients in pools datasource manages.
softreset gentler: can reset single pool if wish, , connections aren't close()
ed out beneath clients, clients may go on utilize them , quietly discarded rather returned pool.
[note 1 c3p0 datasource may manage multiple pools if have called getconnection( user, password )
, getconnection()
. connections authenticated different users must segregated different pools.]
in likelihood you'll want phone call softresetallusers()
. cast c3p0 datasource pooleddatasource
(in com.mchange.v2.c3p0
) , phone call method.
hibernate c3p0
No comments:
Post a Comment