summaryrefslogtreecommitdiffstats
path: root/dblib/provider/src/main
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-12-05 16:29:35 +0530
committerSandeep J <sandeejh@in.ibm.com>2018-12-05 16:29:48 +0530
commit291194ce7f32d15bc37b10fe926ac07189c9c7d4 (patch)
treea0b627f92e7983fbc4d7ff7399c405053a460563 /dblib/provider/src/main
parent7f8fd751c9272c33be0b74f02cd962dd615b63d3 (diff)
fixed sonar issues in DBResourceManager.java
fixed sonar issue Issue-ID: CCSDK-525 Change-Id: I29b85aa6066c6a940818443602e3e0e02fad59ab Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'dblib/provider/src/main')
-rwxr-xr-xdblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java11
1 files changed, 7 insertions, 4 deletions
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 9acae340b..047fa297e 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2016 - 2017 ONAP
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -68,7 +70,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
transient protected long retryInterval = 10000L;
transient boolean recoveryMode = true;
- SortedSet<CachedDataSource> dsQueue = new ConcurrentSkipListSet<CachedDataSource>(new DataSourceComparator());
+ SortedSet<CachedDataSource> dsQueue = new ConcurrentSkipListSet<>(new DataSourceComparator());
protected final Set<CachedDataSource> broken = Collections.synchronizedSet(new HashSet<CachedDataSource>());
protected final Object monitor = new Object();
protected final Properties configProps;
@@ -80,6 +82,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
protected final long monitoringInitialDelay;
protected final long expectedCompletionTime;
protected final long unprocessedFailoverThreshold;
+ private static final String LOGGER_ALARM_MSG="Generated alarm: DBResourceManager.getData - No active DB connection pools are available.";
public DBResourceManager(final DBLIBResourceProvider configuration) {
this(configuration.getProperties());
@@ -393,7 +396,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
// test if there are any connection pools available
if(this.dsQueue.isEmpty()){
- LOGGER.error("Generated alarm: DBResourceManager.getData - No active DB connection pools are available.");
+ LOGGER.error(LOGGER_ALARM_MSG);
throw new DBLibException("No active DB connection pools are available in RequestDataWithRecovery call.");
}
@@ -457,7 +460,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
private CachedRowSet requestDataNoRecovery(String statement, ArrayList<Object> arguments, String preferredDS) throws SQLException {
if(dsQueue.isEmpty()){
- LOGGER.error("Generated alarm: DBResourceManager.getData - No active DB connection pools are available.");
+ LOGGER.error(LOGGER_ALARM_MSG);
throw new DBLibException("No active DB connection pools are available in RequestDataNoRecovery call.");
}
CachedDataSource active = this.dsQueue.first();
@@ -533,7 +536,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
private boolean writeDataNoRecovery(String statement, ArrayList<Object> arguments, String preferredDS) throws SQLException {
if(dsQueue.isEmpty()){
- LOGGER.error("Generated alarm: DBResourceManager.getData - No active DB connection pools are available.");
+ LOGGER.error(LOGGER_ALARM_MSG);
throw new DBLibException("No active DB connection pools are available in RequestDataNoRecovery call.");
}