aboutsummaryrefslogtreecommitdiffstats
path: root/dblib
diff options
context:
space:
mode:
Diffstat (limited to 'dblib')
-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 0f1674f9..bc466d93 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 85acd272..9d797d09 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);
}