summaryrefslogtreecommitdiffstats
path: root/dblib/provider
diff options
context:
space:
mode:
authorRich Tabedzki <richard.tabedzki@att.com>2019-01-08 12:21:23 -0500
committerRich Tabedzki <richard.tabedzki@att.com>2019-01-08 12:22:05 -0500
commit742aa5d00edbb6bee2ed6c2e710a1f5203305354 (patch)
tree7f8549fafef951e1c158f4f5dfad276fcc92a4d9 /dblib/provider
parentc62fdd3be263bdb4543aba980780df642af67313 (diff)
Fix sonar issues in ccsdk-sli-core
Changes made: * Updated message template handling in CachedDataSource Change-Id: I9a082753d80f790b77448a5b3de957b404d737fb Issue-ID: CCSDK-647 Signed-off-by: Rich Tabedzki <richard.tabedzki@att.com>
Diffstat (limited to 'dblib/provider')
-rwxr-xr-xdblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java18
-rwxr-xr-xdblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java3
2 files changed, 10 insertions, 11 deletions
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java
index 0f1674f90..bc466d931 100755
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java
@@ -59,10 +59,11 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
private static final Logger LOGGER = LoggerFactory.getLogger(CachedDataSource.class);
private static final String SQL_FAILURE = "SQL FAILURE. time(ms): ";
- private static final String FAILED_TO_EXECUTE = "> Failed to execute: ";
+ private static final String FAILED_TO_EXECUTE = "> failed to execute: ";
private static final String WITH_ARGUMENTS = " with arguments: ";
private static final String WITH_NO_ARGUMENTS = " with no arguments. ";
- private static final String SQL_DATA_SOURCE = "SQL DataSource <";
+ private static final String DATA_SOURCE_CONNECT_SUCCESS = "SQL DataSource < {} > connected to {}, read-only is {}, tested successfully";
+ private static final String DATA_SOURCE_CONNECT_FAILURE = "SQL DataSource < {} > test failed. Cause : {}> test failed. Cause : {}";
protected long connReqTimeout = 30L;
protected long dataReqTimeout = 100L;
@@ -356,17 +357,14 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
hostname = rs.getString(2);
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(SQL_DATA_SOURCE + getDbConnectionName() + "> connected to " + hostname
- + ", read-only is " + readOnly + ", tested successfully ");
+ LOGGER.debug(DATA_SOURCE_CONNECT_SUCCESS,getDbConnectionName(),hostname,readOnly);
}
}
} catch (Exception exc) {
if (errorLevel) {
- LOGGER.error(
- SQL_DATA_SOURCE + this.getDbConnectionName() + "> test failed. Cause : " + exc.getMessage());
+ LOGGER.error(DATA_SOURCE_CONNECT_FAILURE, this.getDbConnectionName(),exc.getMessage());
} else {
- LOGGER.info(
- SQL_DATA_SOURCE + this.getDbConnectionName() + "> test failed. Cause : " + exc.getMessage());
+ LOGGER.info(DATA_SOURCE_CONNECT_FAILURE, this.getDbConnectionName(),exc.getMessage());
}
return false;
} finally {
@@ -489,9 +487,9 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
isSlave = true;
}
if (isSlave) {
- LOGGER.debug("SQL SLAVE : {} on server {}, pool {}", connectionName, getDbConnectionName(), getAvailableConnections());
+ LOGGER.debug("SQL SLAVE : {} on server {}, pool {}", connectionName, hostname, getAvailableConnections());
} else {
- LOGGER.debug("SQL MASTER : {} on server {}, pool {}", connectionName, getDbConnectionName(), getAvailableConnections());
+ LOGGER.debug("SQL MASTER : {} on server {}, pool {}", connectionName, hostname, getAvailableConnections());
}
return isSlave;
}
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java
index 85acd272b..9d797d096 100755
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java
@@ -50,6 +50,7 @@ import javax.sql.rowset.CachedRowSet;
import org.apache.tomcat.jdbc.pool.PoolExhaustedException;
import org.onap.ccsdk.sli.core.dblib.config.DbConfigPool;
import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration;
+import org.onap.ccsdk.sli.core.dblib.config.TerminatingConfiguration;
import org.onap.ccsdk.sli.core.dblib.factory.DBConfigFactory;
import org.onap.ccsdk.sli.core.dblib.pm.PollingWorker;
import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor;
@@ -755,7 +756,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
if(broken != null)
{
try {
- broken.add( new TerminatingCachedDataSource(null));
+ broken.add( new TerminatingCachedDataSource(new TerminatingConfiguration()));
} catch(Exception exc){
LOGGER.error("Waiting for Worker to stop", exc);
}