This is an automated email from the ASF dual-hosted git repository.

aradzinski pushed a commit to branch NLPCRAFT-41
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git

commit 3ea4ccc76c5e84d1ff10a299a71ddf79d846505e
Author: Aaron Radzinski <[email protected]>
AuthorDate: Sun Aug 16 19:22:52 2020 -0700

    Fixed shutdown logic.
---
 .../main/scala/org/apache/nlpcraft/examples/alarm/AlarmModel.java   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/alarm/AlarmModel.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/alarm/AlarmModel.java
index 11a82d0..1f21f24 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/alarm/AlarmModel.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/alarm/AlarmModel.java
@@ -114,4 +114,10 @@ public class AlarmModel extends NCModelFileAdapter {
     
         return NCResult.text("Timer set for: " + FMT.format(dt));
     }
+
+    @Override
+    public void onDiscard() {
+        // Clean up when model gets discarded (e.g. during testing).
+        timer.cancel();
+    }
 }

Reply via email to