active for ... milliseconds and has been removed automaticaly 的解决办法

由于需要调用mysql store procedure来统计数据,比较费时,超过5分钟还没有结束的时候,抛出错误如下,意思是proxool连接池把超过309594 milliseconds的连接给关了:
引用

[WARN] [org.logicalcobwebs.proxool.HouseKeeper.sweep:149] #0001 was active for 309594 milliseconds and has been removed automaticaly. The Thread responsible was named 'http-8180-2', but the last SQL it performed is unknown because the trace property is not enabled.


查了proxool属性手册,解决方法就maximum-active-time参数设长一点就行(默认是5分钟,实际上是5分钟稍多一点,没那么精确):
http://proxool.sourceforge.net/properties.html

引用

maximum-active-time:

    If the housekeeper comes across a thread that has been active for longer than this then it will kill it. So make sure you set this to a number bigger than your slowest expected response! Default is 5 minutes.


我用了spring来集成proxool,配置如下:
<bean id="dataSourceProduct"
	   class="org.logicalcobwebs.proxool.ProxoolDataSource">
		<property name="driver">
			<value>${proxool.driver}</value>
		</property>
		<property name="driverUrl">
			<value>${proxool.url.product}</value>
		</property>
		<property name="user">
			<value>${proxool.username.product}</value>
		</property>
		<property name="password">
			<value>${proxool.password.product}</value>
		</property>
		<property name="alias">
			<value>${proxool.alias.product}</value>
		</property>
		<property name="maximumActiveTime">
			<value>${proxool.maximumActiveTime}</value>
		</property>
		<property name="simultaneousBuildThrottle">
			<value>${proxool.simultaneousBuildThrottle}</value>
		</property>
		<property name="prototypeCount">
			<value>${proxool.prototypeCount}</value>
		</property>
		<property name="maximumConnectionCount">
			<value>${proxool.maximumConnectionCount}</value>
		</property>
		<property name="minimumConnectionCount">
			<value>${proxool.minimumConnectionCount}</value>
		</property>
		<property name="houseKeepingTestSql">
			<value>${proxool.houseKeepingTestSql}</value>
		</property>
		<property name="trace">
			<value>${proxool.trace}</value>
		</property>
		<property name="verbose">
			<value>${proxool.verbose}</value>
		</property>
	</bean>

你可能感兴趣的:(spring,thread,sql,.net,mysql)