mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
support phyMaxUseCount
This commit is contained in:
@@ -333,6 +333,17 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
String property = properties.getProperty("druid.phyMaxUseCount");
|
||||
if (property != null && property.length() > 0) {
|
||||
try {
|
||||
long value = Long.parseLong(property);
|
||||
this.setPhyMaxUseCount(value);
|
||||
} catch (NumberFormatException e) {
|
||||
LOG.error("illegal property 'druid.phyMaxUseCount'", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
String property = properties.getProperty("druid.minEvictableIdleTimeMillis");
|
||||
if (property != null && property.length() > 0) {
|
||||
|
||||
@@ -21,6 +21,18 @@ public class DruidDataSourceTest9_phyMaxUseCount extends TestCase {
|
||||
dataSource.setUrl("jdbc:mock:xxx");
|
||||
dataSource.setInitialSize(1);
|
||||
dataSource.setPhyMaxUseCount(10);
|
||||
|
||||
assertEquals(10, dataSource.getPhyMaxUseCount());
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.put("druid.phyMaxUseCount", "20");
|
||||
dataSource.configFromPropety(properties);
|
||||
assertEquals(20, dataSource.getPhyMaxUseCount());
|
||||
|
||||
properties.put("druid.phyMaxUseCount", "10");
|
||||
dataSource.configFromPropety(properties);
|
||||
assertEquals(10, dataSource.getPhyMaxUseCount());
|
||||
|
||||
dataSource.setFilters("log4j");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user