Database Pool Interceptors

uPortal uses JDBC Pool implementation from Tomcat. It is configured in uportal-war/src/main/resources/properties/contexts/datasourceContext.xml. This implementation supports configuration of various interceptors.

Two interceptors are used configured by default. Those are Connection State and Reset Abandoned Timer.

datasourceContext.xml
 
<!--  base pooled datasource with common configuration -->
<bean id="basePooledDataSource" class="org.jasig.portlet.utils.jdbc.TomcatDataSourceFactory" abstract="true">
   <property name="baseObjectName" value="uPortal:section=DataSource,name=" />
    <property name="mBeanServer" ref="mbeanServer" />
  
    <property name="initialSize" value="1" />
    <property name="minIdle" value="1" />
    <property name="maxActive" value="100" />
    <property name="maxIdle" value="50" />
    <property name="maxWait" value="5000" /> <!-- 5 seconds -->
    <property name="maxAge" value="3600000" /> <!-- 1 hour -->
    <property name="minEvictableIdleTimeMillis" value="300000" /> <!-- 5 minutes -->
    
    <property name="abandonWhenPercentageFull" value="70" />
    <property name="removeAbandoned" value="true" />
    <property name="removeAbandonedTimeout" value="300" />
    
    <property name="jdbcInterceptors" value="ConnectionState(useEquals=true);ResetAbandonedTimer"/>
    
    <property name="testWhileIdle" value="true" />
    <property name="testOnBorrow" value="true" />
    <property name="delayedValidationQueryResolver" ref="delayedValidationQueryResolver" />
</bean>

A very useful interceptor is one that logs slow SQL queries as warnings. To add this interceptor to uPortal, change 'jdbcInterceptors' properties.

jdbcInterceptors
    <property name="jdbcInterceptors" value="ConnectionState(useEquals=true);ResetAbandonedTimer;SlowQueryReport"/>

 

See https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html for more options.