简体   繁体   English

如何在 QuartzScheduler 中为 Spring 框架配置 idleWaitTime 环境变量

[英]How to configure idleWaitTime Environment Variable in QuartzScheduler for Spring Framework

I currently am using a third party application that uses the spring framework and am trying to troubleshoot an issue where something in the spring framework keeps recreating a connection every 30 seconds to a serverless postgres database in AWS.我目前正在使用使用 spring 框架的第三方应用程序,并试图解决一个问题,即 spring 框架中的某些内容每 30 秒不断重新创建与 AWS 中的无服务器 postgres 数据库的连接。 I am using a Hikari datasource that has been configured with the following environment variables:我正在使用配置了以下环境变量的 Hikari 数据源:

DATASOURCE_MINIMUMIDLE=0
DATASOURCE_IDLETIMEOUT=30000
DATASOURCE_MAXLIFETIME=60000

I have confirmed these settings are modifying the hikari pool as expected.我已经确认这些设置正在按预期修改 hikari 池。

Investigating the issue, I found that Quartz is scheduling a query every 30 seconds or so.调查这个问题,我发现 Quartz 每 30 秒左右安排一次查询。 I've tried setting the env var to control the idle timeout for the main scheduler loop:我已经尝试设置 env var 来控制主调度程序循环的空闲超时:

https://github.com/quartz-scheduler/quartz/blob/9f9e400733f51f7cb658e3319fc2c140ab8af938/quartz-core/src/main/java/org/quartz/core/QuartzSchedulerThread.java#L244 https://github.com/quartz-scheduler/quartz/blob/9f9e400733f51f7cb658e3319fc2c140ab8af938/quartz-core/src/main/java/org/quartz/core/QuartzSchedulerThread.java#L244

Either the env var I'm trying to set to control the idleWaitTime is incorrect or something else is going on.我试图设置以控制 idleWaitTime 的 env var 不正确,或者正在发生其他事情。

Does anyone have experience controlling the quartz idleWaitTime with the environment variables?有没有人有使用环境变量控制石英 idleWaitTime 的经验?

I've tried SPRING_QUARTZ_PROPERTIES_ORG_QUARTZ_SCHEDULER_IDLEWAITTIME, but that does not seem to have any effect.我试过 SPRING_QUARTZ_PROPERTIES_ORG_QUARTZ_SCHEDULER_IDLEWAITTIME,但这似乎没有任何效果。

我通过使用以下设置 SPRING_APPLICATION_JSON 环境变量解决了这个问题: "{\\"spring\\":{\\"application\\":{\\"quartz\\":{\\"org.quartz.scheduler.idleWaitTime\\":\\"600000\\"}}}}"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Spring中设置环境变量 - How to set the Environment variable in Spring Spring如何用环境变量替换$ {}? - How Spring replacing the ${} with environment variable? 如何使用环境变量配置 EncryptablePropertyPlaceholderConfigurer (jasypt) - How configure EncryptablePropertyPlaceholderConfigurer (jasypt) with environment variable 如何在Spring Framework 2.0中配置ResourceBundleViewResolver - How to configure ResourceBundleViewResolver in Spring Framework 2.0 如何在Spring applicationContext中读取系统环境变量 - how to read System environment variable in Spring applicationContext 如何在非 Web Spring 环境中自动配置 ConversionService? - How to auto-configure ConversionService in non-web Spring environment? 如何在没有location配置属性的情况下配置Spring Java环境? - How to configure the Spring java environment without the locations configuration property? 如何在春季测试中动态设置环境变量 - How to set environment variable dynamically in spring test 如何在 Spring Boot 属性中使用环境变量 - how to use environment variable in spring boot properties 如何使用带有不同配置文件的Spring Framework配置log4j - How to configure log4j with Spring Framework with different configuration files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM