From cce09d08ead0c7cf152b2e63374a18e04b280b61 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 12 Sep 2018 16:12:14 +0100 Subject: Fix soft stop and start of engine Stopping an apexc engine is a soft stop, allowing the engine to be restarted again. However, when a model upgrade is carried out the engine must be stopped and cleared to clear the previous model, loaded with the new model and started again. THis handling must work over the Web Socket admin interface and also when apex is started as a service. This change fixes the handling so that it is consistent and works the same when apex is stopped/started/upgraded from the command line or over the management web socket interface Issue-ID: POLICY-1101 Change-Id: I1fe619641cb6ecd34d0669b4b7df105280e5e2c0 Signed-off-by: liamfallon --- .../onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/core-engine/src') diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java index 3349b609f..3497ed660 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java @@ -247,8 +247,11 @@ public class ApexEngineImpl implements ApexEngine { // Clear everything stateMachineHandler = null; engineStats.clean(); - internalContext.clear(); - internalContext = null; + + if (internalContext != null) { + internalContext.clear(); + internalContext = null; + } } /* -- cgit 1.2.3-korg