Not seeing BoneCP shutdown() with Hibernate, Spring, Bonecp -
i implementing application spring, hibernate , bonecp. when invoke shutdown script of tomcat see errors this
the web application [/rest] appears have started thread named [bonecp-release-thread-helper-thread] has failed stop it. create memory leak.
when see logs, not seeing "shutting down connection pool...", assuming missing on here.
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:sws="http://www.springframework.org/schema/web-services" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-1.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd" xmlns:context="http://www.springframework.org/schema/context"> <bean id="lookupservice" class="com.appserver.rest.lookupservice"> <property name="usermanager" ref="usermanager"></property> <property name="groupmanager" ref="groupmanager"></property> <property name="messagemanager" ref="messagemanager"></property> <property name="tokenmanager" ref="tokenmanager"></property> <property name="accessmanager" ref="accessmanager"></property> <property name="rostermanager" ref="rostermanager"></property> </bean> <bean id="lookupservicev2" class="com.appserver.rest.lookupservicev2" parent="lookupservice"> </bean> <bean id="usermanager" class="com.appserver.rest.usermanager"> <constructor-arg index="0"> <ref bean="authmanager" /> </constructor-arg> </bean> <bean id="groupmanager" class="com.appserver.rest.groupmanager"> <constructor-arg index="0"> <ref bean="authmanager" /> </constructor-arg> </bean> <bean id="messagemanager" class="com.appserver.rest.messagemanager"> </bean> <bean id="tokenmanager" class="com.appserver.rest.tokenmanager"> <constructor-arg index="0"> <ref bean="securerandom" /> </constructor-arg> </bean> <bean id="authmanager" class="com.appserver.rest.authenticationmanager"> <constructor-arg index="0"> <ref bean="securerandom" /> </constructor-arg> </bean> <bean id="accessmanager" class="com.appserver.rest.accessmanager"> </bean> <bean id="rostermanager" class="com.appserver.rest.rostermanager"> </bean> <bean id="securerandom" class="java.security.securerandom"> </bean> <bean id="messagedeletescheduler" class="com.appserver.schema.messagedeletescheduler" /> <bean id="messagedeletejob" class="org.springframework.scheduling.quartz.methodinvokingjobdetailfactorybean"> <property name="targetobject" ref="messagedeletescheduler" /> <property name="targetmethod" value="schedulemessagedeletion" /> </bean> <bean id="messagedeletetrigger" class="org.springframework.scheduling.quartz.simpletriggerbean"> <property name="jobdetail" ref="messagedeletejob" /> <property name="repeatinterval" value="3600000" /> <property name="startdelay" value="1000" /> </bean> <bean id="quartz" class="org.springframework.scheduling.quartz.schedulerfactorybean" destroy-method="destroy" > <property name="jobdetails"> <list> <ref bean="messagedeletejob" /> </list> </property> <property name="triggers"> <list> <ref bean="messagedeletetrigger" /> </list> </property> </bean> <bean id="sessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean" autowire="autodetect"> <property name="datasource" ref="datasource" /> <property name="annotatedclasses"> <list> <value>com.appserver.schema.groupdb</value> <value>com.appserver.schema.userdb</value> <value>com.appserver.schema.messagedb</value> <value>com.appserver.schema.userblockdb</value> <value>com.appserver.schema.groupusermapperdb</value> </list> </property> <property name="hibernateproperties"> <props> <!-- <prop key="hibernate.connection.provider_class">com.jolbox.bonecp.provider.bonecpconnectionprovider</prop> --> <!-- <prop key="hibernate.connection.driver_class">com.mysql.jdbc.driver</prop> <prop key="hibernate.connection.url">jdbc:mysql://localhost/testdb</prop> <prop key="hibernate.connection.username">alpha1</prop> <prop key="hibernate.connection.password">r0cktheworld</prop> <prop key="hibernate.connection.pool_size">50</prop> --> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.dialect">org.hibernate.dialect.mysql5innodbdialect</prop> <prop key="hibernate.current_session_context_class">thread</prop> <prop key="hibernate.globally_quoted_identifiers">true</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.ehcacheprovider</prop> <!-- <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.ehcacheregionfactory</prop> --> <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.singletonehcacheregionfactory </prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_structured_entries">true</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop> <!-- connection provider --> <!-- , how configure --> <prop key="jadira.usertype.autoregisterusertypes">true</prop> <prop key="jadira.usertype.databasezone">jvm</prop> <prop key="jadira.usertype.javazone">jvm</prop> </props> </property> </bean> <!-- spring bean configuration. tell spring bounce off bonecp --> <bean id="datasource" class="org.springframework.jdbc.datasource.lazyconnectiondatasourceproxy"> <property name="targetdatasource"> <ref local="maindatasource" /> </property> </bean> <bean id="maindatasource" class="com.jolbox.bonecp.bonecpdatasource" destroy-method="close"> <property name="driverclass" value="com.mysql.jdbc.driver" /> <property name="jdbcurl" value="jdbc:mysql://localhost/dbrocker" /> <property name="username" value="root"/> <property name="password" value="root123"/> <property name="idleconnectiontestperiod" value="60"/> <property name="idlemaxage" value="240"/> <property name="maxconnectionsperpartition" value="60"/> <property name="minconnectionsperpartition" value="20"/> <property name="partitioncount" value="3"/> <property name="acquireincrement" value="10"/> <property name="statementscachesize" value="50"/> <property name="releasehelperthreads" value="3"/> </bean> <context:annotation-config/>
thanks
this known issue. see https://code.google.com/p/guava-libraries/issues/detail?id=92. try using snapshot version of bonecp-0.8.0-rc2 contains 14.0.1 version of guava has fixes guava finalizer thread not closed.
you can grab snapshot here -> https://oss.sonatype.org/content/repositories/snapshots/com/jolbox/bonecp/0.8.0-rc2-snapshot/
Comments
Post a Comment