Fix sonars in xacml-pdp
[policy/xacml-pdp.git] / main / src / main / java / org / onap / policy / pdpx / main / rest / provider / HealthCheckProvider.java
index 1c77d55..bc79187 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -40,12 +40,15 @@ public class HealthCheckProvider {
      * @return Report containing health check status
      */
     public HealthCheckReport performHealthCheck() {
-        final HealthCheckReport report = new HealthCheckReport();
+        final var report = new HealthCheckReport();
         report.setName(NAME);
         report.setUrl(URL);
-        report.setHealthy(XacmlPdpActivator.isAlive());
-        report.setCode(XacmlPdpActivator.isAlive() ? 200 : 500);
-        report.setMessage(XacmlPdpActivator.isAlive() ? ALIVE : NOT_ALIVE);
+
+        boolean alive = XacmlPdpActivator.getCurrent().isAlive();
+
+        report.setHealthy(alive);
+        report.setCode(alive ? 200 : 500);
+        report.setMessage(alive ? ALIVE : NOT_ALIVE);
         return report;
     }
 }