I am trying use HikariCP JNDI DataSource Factory within Tomcat 8.5 but when it shutdown I'm getting these warning:
o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [HikariPool-1 housekeeper] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
My Hiraki configuration was setup following the JNDI DataSource Factory (Tomcat, etc.) document, and is something like this:
<Resource name="******" auth="Container"
factory="com.zaxxer.hikari.HikariJNDIFactory"
type="javax.sql.DataSource"
minimumIdle="5"
maximumPoolSize="10"
connectionTimeout="300000"
driverClassName="org.postgresql.Driver"
jdbcUrl="jdbc:postgresql://******"
dataSource.implicitCachingEnabled="true"
dataSource.user="******"
dataSource.password="******" />
I've found this link but it doesn't help because I'm using Hiraki as a resource inside Tomcat.
I'm using Tomcat 8.5 HikariCP 2.5.1
Any help? Thanks.
All you need to add is this at the end of your Resource:
closeMethod="close"/>