Answer the question
In order to leave comments, you need to log in
How to properly close UCP connection pool in Tomcat 9 (oracle.jdbc.driver.BlockSource.ThreadedCachingBlockSource.BlockReleaser)?
CATALINA_HOME/lib contains the ucp and ojdbc7 libraries for working with the database.
Each WARka (project) that is in webapps works with these libraries.
I connect them to projects via Gradle:
dependencies {
providedCompile ':ojdbc7'
providedCompile ':ucp'
..............
}
Through StoredProcedure(JDBCTemplate) I access stored procedures in the database in projects.
I create dataSource through a bean:
<bean id="dataSource" class=".............PoolDataSourceSpringImpl" destroy-method="destroy">
<property name="connectionFactoryClassName" value="${ORACLE_CONNECTION_FACTORY_CLASS_NAME}"/>
<property name="URL" value="${ORACLE_URL}"/>
<property name="user" value="${ORACLE_USER}"/>
<property name="password" value="${ORACLE_PASSWORD}"/>
<property name="connectionPoolName" value="${ORACLE_POOL_NAME}"/>
<property name="initialPoolSize" value="${ORACLE_INITIAL_POOL_SIZE}"/>
<property name="minPoolSize" value="${ORACLE_MIN_POOL_SIZE}"/>
<property name="maxPoolSize" value="${ORACLE_MAX_POOL_SIZE}"/>
<property name="connectionWaitTimeout" value="${ORACLE_CONNECTION_WAIT_TIMEOUT}"/>
<property name="abandonedConnectionTimeout" value="${ORACLE_ABANDONED_CONNECTION_TIMEOUT}"/>
<property name="timeToLiveConnectionTimeout" value="${ORACLE_TIME_TO_LIVE_CONNECTION_TIMEOUT}"/>
<property name="inactiveConnectionTimeout" value="${ORACLE_INACTIVE_CONNECTION_TIMEOUT}"/>
<property name="validateConnectionOnBorrow" value="${ORACLE_VALIDATE_CONNECTION_ON_BORROW}"/>
</bean>
28-Jun-2018 16:23:36.867 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/9.0.5
28-Jun-2018 16:23:36.869 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Feb 6 2018 21:42:23 UTC
28-Jun-2018 16:23:36.869 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 9.0.5.0
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 7
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 6.1
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: x86
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files (x86)\Java\jdk1.8.0_121\jre
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_121-b13
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: D:\tomcatDeployService
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\tomcatDeployService
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\tomcatDeployService
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=D:\tomcatDeployService
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=D:\tomcatDeployService\endorsed
28-Jun-2018 16:23:36.870 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\tomcatDeployService\temp
28-Jun-2018 16:23:36.871 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
28-Jun-2018 16:23:36.871 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=D:\tomcatDeployService\conf\logging.properties
28-Jun-2018 16:23:36.872 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: exit
28-Jun-2018 16:23:36.872 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: abort
28-Jun-2018 16:23:36.872 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m
28-Jun-2018 16:23:36.873 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx256m
28-Jun-2018 16:23:37.007 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["https-jsse-nio-172.20.50.38-8443"]
28-Jun-2018 16:23:37.250 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
28-Jun-2018 16:23:37.256 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 656 ms
28-Jun-2018 16:23:37.268 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
28-Jun-2018 16:23:37.268 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/9.0.5
28-Jun-2018 16:23:37.317 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [D:\tomcatDeployService\webapps\test.war]
28-Jun-2018 16:23:41.015 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [D:\tomcatDeployService\webapps\test.war] has finished in [3,698] ms
28-Jun-2018 16:23:41.016 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\tomcatDeployService\webapps\ROOT]
28-Jun-2018 16:23:43.382 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\tomcatDeployService\webapps\ROOT] has finished in [2,366] ms
28-Jun-2018 16:23:43.384 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["https-jsse-nio-172.20.50.38-8443"]
28-Jun-2018 16:23:43.395 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 6139 ms
28-Jun-2018 16:23:46.929 INFO [Thread-10] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["https-jsse-nio-172.20.50.38-8443"]
28-Jun-2018 16:23:46.981 INFO [Thread-10] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
28-Jun-2018 16:23:47.031 WARNING [Thread-10] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [test] appears to have started a thread named [oracle.jdbc.driver.BlockSource.ThreadedCachingBlockSource.BlockReleaser] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaser.run(BlockSource.java:327)
28-Jun-2018 16:23:47.033 INFO [Thread-10] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["https-jsse-nio-172.20.50.38-8443"]
public class PoolDataSourceSpringImpl extends PoolDataSourceImpl
{
public void destroy() throws UniversalConnectionPoolException, InterruptedException {
String poolName=getConnectionPoolName();
UniversalConnectionPoolManager mgr= UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager();
mgr.stopConnectionPool(poolName);
mgr.destroyConnectionPool(poolName);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question