Refactoring.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/ignite/NCIgniteHelpers.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/ignite/NCIgniteHelpers.scala
index bfa55d1..a44427c 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/ignite/NCIgniteHelpers.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/ignite/NCIgniteHelpers.scala
@@ -75,7 +75,7 @@
* Gets an entry from the cache.
*
* @param key The key whose associated value is to be returned.
- * @return Return some value, or none if it does't exist.
+ * @return Return some value, or none if it doesn't exist.
*/
def apply(key: K): Option[V] =
ic.get(key) match {
@@ -143,6 +143,9 @@
assert(clause != null)
assert(args != null)
+ // TODO: deprecated to what & how?
+ // TODO: Ignite is missing instructions on this migration.
+ // TODO: Perhaps - https://stackoverflow.com/questions/41309941/sqlquery-and-sqlfieldsquery
val qry = new SqlQuery[K, V](cls, clause)
if (args != null && args.nonEmpty)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/core/spacy/NCSpaCyNerEnricher.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/core/spacy/NCSpaCyNerEnricher.scala
index 740e095..5a6eb5d 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/core/spacy/NCSpaCyNerEnricher.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/core/spacy/NCSpaCyNerEnricher.scala
@@ -27,7 +27,7 @@
import akka.http.scaladsl.model.StatusCodes.OK
import akka.http.scaladsl.model._
import akka.http.scaladsl.unmarshalling.Unmarshal
-import akka.stream.ActorMaterializer
+import akka.stream.Materializer
import io.opencensus.trace.Span
import org.apache.nlpcraft.common.config.NCConfigurable
import org.apache.nlpcraft.common.nlp.{NCNlpSentence, NCNlpSentenceNote}
@@ -46,9 +46,10 @@
object NCSpaCyNerEnricher extends NCService with NCNlpNerEnricher with NCIgniteInstance {
private final val TIMEOUT_SECS: Int = 5
- private implicit val actSys: ActorSystem = ActorSystem()
- private implicit val materializer: ActorMaterializer = ActorMaterializer()
- private implicit val execCtx: ExecutionContextExecutor = actSys.dispatcher
+ private implicit final val SYSTEM: ActorSystem = ActorSystem("spacy-ner")
+ private implicit final val MATERIALIZER: Materializer = Materializer.createMaterializer(SYSTEM)
+ private implicit final val EXEC_CTX: ExecutionContextExecutor = SYSTEM.dispatcher
+
private implicit val fmt: RootJsonFormat[SpacySpan] = jsonFormat7(SpacySpan)
private object Config extends NCConfigurable {
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCRestManager.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCRestManager.scala
index f2a55ab..6884109 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCRestManager.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCRestManager.scala
@@ -20,7 +20,7 @@
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.server._
-import akka.stream.ActorMaterializer
+import akka.stream.Materializer
import io.opencensus.trace.Span
import org.apache.nlpcraft.common.config.NCConfigurable
import org.apache.nlpcraft.common.{NCService, _}
@@ -33,8 +33,8 @@
*/
object NCRestManager extends NCService {
private implicit val SYSTEM: ActorSystem = ActorSystem("server-rest")
- private implicit val MATERIALIZER: ActorMaterializer = ActorMaterializer()
- private implicit val CTX: ExecutionContextExecutor = SYSTEM.dispatcher
+ private implicit val MATERIALIZER: Materializer = Materializer.createMaterializer(SYSTEM)
+ private implicit val EXEC_CTX: ExecutionContextExecutor = SYSTEM.dispatcher
@volatile private var bindFut: Future[Http.ServerBinding] = _
@@ -78,7 +78,7 @@
handleErrors = api.getExceptionHandler
handleRejections = api.getRejectionHandler
- bindFut = Http().bindAndHandleAsync(Route.asyncHandler(api.getRoute), Config.host, Config.port)
+ bindFut = Http().newServerAt(Config.host, Config.port).bind(Route.toFunction(api.getRoute))
bindFut.onComplete {
case Success(_) ⇒ logger.info(s"REST server is listening on '$url'.")