2
我正在使用帶有Mysql數據庫服務器的dropwizard。此服務器的最大連接值設置爲32,對於每次訪問,活動連接的數量都會增加,一旦達到32,我會得到一個PoolExhaustedException。DropWizard服務器中的PoolExhaustedException
請注意,我只在需要時打開和關閉會話並僅創建連接一次。另外下面是一些DB配置在我的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
不知道怎麼回事O,但應autorecoonect是假的?或者是否有配置來殺死連接池中的連接?