You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by se...@apache.org on 2020/04/03 16:37:06 UTC
[incubator-nlpcraft] branch NLPCRAFT-31 updated: WIP.
This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-31
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-31 by this push:
new e34588e WIP.
e34588e is described below
commit e34588e0c67b134ea7ceedcf53670f192bd0bb56
Author: Sergey Kamov <se...@apache.org>
AuthorDate: Fri Apr 3 19:36:57 2020 +0300
WIP.
---
.../nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala b/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala
index c6c2877..a54898d 100644
--- a/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala
+++ b/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala
@@ -69,6 +69,8 @@ object NCProbeEnrichmentManager extends NCService with NCOpenCensusModelStats {
@volatile private var embeddedCbs: mutable.Set[EMBEDDED_CB] = _
+ private final val mux = new Object()
+
private object Config extends NCConfigurable {
final private val pre = "nlpcraft.probe"
@@ -89,8 +91,10 @@ object NCProbeEnrichmentManager extends NCService with NCOpenCensusModelStats {
}
override def stop(parent: Span = null): Unit = startScopedSpan("stop", parent) { _ ⇒
- if (embeddedCbs != null)
- embeddedCbs.clear()
+ mux.synchronized {
+ if (embeddedCbs != null)
+ embeddedCbs.clear()
+ }
super.stop()
}
@@ -100,7 +104,7 @@ object NCProbeEnrichmentManager extends NCService with NCOpenCensusModelStats {
* @param cb Callback.
*/
private [probe] def addEmbeddedCallback(cb: EMBEDDED_CB): Unit = {
- embeddedCbs.synchronized {
+ mux.synchronized {
embeddedCbs.add(cb)
}
}
@@ -110,7 +114,7 @@ object NCProbeEnrichmentManager extends NCService with NCOpenCensusModelStats {
* @param cb Callback.
*/
private [probe] def removeEmbeddedCallback(cb: EMBEDDED_CB): Unit = {
- embeddedCbs.synchronized {
+ mux.synchronized {
embeddedCbs.remove(cb)
}
}