aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java
diff options
context:
space:
mode:
authorMohammad Salehe <salehe@cs.toronto.edu>2018-11-26 19:58:30 -0500
committerMohammad Salehe <salehe@cs.toronto.edu>2018-12-22 15:07:11 -0500
commit968592932394e29dc6eb71eb2968d46d0691cf30 (patch)
tree2388981cfae587212a81c651ac93a3806a052f9e /src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java
parentd927fa46b8a97fe58dce5ec13fbb09bb22fd129b (diff)
Refactor Cassandra connection process
Refactor MusicUtil and CassaDataStore to make Cassandra connection initialization process more simple and readable Change-Id: Ied7d3e82dc86dd7d35cd513b13ff0c865dd40b4b Issue-ID: MUSIC-148 Signed-off-by: Mohammad Salehe <salehe@cs.toronto.edu>
Diffstat (limited to 'src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java')
-rw-r--r--src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java b/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java
index a2d9386b..ebd6213f 100644
--- a/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java
+++ b/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java
@@ -36,22 +36,22 @@ public class MusicDataStoreHandle {
public static MusicDataStore mDstoreHandle = null;
private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicDataStoreHandle.class);
-
+
/**
- *
- * @param remoteIp
+ *
+ * @param remoteAddress
* @return
*/
- public static MusicDataStore getDSHandle(String remoteIp) {
+ public static MusicDataStore getDSHandle(String remoteAddress) {
logger.info(EELFLoggerDelegate.applicationLogger,"Acquiring data store handle");
long start = System.currentTimeMillis();
if (mDstoreHandle == null) {
- try {
- MusicUtil.loadProperties();
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "No properties file defined. Falling back to default.");
- }
- mDstoreHandle = new MusicDataStore(remoteIp);
+ try {
+ MusicUtil.loadProperties();
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "No properties file defined. Falling back to default.");
+ }
+ mDstoreHandle = new MusicDataStore(remoteAddress);
}
long end = System.currentTimeMillis();
logger.info(EELFLoggerDelegate.applicationLogger,"Time taken to acquire data store handle:" + (end - start) + " ms");
@@ -74,10 +74,10 @@ public class MusicDataStoreHandle {
logger.error(EELFLoggerDelegate.errorLogger, "No properties file defined. Falling back to default.");
}
// Quick Fix - Best to put this into every call to getDSHandle?
- if (! MusicUtil.getMyCassaHost().equals("localhost") ) {
- mDstoreHandle = new MusicDataStore(MusicUtil.getMyCassaHost());
- } else {
+ if (MusicUtil.getMyCassaHost().equals("localhost")) {
mDstoreHandle = new MusicDataStore();
+ } else {
+ mDstoreHandle = new MusicDataStore(MusicUtil.getMyCassaHost());
}
}
if(mDstoreHandle.getSession() == null) {