HikariCP连接已关闭

时间:2019-02-28 11:59:57

标签: java hikaricp

大约24-48小时后,我开始得到:

java.sql.SQLException: Connection is closed
    at com.zaxxer.hikari.pool.ProxyConnection$ClosedConnection.lambda$getClosedConnection$0(ProxyConnection.java:466)
    at com.sun.proxy.$Proxy14.prepareStatement(Unknown Source)
    at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:311)
    at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
    at com.wingify.pushcrew.utils.MysqlUtils.updatePushStatus(MysqlUtils.java:141)
    at com.wingify.pushcrew.threads.PushStatusConsumer.run(PushStatusConsumer.java:82)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

这是我的HikariCP配置:

        config.setJdbcUrl(DeploymentProfileProvider.getDatabaseProperties().getProperty("mysql.url"));           config.setUsername(DeploymentProfileProvider.getDatabaseProperties().getProperty("mysql.username"));          config.setPassword(DeploymentProfileProvider.getDatabaseProperties().getProperty("mysql.password"));             config.setHealthCheckRegistry(ApplicationUtils.getHealthCheckRegistry());
config.setDriverClassName(DeploymentProfileProvider.getDatabaseProperties().getProperty("mysql.driver"));
            config.setMetricRegistry(ApplicationUtils.getMetricRegistry());
            config.addDataSourceProperty("autoReconnect", true);
            config.setMaximumPoolSize(40);
            config.setConnectionTimeout(30000);
            config.setLeakDetectionThreshold(60 * 1000);
            config.setIdleTimeout(90000);
            config.setMaxLifetime(123000);
            config.setValidationTimeout(5000);
            config.setInitializationFailTimeout(0);

,一旦发生,我们会不断将其恢复,直到启动应用程序后它才会停止吗?解决此问题的理想和非理想方法是什么?最低限度是不让应用程序受到影响。

0 个答案:

没有答案