Thanks, Keiichi. 2015-12-18 3:21 GMT-03:00 Keiichi Fujino <kfuj...@apache.org>:
> 2015-12-17 22:25 GMT+09:00 Robert Anderson <ranom...@gmail.com>: > > > Hi, > > > > When a connection is closed by "ResetAbandoned" the invoke() method from > > JdbcInterceptor is not called. Is it the expected behaviour? > > > > > Yes. > > The JdbcInterceptor.invoke() method is not called when removeAbandoned. > The Connection(PooledConnection) is directly released without going through > the JdbcInterceptors. > (see PooledConnection.release()) > > If you want to capture the close of the connection, > you can use JdbcInterceptor.disconnected or reset (null, null). > > > > > > -->server.xml > > > > <Resource name="jdbc/cacheapp" auth="Container" > > type="javax.sql.DataSource" removeAbandoned="true" > > removeAbandonedTimeout="30" > > maxActive="5" maxIdle="1" > > initialSize="0" minIdle="0" maxWait="5000" > > validationQuery="select 1" > > maxAge="1" > > testOnBorrow="true" > > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > > alternateUsernameAllowed="true" > > jdbcInterceptors="pool.ExampleInterceptor" > > username="tomcat" password="example" > > driverClassName="com.intersys.jdbc.CacheDriver" > > url="jdbc:Cache://serverip:1972/NS"/> > > > > --> pool.ExampleInterceptor > > > > public class ExampleInterceptor extends JdbcInterceptor { > > > > > > public Object invoke(Object proxy, Method method, Object[] args) > throws > > Throwable { > > if (method.getName() == CLOSE_VAL) { > > System.out.println("Interceptor called."); //Doesn't happen > but > > connection is really closed (checked via JMX) > > } > > return super.invoke(proxy, method, args); > > } > > > > --> JSP to simulate long running query > > > > <%@ page session="false" import="java.sql.*,javax.naming.*, javax.sql.*, > > java.util.*" contentType="text/html" %><% > > Connection conn = null; > > try { > > Context ctx = new InitialContext(); > > DataSource ds = > > (DataSource)ctx.lookup("java:comp/env/jdbc/cacheapp"); > > conn = ds.getConnection(); > > Thread.sleep(60000); > > } catch (Exception e) { > > out.print(e.getMessage()); > > } finally { > > if (conn != null) { > > try { > > //conn.close(); //Don't close to force > > RemovedAbandonedTimeout > > } catch (Exception e) {} > > } > > } > > %> > > > > > > Server version: Apache Tomcat/7.0.65 > > Server built: Oct 9 2015 08:36:58 UTC > > Server number: 7.0.65.0 > > OS Name: Linux > > OS Version: 2.6.18-194.32.1.el5 > > Architecture: amd64 > > JVM Version: 1.7.0_80-b15 > > JVM Vendor: Oracle Corporation > > > > Thanks in advance. > > > > P.S: Sorry, the subject was wrong. > > > > -- > > Keiichi.Fujino > > >