From aa14f34a60a72d60a6a28a7a7d1d0189c92392cd Mon Sep 17 00:00:00 2001 From: stellamit Date: Fri, 24 Jun 2011 15:29:15 +0000 Subject: [PATCH] NIHVIVO-2769 (inference rebuild model should be cleared out at the end of an inference recompute) --- .../mannlib/vitro/webapp/reasoner/SimpleReasoner.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java index 62e0bec77..700bf8f4a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java @@ -959,6 +959,9 @@ public class SimpleReasoner extends StatementListener { } } catch (Exception e) { log.error("Exception while recomputing ABox inference model", e); + inferenceRebuildModel.removeAll(); // don't do this in the finally, it's needed in the case + // where there isn't an exception + return; } finally { aboxModel.leaveCriticalSection(); tboxModel.leaveCriticalSection(); @@ -967,7 +970,7 @@ public class SimpleReasoner extends StatementListener { // reflect the recomputed inferences into the application inference // model. - inferenceRebuildModel.enterCriticalSection(Lock.READ); + inferenceRebuildModel.enterCriticalSection(Lock.WRITE); scratchpadModel.enterCriticalSection(Lock.WRITE); log.info("Updating ABox inference model"); // Remove everything from the current inference model that is not @@ -1029,6 +1032,8 @@ public class SimpleReasoner extends StatementListener { inferenceModel.leaveCriticalSection(); } } finally { + inferenceRebuildModel.removeAll(); + scratchpadModel.removeAll(); inferenceRebuildModel.leaveCriticalSection(); scratchpadModel.leaveCriticalSection(); }