You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2013/02/19 22:23:42 UTC
[Bug 53905] Connection pool not reusing connections.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53905
Daniel Mikusa <dm...@vmware.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
--- Comment #1 from Daniel Mikusa <dm...@vmware.com> ---
The behavior you are seeing might be caused because you are storing a reference
to the Connection and Statement objects at the class level on the Servlet
object.
Only *one* Servlet is used to process all incoming requests, so this isn't
thread safe. Each request will result in a new Connection being created and it
could possibly overwrite a previous connection before it is closed properly.
...
public class TestServlet extends HttpServlet {
private DataSource dataSource;
private Connection connection;
private Statement statement;
public void init() throws ServletException {
...
Instead put Connection and Statement inside of "doGet".
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org