c3p0 seems to close active connections -
i set unreturnedconnectiontimeout
release stale connections. assumed going close connections without activity looks closes every connection after specified time.
is bug or 'as designed'?
the manual states:
unreturnedconnectiontimeout
defines limit (in seconds) how long connection may remain checked out. if set nozero value, unreturned, checked-out connections exceed limit summarily destroyed, , replaced in pool. obviously, must take care set parameter value large enough intended operations on checked out connections have time complete. can use parameter merely workaround unreliable client apps fail close() connections
from conclude activity not influencing throwing away of connections. me sounds strange. why throw away active connections?
thanks, milo
i'm author of c3p0, , of paragraph quote.
unreturnedconnectiontimeout name , documentation state: timeout unreturned connections. implemented reluctantly, in response user feedback, because never necessary or useful if clients reliably check-in connections check out. when implemented, added second unsolicited config param, debugunreturnedconnectionstacktraces, encourage developers fix client applications rather rely lazily on unreturnedconnectiontimeout.
there nothing strange definition of unreturnedconnectiontimeout. generally, applications use connection pool not keep connections checked out long periods of time. doing defies purpose of connection pool, allow applications acquire connections on as-needed basis without large performance penalty. alternative connection pool application check out connections , retain them long-periods of time, available use. maintaining long-lived connections turns out complicated, applications delegate pooling library c3p0.
i understand have preexisting application maintains long-lived connections, cannot modify. hybrid architecture between applications maintain long-lived connections directly , applications delegate pool. in particular, want library helps maintain long-lived connections application designed retain.
c3p0 not library, unfortunately. c3p0 (like connection pooling libraries) considers checked-out connections client's property, , no maintenance work on them until checked in. there 2 exceptions this: unreturnedconnectiontimeout close() connections out underneath clients if have been checked out long, , c3p0 invisibly test checked-out connection when exceptions occur, in order determine whether connections have experienced exceptions suitable return pool or else must destroyed on check-in.
unreturnedconnectiontimeout not parameter want. automatically closes connections when inactive period of time, permits connections checked out indefinitely. such parameter might called inactiveconnectiontimout
, , feature conceivably added c3p0, has not been. not be, because few application hold checked-out connections long periods, , c3p0 full of features observe failures once connections checked-in, or when connections transition between checked-out , checked in.
in (pretty unusual) case, means there feature not provided library. sorry that!
Comments
Post a Comment