summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/main/java
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2019-08-08 08:57:34 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2019-08-08 08:57:34 +0000
commitd7f9574986345d5a3eafe097c1c2afd15fb8930c (patch)
treee3598f05eb5abfefa05c97aced4d1fec91aec4ff /services/services-engine/src/main/java
parentd7a0af78ec30aee100043816d382bb27eeb700e5 (diff)
Change to fix PDP-A incorrectly going into ACTIVE state even during APEX engine failure
PDP-A goes to ACTIVE state even when the APEX engine failed to start. This is fixed. Change-Id: Iad4b45abf257f68267dd2526a624dc6d882c84af Issue-ID: POLICY-1980 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'services/services-engine/src/main/java')
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
index 2c649c274..3bf842c92 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modification Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -23,7 +24,8 @@ package org.onap.policy.apex.service.engine.main;
import java.util.Arrays;
import java.util.Base64;
import java.util.Map.Entry;
-
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.parameters.ApexParameterHandler;
import org.onap.policy.apex.service.parameters.ApexParameters;
@@ -45,6 +47,10 @@ public class ApexMain {
// The parameters read in from JSON
private ApexParameters parameters;
+ @Getter
+ @Setter(lombok.AccessLevel.PRIVATE)
+ private volatile boolean alive = false;
+
/**
* Instantiates the Apex service.
*
@@ -101,6 +107,7 @@ public class ApexMain {
// Start the activator
try {
activator.initialize();
+ setAlive(true);
} catch (final ApexActivatorException e) {
LOGGER.error("start of Apex service failed, used parameters are " + Arrays.toString(args), e);
return;
@@ -129,6 +136,7 @@ public class ApexMain {
if (activator != null) {
activator.terminate();
}
+ setAlive(false);
}
/**
@@ -144,6 +152,7 @@ public class ApexMain {
try {
// Shutdown the Apex engine and wait for everything to stop
activator.terminate();
+ setAlive(false);
} catch (final ApexException e) {
LOGGER.warn("error occured during shut down of the Apex service", e);
}