aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph Straubs <rs8887@att.com>2017-09-14 03:51:45 -0500
committerRalph Straubs <rs8887@att.com>2017-09-14 03:51:45 -0500
commit7e82d6a2b1409c4f59993b2946645647e2fb2b17 (patch)
tree4320ec8420180419fca771a6964c7be11a7aa64f
parent009582f2e2a4bd3b09da3721a8b6587d5ac89723 (diff)
Eliminate hanging when updating Drools containers
'PolicyContainer.updateToVersion(...)' now hangs unless the Drools session threads are stopped prior to the update. This wasn't an issue in the past, and it isn't clear what causes it to happen now. It also happened in the Junit tests I am currently working on. In any case, the 'updateToVersion' method has now been changed to stop the threads prior to an update attempt, do the update, and then restart the threads. Change-Id: I577a67c6e99a68bcbe3c2f476f93c0a72b93451a Issue-ID: POLICY-234 Signed-off-by: Ralph Straubs <rs8887@att.com>
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java b/policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java
index cf94bfcb..9fc2c837 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java
@@ -457,10 +457,19 @@ public class PolicyContainer implements Startable
logger.info("updateToVersion:releaseId " + releaseId.toString());
}
- // notify all 'PolicySession' instances
+ // stop all session threads
+ for (PolicySession session : sessions.values())
+ {
+ session.stopThread();
+ }
+
+ // update the version
Results results = kieContainer.updateToVersion(releaseId);
+
+ // restart all session threads, and notify the sessions
for (PolicySession session : sessions.values())
{
+ session.startThread();
session.updated();
}