【问题标题】:PoolExhaustedException in Dropwizard serverDropwizard 服务器中的 PoolExhaustedException
【发布时间】:2015-07-31 07:58:06
【问题描述】:

我正在使用带有 Mysql 数据库服务器的 dropwizard。此服务器的最大连接值设置为 32,每次获取活动连接的数量都会增加,一旦达到 32,我会收到 PoolExhaustedException。

请注意,我只在需要时打开和关闭会话,并且只创建一次连接。以下是我的 yaml 中的一些数据库配置

database:
 # the name of your JDBC driver
 driverClass: com.mysql.jdbc.Driver

  # the username
 user: root

 # the JDBC URL
  url: jdbc:mysql://localhost:3306/deploys?autoReconnect=true?

   # any properties specific to your JDBC driver:
   properties:
   charSet: UTF-8
   hibernate.dialect: org.hibernate.dialect.MySQLDialect
   hibernate.hbm2ddl.auto: update
   hibernate.show_sql: true

   # the maximum amount of time to wait on an empty pool before throwing an    exception
  maxWaitForConnection: 1s

  # the SQL query to run when validating a connection's liveness
  validationQuery: "/* MyApplication Health Check */ SELECT 1"

  # the minimum number of connections to keep open
  minSize: 8

  # the maximum number of connections to keep open
  maxSize: 32

  # whether or not idle connections should be validated
  checkConnectionWhileIdle: false

  #Whether or not connections will be validated before being borrowed from   the pool. If the connection fails to validate, it will be dropped from the pool, and another will be borrowed.
  checkConnectionOnBorrow: true

不确定发生了什么,但 autorecoonect 是否应该为假?或者是否有一个配置可以杀死连接池中的放弃连接?

【问题讨论】:

    标签: mysql connection dropwizard pool reconnect


    【解决方案1】:

    尝试增加maxWaitForConnection 的值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多