数据库环境:postgresql
连接池:proxool (连接池最长激活时间:150s)
框架:spring2.5
定时作业执行
public void summary() {
result = (List) transactionTemplate.execute(new TransactionCallback() {
@Override
public Object doInTransaction(TransactionStatus status) {
return (Object)baseDAO.getHibernateSession()
.createSQLQuery("select summary();").list();
}
});
if (result != null) {
LOGGER.info("操作成功 返回:\n" + result.get(0).toString());
} else
LOGGER.error("操作失败");
}
transactionTemplate定义如下:
<bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
<property name="transactionManager" ref="transactionManager" />
</bean>
summary()是postgresql数据库函数,我手动在PGSQL里执行时间大概是1S内能执行完,但为什么作业运行一段时间后,经常出现卡在那的现像导致作业未执行完,连接池已经关闭的情况,请问是什么原因?
异常提示如下:
2012-11-23 14:34:37 WARN org.logicalcobwebs.proxool.proxool.a2 | #0014 was active for 157406 milliseconds and has been removed automaticaly. The Thread responsible was named 'QuartzScheduler_Worker-9', but the last SQL it performed is unknown because the trace property is not enabled.
2012-11-23 14:34:37 WARN org.hibernate.util.JDBCExceptionReporter | SQL Error: 0, SQLState: 08006
2012-11-23 14:34:37 ERROR org.hibernate.util.JDBCExceptionReporter | 传送数据至后端时发生 I/O 错误。
2012-11-23 14:34:37 ERROR org.hibernate.transaction.JDBCTransaction | Could not toggle autocommit
java.sql.SQLException: Couldn't perform the operation setAutoCommit: You can't perform any operations on this connection. It has been automatically closed by Proxool for some reason (see logs).
------解决方案--------------------
继续求答…………
------解决方案--------------------
作业定时运行一段时间后,经常出现这个SUMMARY存储函数执行需要2分钟以上时间,很是纳闷,继续找高手回答!
------解决方案--------------------
该回复于2012-11-26 10:07:24被管理员删除