Philip,

On 8/17/15 12:27 PM, Wernersbach, Philip wrote:
> We are developing a JDBC driver that implements the JDBC API. Our
> driver works and we can use it in servlets, but Tomcat doesn’t seem
> to know that the connections in the thread pool can be reused, so
> after all of the connection slots in the thread pool are used, the
> servlets hang trying to get a connection.

If you set maxTotal="1", you get a timeout when you try to fetch a
second connection? Are you sure the servlet called Connection.close()?

What does the stack trace of the request-processing thread look like
when it's hung up?

> What API does the Tomcat DataSource Connection thread pool use to
> know a connection can be reused? This is an API question, but our
> specific version of Tomcat is 8.0.24.

Are you using DBCP2 (the default) or Tomcat's jdbc-pool?

Do you mean to check to see if a connection is valid for re-use?

I think the answer for /both/ is that they use this call:

  Connection.isValid(int timeout)

What version of JDBC are you implementing? It seems that Java 6 is when
the Connection.isValid method was added.

Or did you mean to check to see if a connection can be re-used *at all*
-- meaning, can the connection even really be used in a pool?

What does your <Resource> element look like in context.xml?

-chris

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to