http://zmfkplj.iteye.com/blog/220822
The program appears a strange phenomenon, with quartz job scheduling start task, after running for a period of time, the task will be stuck in a query interface, long can not run finished. I instinctively discovered that the number of database connection pools is not enough? So I added the size of the connection pool. However, the problem still arises. At this point, I can only use Debug+log to debug. Debugging found that when the query interface to perform the stuck phenomenon, the program connection pool is really not enough, but the other tasks have been run out of time, beginning and end, when the previous task runs out, it occupies the connection should be released Ah, so the connection will not exist enough AH. The Epiphany is that the connection is released with problems. Now the database connection is given to hibernate management, before the hibernate environment is another developer configuration, no problem before, not much attention. Now there is no way, to look at the configuration. After reading the spring configuration, there is a problem. Now configure the connection release mode is On_close, set it to auto after the good. <Bean class=
"Org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" ID=
"Localhost_oracle"> < Propertyname=
"DataSource" ref=
"Localhost_oracleds"/> < Propertyname=
"Persistenceunitname"value=
"Localhost_oracle"/> < Property name=
"Jpavendoradapter"ref=
"Localhost_oraclejpavendoradapter"/> < Propertyname=
"Jpapropertymap"> <Map> <entryKey=
"Hibernate.transaction.manager_lookup_class" value=
"Com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup"/><!--<entry key= "Hibernate.connection.release_mode" value= "On_close"/>--> <entryKey=
"Hibernate.connection.release_mode"value=
"Auto"/> </Map> </ Property> </Bean> I think on_close means that when the thread that is currently using the connection shows that the thread has died off or has finished running, the connection is freed. Connection Release configuration:
<property name= "Hibernate.connection.release_mode" >auto</property>More articles: Questions about Hibernate connection pooling not enough-http://zmfkplj.iteye.com/blog/220822
Configure connection Release mode when Spring integrates hibernate