aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java')
-rw-r--r--src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java52
1 files changed, 6 insertions, 46 deletions
diff --git a/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java b/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java
index 3e962a02..079fc579 100644
--- a/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java
+++ b/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java
@@ -33,10 +33,8 @@ import org.onap.music.eelf.logging.format.ErrorSeverity;
import org.onap.music.eelf.logging.format.ErrorTypes;
import org.onap.music.exceptions.MusicLockingException;
import org.onap.music.exceptions.MusicServiceException;
-import org.onap.music.lockingservice.zookeeper.MusicLockingService;
import org.onap.music.main.MusicUtil;
import org.onap.music.main.ResultType;
-import org.onap.music.service.impl.MusicZKCore;
import org.onap.music.main.MusicCore;
import com.datastax.driver.core.ConsistencyLevel;
@@ -50,7 +48,6 @@ public class MusicHealthCheck {
private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicUtil.class);
private String cassandrHost;
- private String zookeeperHost;
public String getCassandraStatus(String consistency) {
logger.info(EELFLoggerDelegate.applicationLogger, "Getting Status for Cassandra");
@@ -67,7 +64,7 @@ public class MusicHealthCheck {
try {
result = getAdminKeySpace(consistency);
} catch (MusicServiceException e1) {
- logger.error(EELFLoggerDelegate.errorLogger, e1.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN);
+ logger.error(EELFLoggerDelegate.errorLogger, e1, AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN);
}
} else {
logger.error("Error", e);
@@ -83,20 +80,12 @@ public class MusicHealthCheck {
}
private Boolean getAdminKeySpace(String consistency) throws MusicServiceException {
-
-
PreparedQueryObject pQuery = new PreparedQueryObject();
pQuery.appendQueryString("insert into admin.healthcheck (id) values (?)");
pQuery.addValue(UUID.randomUUID());
- ResultType rs = MusicCore.nonKeyRelatedPut(pQuery, consistency);
- logger.info(rs.toString());
- if (rs != null) {
- return Boolean.TRUE;
- } else {
- return Boolean.FALSE;
- }
-
-
+ ResultType rs = MusicCore.nonKeyRelatedPut(pQuery, consistency);
+ logger.info(rs.toString());
+ return null != rs;
}
private boolean createKeyspace() {
@@ -106,30 +95,9 @@ public class MusicHealthCheck {
try {
rs = MusicCore.nonKeyRelatedPut(pQuery, ConsistencyLevel.ONE.toString());
} catch (MusicServiceException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN);
- }
- if(rs != null && rs.getResult().toLowerCase().contains("success"))
- return true;
- else
- return false;
- }
-
- public String getZookeeperStatus() {
-
- String host = MusicUtil.getMyZkHost();
- logger.info(EELFLoggerDelegate.applicationLogger, "Getting Status for Zookeeper Host: " + host);
- try {
- MusicLockingService lockingService = MusicZKCore.getLockingServiceHandle();
- // additionally need to call the ZK to create,aquire and delete lock
- } catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.LOCKINGERROR,
- ErrorTypes.CONNECTIONERROR, ErrorSeverity.CRITICAL);
- return "INACTIVE";
+ logger.error(EELFLoggerDelegate.errorLogger, e, AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN);
}
-
- logger.info(EELFLoggerDelegate.applicationLogger, "Zookeeper is Active and Running");
- return "ACTIVE";
-
+ return rs != null && rs.getResult().toLowerCase().contains("success");
}
public String getCassandrHost() {
@@ -140,12 +108,4 @@ public class MusicHealthCheck {
this.cassandrHost = cassandrHost;
}
- public String getZookeeperHost() {
- return zookeeperHost;
- }
-
- public void setZookeeperHost(String zookeeperHost) {
- this.zookeeperHost = zookeeperHost;
- }
-
}