summaryrefslogtreecommitdiffstats
path: root/dblib/provider/src
diff options
context:
space:
mode:
Diffstat (limited to 'dblib/provider/src')
-rwxr-xr-xdblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java6
-rwxr-xr-xdblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java39
2 files changed, 24 insertions, 21 deletions
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java
index 5f0209b67..967059a31 100755
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java
@@ -209,7 +209,7 @@ public abstract class BaseDBConfiguration {
* <code>Integer</code>.
*/
public int getDbMinLimit() throws NumberFormatException {
- String value = properties.getProperty(MIN_LIMIT);
+ String value = properties.getProperty(MIN_LIMIT, "-1");
return Integer.parseInt(value);
}
@@ -222,7 +222,7 @@ public abstract class BaseDBConfiguration {
* <code>Integer</code>.
*/
public int getDbMaxLimit() throws NumberFormatException {
- String value = properties.getProperty(MAX_LIMIT);
+ String value = properties.getProperty(MAX_LIMIT, "-1");
return Integer.parseInt(value);
}
@@ -235,7 +235,7 @@ public abstract class BaseDBConfiguration {
* <code>Integer</code>.
*/
public int getDbInitialLimit() throws NumberFormatException {
- String value = properties.getProperty(INIT_LIMIT);
+ String value = properties.getProperty(INIT_LIMIT, "-1");
return Integer.parseInt(value);
}
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java
index 80ca577cf..09c1c202b 100755
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java
@@ -42,6 +42,9 @@ public class JdbcDBCachedDataSource extends CachedDataSource {
private int initialLimit;
private static final String AS_CONF_ERROR = "AS_CONF_ERROR: ";
+ private static final int MIN_LIMIT = 5;
+ private static final int MAX_LIMIT = 10;
+ private static final int INITIAL_LIMIT = 10;
private static final Logger LOGGER = LoggerFactory.getLogger(JdbcDBCachedDataSource.class);
@@ -88,26 +91,26 @@ public class JdbcDBCachedDataSource extends CachedDataSource {
}
minLimit = jdbcConfig.getDbMinLimit();
-// if (minLimit == null)
-// {
-// String errorMsg = "Invalid XML contents: JDBC Connection missing minLimit attribute";
-// LOGGER.error(AS_CONF_ERROR + errorMsg);
-// throw new DBConfigException(errorMsg);
-// }
+ if (minLimit == -1)
+ {
+ String errorMsg = "Invalid XML contents: JDBC Connection missing minLimit attribute";
+ LOGGER.error(AS_CONF_ERROR + errorMsg);
+ minLimit = MIN_LIMIT;
+ }
maxLimit = jdbcConfig.getDbMaxLimit();
-// if (maxLimit == null)
-// {
-// String errorMsg = "Invalid XML contents: JDBC Connection missing maxLimit attribute";
-// LOGGER.error(AS_CONF_ERROR + errorMsg);
-// throw new DBConfigException(errorMsg);
-// }
+ if (maxLimit == -1)
+ {
+ String errorMsg = "Invalid XML contents: JDBC Connection missing maxLimit attribute";
+ LOGGER.error(AS_CONF_ERROR + errorMsg);
+ maxLimit = MAX_LIMIT;
+ }
initialLimit = jdbcConfig.getDbInitialLimit();
-// if (initialLimit == null)
-// {
-// String errorMsg = "Invalid XML contents: JDBC Connection missing initialLimit attribute";
-// LOGGER.error(AS_CONF_ERROR + errorMsg);
-// throw new DBConfigException(errorMsg);
-// }
+ if (initialLimit == -1)
+ {
+ String errorMsg = "Invalid XML contents: JDBC Connection missing initialLimit attribute";
+ LOGGER.error(AS_CONF_ERROR + errorMsg);
+ initialLimit = INITIAL_LIMIT;
+ }
dbUrl = jdbcConfig.getDbUrl();
if (dbUrl == null) {