summaryrefslogtreecommitdiffstats
path: root/dblib
diff options
context:
space:
mode:
Diffstat (limited to 'dblib')
-rwxr-xr-xdblib/features/pom.xml2
-rwxr-xr-xdblib/installer/pom.xml2
-rwxr-xr-xdblib/pom.xml4
-rwxr-xr-xdblib/provider/pom.xml4
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java67
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java1
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java8
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java11
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java30
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java7
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java10
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/AbstractResourceManagerFactory.java12
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDBCachedDataSource.java1
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java3
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java1
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java1
-rw-r--r--dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java2
17 files changed, 97 insertions, 69 deletions
diff --git a/dblib/features/pom.xml b/dblib/features/pom.xml
index 2be6c8db..4053efaf 100755
--- a/dblib/features/pom.xml
+++ b/dblib/features/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>dblib</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>dblib-features</artifactId>
<name>DBLIB Adaptor - Features</name>
diff --git a/dblib/installer/pom.xml b/dblib/installer/pom.xml
index 10845db1..a2d7362a 100755
--- a/dblib/installer/pom.xml
+++ b/dblib/installer/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>dblib</artifactId>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>dblib-installer</artifactId>
<name>DBLIB Adaptor - Karaf Installer</name>
diff --git a/dblib/pom.xml b/dblib/pom.xml
index 9e151637..8e7afabb 100755
--- a/dblib/pom.xml
+++ b/dblib/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>ccsdk-sli-core</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
@@ -16,7 +16,7 @@
<name>DBLIB Adaptor</name>
<description>The DBLIB adaptor allows service logic to access persistent data in a local sql database</description>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
<build>
diff --git a/dblib/provider/pom.xml b/dblib/provider/pom.xml
index 11e0ff74..07fc61ab 100755
--- a/dblib/provider/pom.xml
+++ b/dblib/provider/pom.xml
@@ -4,10 +4,10 @@
<parent>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>dblib</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>dblib-provider</artifactId>
- <version>0.1.1-SNAPSHOT</version>
+ <version>0.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>DBLIB Adaptor - Provider</name>
<url>http://maven.apache.org</url>
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 9dc262d0..ee8ab2f3 100644
--- 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
@@ -20,6 +20,18 @@
package org.onap.ccsdk.sli.core.dblib;
+import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException;
+import org.apache.tomcat.jdbc.pool.PoolExhaustedException;
+import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
+import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor;
+import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor.TestObject;
+import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitorObserver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.sql.DataSource;
+import javax.sql.rowset.CachedRowSet;
+import javax.sql.rowset.RowSetProvider;
import java.io.Closeable;
import java.io.IOException;
import java.io.PrintWriter;
@@ -36,20 +48,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Observer;
-import javax.sql.DataSource;
-import javax.sql.rowset.CachedRowSet;
-import javax.sql.rowset.RowSetProvider;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.tomcat.jdbc.pool.PoolExhaustedException;
-import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
-import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor;
-import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitorObserver;
-import org.onap.ccsdk.sli.core.dblib.pm.SQLExecutionMonitor.TestObject;
-
-import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException;
-
/**
* @version $Revision: 1.13 $
@@ -94,12 +92,14 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
/* (non-Javadoc)
* @see javax.sql.DataSource#getConnection()
*/
+ @Override
public Connection getConnection() throws SQLException
{
return ds.getConnection();
}
- public CachedRowSet getData(String statement, ArrayList<Object> arguments) throws SQLException, Throwable
+ public CachedRowSet getData(String statement, ArrayList<Object> arguments)
+ throws SQLException, Throwable
{
TestObject testObject = null;
testObject = monitor.registerRequest();
@@ -128,7 +128,8 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
}
}
- public boolean writeData(String statement, ArrayList<Object> arguments) throws SQLException, Throwable
+ public boolean writeData(String statement, ArrayList<Object> arguments)
+ throws SQLException, Throwable
{
TestObject testObject = null;
testObject = monitor.registerRequest();
@@ -157,7 +158,8 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
}
}
- CachedRowSet executePreparedStatement(Connection conn, String statement, ArrayList<Object> arguments, boolean close) throws SQLException, Throwable
+ CachedRowSet executePreparedStatement(Connection conn, String statement,
+ ArrayList<Object> arguments, boolean close) throws SQLException, Throwable
{
long time = System.currentTimeMillis();
@@ -170,9 +172,10 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
}
ResultSet rs = null;
+ PreparedStatement ps = null;
try {
data = RowSetProvider.newFactory().createCachedRowSet();
- PreparedStatement ps = conn.prepareStatement(statement);
+ ps = conn.prepareStatement(statement);
if(arguments != null)
{
for(int i = 0, max = arguments.size(); i < max; i++){
@@ -223,6 +226,13 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
} catch(Exception exc){
}
+ try {
+ if (ps != null){
+ ps.close();
+ }
+ } catch (Exception exc){
+
+ }
}
return data;
@@ -298,6 +308,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
/* (non-Javadoc)
* @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String)
*/
+ @Override
public Connection getConnection(String username, String password)
throws SQLException
{
@@ -307,6 +318,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
/* (non-Javadoc)
* @see javax.sql.DataSource#getLogWriter()
*/
+ @Override
public PrintWriter getLogWriter() throws SQLException
{
return ds.getLogWriter();
@@ -315,6 +327,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
/* (non-Javadoc)
* @see javax.sql.DataSource#getLoginTimeout()
*/
+ @Override
public int getLoginTimeout() throws SQLException
{
return ds.getLoginTimeout();
@@ -323,6 +336,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
/* (non-Javadoc)
* @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter)
*/
+ @Override
public void setLogWriter(PrintWriter out) throws SQLException
{
ds.setLogWriter(out);
@@ -331,12 +345,14 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
/* (non-Javadoc)
* @see javax.sql.DataSource#setLoginTimeout(int)
*/
+ @Override
public void setLoginTimeout(int seconds) throws SQLException
{
ds.setLoginTimeout(seconds);
}
+ @Override
public final String getDbConnectionName(){
return connectionName;
}
@@ -420,10 +436,12 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
return true;
}
+ @Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
}
+ @Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return null;
}
@@ -447,34 +465,42 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
monitor.deleteObserver(observer);
}
+ @Override
public long getInterval() {
return interval;
}
+ @Override
public long getInitialDelay() {
return initialDelay;
}
+ @Override
public void setInterval(long value) {
interval = value;
}
+ @Override
public void setInitialDelay(long value) {
initialDelay = value;
}
+ @Override
public long getExpectedCompletionTime() {
return expectedCompletionTime;
}
+ @Override
public void setExpectedCompletionTime(long value) {
expectedCompletionTime = value;
}
+ @Override
public long getUnprocessedFailoverThreshold() {
return unprocessedFailoverThreshold;
}
+ @Override
public void setUnprocessedFailoverThreshold(long value) {
this.unprocessedFailoverThreshold = value;
}
@@ -487,6 +513,7 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
canTakeOffLine = false;
final Thread offLineTimer = new Thread()
{
+ @Override
public void run(){
try {
Thread.sleep(30000L);
@@ -565,7 +592,9 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
retValue = false;
} finally {
try {
- lock.close();
+ if (lock != null) {
+ lock.close();
+ }
} catch(Exception exc) {
}
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java
index 07e3dfab..296fe70f 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java
@@ -24,7 +24,6 @@ package org.onap.ccsdk.sli.core.dblib;
import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration;
import org.onap.ccsdk.sli.core.dblib.jdbc.JdbcDBCachedDataSource;
-import org.onap.ccsdk.sli.core.dblib.jdbc.MySQLCachedDataSource;
/**
* @version $Revision: 1.1 $
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java
index 201cc401..062cd840 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java
@@ -20,11 +20,8 @@
package org.onap.ccsdk.sli.core.dblib;
-import com.google.common.annotations.VisibleForTesting;
-
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
import java.util.Properties;
@@ -35,10 +32,6 @@ import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibEnvVarFileResol
import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibJREFileResolver;
import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibKarafRootFileResolver;
import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibPropertiesFileResolver;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -146,7 +139,6 @@ public class DBLIBResourceProvider {
* <li>A <code>dblib.properties</code> file located in the karaf root directory</li>
* </ol>
*/
- @VisibleForTesting
File determinePropertiesFile(final DBLIBResourceProvider dblibResourceProvider) {
for (final DblibPropertiesFileResolver dblibPropertiesFileResolver : dblibPropertiesFileResolvers) {
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java
index 8181b130..40d1a238 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLibConnection.java
@@ -43,7 +43,6 @@ import java.util.concurrent.Executor;
import javax.sql.rowset.CachedRowSet;
import org.apache.tomcat.jdbc.pool.PooledConnection;
-import org.apache.tomcat.jdbc.pool.ProxyConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,7 +64,8 @@ public class DBLibConnection implements Connection {
public boolean lockTable(String tablename) {
this.tableName = tablename;
- return locked = dataSource.lockTable(connection, tableName);
+ locked = dataSource.lockTable(connection, tableName);
+ return locked;
}
public void resetInactivityTimer() {
@@ -80,12 +80,13 @@ public class DBLibConnection implements Connection {
public boolean unlock() {
dataSource.unlockTable(connection);
- return locked = false;
+ locked = false;
+ return locked;
}
public boolean writeData(String statement, ArrayList<String> arguments) throws SQLException, Throwable
{
- ArrayList<Object> newList=new ArrayList<Object>();
+ ArrayList<Object> newList= new ArrayList<>();
if(arguments != null && !arguments.isEmpty()) {
newList.addAll(arguments);
}
@@ -95,7 +96,7 @@ public class DBLibConnection implements Connection {
public CachedRowSet getData(String statement, ArrayList<String> arguments) throws SQLException, Throwable
{
- ArrayList<Object> newList=new ArrayList<Object>();
+ ArrayList<Object> newList= new ArrayList<>();
if(arguments != null && !arguments.isEmpty()) {
newList.addAll(arguments);
}
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 7ed54306..7a27a20c 100644
--- 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
@@ -72,23 +72,22 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
protected final AtomicBoolean dsSelector = new AtomicBoolean();
// Queue<CachedDataSource> dsQueue = new ConcurrentLinkedQueue<CachedDataSource>();
- Queue<CachedDataSource> dsQueue = new PriorityQueue<CachedDataSource>(4, new Comparator<CachedDataSource>(){
-
+ Queue<CachedDataSource> dsQueue = new PriorityQueue<>(4, new Comparator<CachedDataSource>() {
@Override
public int compare(CachedDataSource left, CachedDataSource right) {
try {
- if(!left.isSlave())
+ if (!left.isSlave()) {
return -1;
- if(!right.isSlave())
+ }
+ if (!right.isSlave()) {
return 1;
-
+ }
} catch (Throwable e) {
LOGGER.warn("", e);
}
return 0;
}
-
- });
+ });
protected final Set<CachedDataSource> broken = Collections.synchronizedSet(new HashSet<CachedDataSource>());
protected final Object monitor = new Object();
protected final Properties configProps;
@@ -236,6 +235,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
class RecoveryMgr extends Thread {
+ @Override
public void run() {
while(!terminating)
{
@@ -291,7 +291,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
*/
@Override
public CachedRowSet getData(String statement, ArrayList<String> arguments, String preferredDS) throws SQLException {
- ArrayList<Object> newList=new ArrayList<Object>();
+ ArrayList<Object> newList= new ArrayList<>();
if(arguments != null && !arguments.isEmpty()) {
newList.addAll(arguments);
}
@@ -306,7 +306,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
CachedDataSource active = null;
// test if there are any connection pools available
- LinkedList<CachedDataSource> sources = new LinkedList<CachedDataSource>(this.dsQueue);
+ LinkedList<CachedDataSource> sources = new LinkedList<>(this.dsQueue);
if(sources.isEmpty()){
LOGGER.error("Generated alarm: DBResourceManager.getData - No active DB connection pools are available.");
throw new DBLibException("No active DB connection pools are available in RequestDataWithRecovery call.");
@@ -348,7 +348,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
handleGetConnectionException(active, exc);
} finally {
if(LOGGER.isDebugEnabled()){
- time = (System.currentTimeMillis() - time);
+ time = System.currentTimeMillis() - time;
LOGGER.debug("getData processing time : "+ active.getDbConnectionName()+" "+time+" miliseconds.");
}
}
@@ -402,7 +402,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
}
} finally {
if(LOGGER.isDebugEnabled()){
- time = (System.currentTimeMillis() - time);
+ time = System.currentTimeMillis() - time;
LOGGER.debug(">> getData : "+ active.getDbConnectionName()+" "+time+" miliseconds.");
}
}
@@ -415,7 +415,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
@Override
public boolean writeData(String statement, ArrayList<String> arguments, String preferredDS) throws SQLException
{
- ArrayList<Object> newList=new ArrayList<Object>();
+ ArrayList<Object> newList= new ArrayList<>();
if(arguments != null && !arguments.isEmpty()) {
newList.addAll(arguments);
}
@@ -488,7 +488,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
}
} finally {
if(LOGGER.isDebugEnabled()){
- time = (System.currentTimeMillis() - time);
+ time = System.currentTimeMillis() - time;
LOGGER.debug("writeData processing time : "+ active.getDbConnectionName()+" "+time+" miliseconds.");
}
}
@@ -700,7 +700,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
public String getDBStatus(boolean htmlFormat) {
StringBuilder buffer = new StringBuilder();
- ArrayList<CachedDataSource> list = new ArrayList<CachedDataSource>();
+ ArrayList<CachedDataSource> list = new ArrayList<>();
list.addAll(dsQueue);
list.addAll(broken);
if (htmlFormat)
@@ -785,7 +785,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb
public String getPreferredDataSourceName(AtomicBoolean flipper) {
- LinkedList<CachedDataSource> snapshot = new LinkedList<CachedDataSource>(dsQueue);
+ LinkedList<CachedDataSource> snapshot = new LinkedList<>(dsQueue);
if(snapshot.size() > 1){
CachedDataSource first = snapshot.getFirst();
CachedDataSource last = snapshot.getLast();
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java
index de984667..0dea664d 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DbLibService.java
@@ -7,9 +7,9 @@
* 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
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
package org.onap.ccsdk.sli.core.dblib;
+import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
@@ -43,4 +44,6 @@ public interface DbLibService {
public abstract boolean isActive();
+ public abstract Connection getConnection() throws SQLException;
+
}
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java
index 127e6d37..b4d1ef67 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/TerminatingCachedDataSource.java
@@ -33,38 +33,47 @@ public class TerminatingCachedDataSource extends CachedDataSource implements SQL
super(jdbcElem);
}
+ @Override
protected void configure(BaseDBConfiguration jdbcElem) throws DBConfigException {
// no action
}
+ @Override
public long getInterval() {
return 1000;
}
+ @Override
public long getInitialDelay() {
return 1000;
}
+ @Override
public long getExpectedCompletionTime() {
return 50;
}
+ @Override
public void setExpectedCompletionTime(long value) {
}
+ @Override
public void setInterval(long value) {
}
+ @Override
public void setInitialDelay(long value) {
}
+ @Override
public long getUnprocessedFailoverThreshold() {
return 3;
}
+ @Override
public void setUnprocessedFailoverThreshold(long value) {
}
@@ -74,6 +83,7 @@ public class TerminatingCachedDataSource extends CachedDataSource implements SQL
return 0;
}
+ @Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
// TODO Auto-generated method stub
return null;
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/AbstractResourceManagerFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/AbstractResourceManagerFactory.java
index 6fc7e7a0..486d0ccc 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/AbstractResourceManagerFactory.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/AbstractResourceManagerFactory.java
@@ -21,13 +21,8 @@
package org.onap.ccsdk.sli.core.dblib.factory;
-import java.sql.SQLException;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
import org.onap.ccsdk.sli.core.dblib.CachedDataSource;
import org.onap.ccsdk.sli.core.dblib.CachedDataSourceFactory;
-import org.onap.ccsdk.sli.core.dblib.DBConfigException;
import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
import org.onap.ccsdk.sli.core.dblib.config.DbConfigPool;
@@ -35,6 +30,10 @@ import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.sql.SQLException;
+import java.util.Set;
+import java.util.concurrent.Callable;
+
/**
* @version $Revision: 1.6 $
* Change Log
@@ -85,7 +84,8 @@ public abstract class AbstractResourceManagerFactory {
}
};
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Completed CachedDataSource.Call and notifyAll from " + ds.getDbConnectionName());
+ LOGGER.debug("Completed CachedDataSource.Call and notifyAll from " + (ds != null ? ds
+ .getDbConnectionName() : null));
}
Thread worker = new Thread(closure);
worker.setDaemon(true);
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 c024d002..ffe83445 100644
--- 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
@@ -30,7 +30,6 @@ import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.onap.ccsdk.sli.core.dblib.CachedDataSource;
import org.onap.ccsdk.sli.core.dblib.DBConfigException;
import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
-import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java
index 978de0eb..803e6b3e 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/JdbcDbResourceManagerFactory.java
@@ -22,9 +22,7 @@ package org.onap.ccsdk.sli.core.dblib.jdbc;
import java.sql.SQLException;
-import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
@@ -35,7 +33,6 @@ import java.util.concurrent.FutureTask;
import org.onap.ccsdk.sli.core.dblib.CachedDataSource;
import org.onap.ccsdk.sli.core.dblib.CachedDataSourceFactory;
import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
-import org.onap.ccsdk.sli.core.dblib.DataSourceComparator;
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.factory.AbstractResourceManagerFactory;
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java
index 40720985..bea0d631 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/jdbc/MySQLCachedDataSource.java
@@ -26,7 +26,6 @@ import java.util.Properties;
import org.onap.ccsdk.sli.core.dblib.CachedDataSource;
import org.onap.ccsdk.sli.core.dblib.DBConfigException;
import org.onap.ccsdk.sli.core.dblib.config.BaseDBConfiguration;
-import org.onap.ccsdk.sli.core.dblib.config.JDBCConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java
index 17c42ec8..0b69109f 100644
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java
@@ -21,6 +21,7 @@
package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver;
import com.google.common.base.Strings;
+
import java.io.File;
import java.nio.file.Paths;
import java.util.Optional;
diff --git a/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java b/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java
index 117492d0..65ebfbae 100644
--- a/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java
+++ b/dblib/provider/src/test/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java
@@ -2,8 +2,6 @@ package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver;
import static org.junit.Assert.*;
-import java.io.File;
-import java.util.Optional;
import org.junit.Test;
public class DblibJREFileResolverTest {