From 291194ce7f32d15bc37b10fe926ac07189c9c7d4 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Wed, 5 Dec 2018 16:29:35 +0530 Subject: fixed sonar issues in DBResourceManager.java fixed sonar issue Issue-ID: CCSDK-525 Change-Id: I29b85aa6066c6a940818443602e3e0e02fad59ab Signed-off-by: Sandeep J --- .../java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'dblib/provider') 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 dsQueue = new ConcurrentSkipListSet(new DataSourceComparator()); + SortedSet dsQueue = new ConcurrentSkipListSet<>(new DataSourceComparator()); protected final Set broken = Collections.synchronizedSet(new HashSet()); 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 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 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."); } -- cgit 1.2.3-korg