From 0c46c2a165d0846662d7ae02c9cc18c94249268b Mon Sep 17 00:00:00 2001 From: wenshao Date: Wed, 23 Aug 2017 13:57:59 +0800 Subject: [PATCH] improved configFromProperty. --- .../alibaba/druid/pool/DruidDataSource.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/alibaba/druid/pool/DruidDataSource.java b/src/main/java/com/alibaba/druid/pool/DruidDataSource.java index 575ef3a288..612065604f 100644 --- a/src/main/java/com/alibaba/druid/pool/DruidDataSource.java +++ b/src/main/java/com/alibaba/druid/pool/DruidDataSource.java @@ -388,12 +388,34 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat if (property != null && property.length() > 0) { try { int value = Integer.parseInt(property); - super.setInitialSize(value); + this.setInitialSize(value); } catch (NumberFormatException e) { LOG.error("illegal property 'druid.initialSize'", e); } } } + { + String property = properties.getProperty("druid.minIdle"); + if (property != null && property.length() > 0) { + try { + int value = Integer.parseInt(property); + this.setMinIdle(value); + } catch (NumberFormatException e) { + LOG.error("illegal property 'druid.minIdle'", e); + } + } + } + { + String property = properties.getProperty("druid.maxActive"); + if (property != null && property.length() > 0) { + try { + int value = Integer.parseInt(property); + this.setMaxActive(value); + } catch (NumberFormatException e) { + LOG.error("illegal property 'druid.maxActive'", e); + } + } + } { Boolean value = getBoolean(properties, "druid.killWhenSocketReadTimeout"); if (value != null) {