DataSourceProvider: Validate connection
So far, when sending a request to the database, it was possible to try to reuse an already closed connection which resulted in a 500 error. Validate connections are still valid when they are borrowed and returned to the connection pool. Change-Id: I3376c872f6183ff7392ca2c8e354ed71a481ce0f
This commit is contained in:
@@ -141,6 +141,8 @@ public class DataSourceProvider implements Provider<DataSource>, LifecycleListen
|
||||
long evictIdleTimeMs = 1000L * 60;
|
||||
ds.setMinEvictableIdleTimeMillis(evictIdleTimeMs);
|
||||
ds.setTimeBetweenEvictionRunsMillis(evictIdleTimeMs / 2);
|
||||
ds.setTestOnBorrow(true);
|
||||
ds.setTestOnReturn(true);
|
||||
ds.setValidationQuery(dst.getValidationQuery());
|
||||
ds.setValidationQueryTimeout(5);
|
||||
exportPoolMetrics(ds);
|
||||
|
||||
Reference in New Issue
Block a user