-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sinoea,

Oh, and I always always /always/ set my connection pool size to a fixed
 size of 1 (yes, a single connection) in development. This can help find
places where you are requesting two connections from the pool by a
single thread, which exposes you to a deadlock scenario.

If you want to test if your logAbandoned logging is working, here's a
simple JSP that will leak a connection for you ;)

- -chris

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<[EMAIL PROTECTED] language="Java"
    isErrorPage="false"
    import="
        java.sql.*,
        java.util.*,
        java.io.PrintWriter,
        javax.naming.Context,
        javax.naming.InitialContext,
        javax.naming.NamingException,
        javax.sql.DataSource
    "
%>
<%!
    /**
     * Gets a JDBC connection. This implementation uses JNDI to obtain a
     * connection. Feel free to substitute your own.
     */
    Connection getConnection()
       throws SQLException, javax.naming.NamingException
    {
        Context ctx = new InitialContext();

        DataSource ds = (DataSource)ctx.lookup("(your JNDI name)");

        if(null == ds)
            throw new NamingException("Cannot obtain DataSource");

        return ds.getConnection();
    }
%>
<%
    Connection conn = getConnection();
%>
<html>
<body>
<p>Got connection: <%= conn %></p>

<p>Now, I refuse to give it away!</p>
</body>
</html>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjReDoACgkQ9CaO5/Lv0PC/FwCfZPybusC0jzBeKYoD93xMyTbI
3XUAn1HUJWUjrfoZipIVXubV7MqPYPB/
=qfKA
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to