Re: Connection Pool Timeout
От | Kris Jurka |
---|---|
Тема | Re: Connection Pool Timeout |
Дата | |
Msg-id | Pine.LNX.4.33.0401111639550.5953-100000@leary.csoft.net обсуждение исходный текст |
Ответ на | Connection Pool Timeout ("Neil Murray" <nhm@mimecast.net>) |
Ответы |
Re: Connection Pool Timeout
|
Список | pgsql-jdbc |
On Tue, 23 Dec 2003, Neil Murray wrote: > Hi, > > I connect to the DB with pg73jdbc3.jar - and I make use of > Jdbc3PoolingDataSource(). > > Using the connection pool is no problem, but there seems to be a black hole > of access at the point where the getConnection() method is called. If > getConnection is called, and no DB connections are available, then > getConnection() waits forever without throwing an exception. The API seems > to indicate that there is a timeout that can be set, but setting it has made > no difference. getConnection() still waits forever. The setLoginTimeout method is just a stub and the comment for it indicates that it is not implemented. There are two issues with its implementation. Regarding your problem that the pool is empty and it loops forever waiting for a connection to be made available, it would be a pretty simple fix to count the number of loops made and bail out once you've passed the timeout. The other problem is actually enforcing this connection timeout when creating a real connection. As far as I can see there is no means before the 1.4 jvm to put a timeout value on creating a Socket connection. Then for the whole connection and authentication process you would need to call setSoTimeout on the Socket. This would be incredibly ugly because to enfore a setLoginTimeout of 4 seconds you couldn't simply use a 4 second timeout on the socket's read and write calls because each one of many could take 3.9 seconds. You would have to continually monitor the time elapsed and keep calling setSoTimeout with the remaing time left. Kris Jurka
В списке pgsql-jdbc по дате отправления: