Commit 6208b3d9 authored by Szabolcs Gyurko's avatar Szabolcs Gyurko
Browse files

Changed actorsystem to be injected

parent 5ae0f6eb
......@@ -14,11 +14,10 @@ import scala.concurrent.duration.Duration
* Created by sgyurko on 31/08/2016.
*/
@Singleton
class SGet2 @Inject() (val dbConfigProvider: DatabaseConfigProvider) {
class SGet2 @Inject() (val dbConfigProvider: DatabaseConfigProvider, val actorSystem: ActorSystem) {
private val eventBus = new SGet2EventBus
private val dbConfig = dbConfigProvider.get[JdbcProfile]
val downloadQueue = new DownloadQueue(this, dbConfigProvider)
var actorSystem: ActorSystem = _
import dbConfig.driver.api._
import scala.concurrent.ExecutionContext.Implicits.global
......
......@@ -2,11 +2,12 @@ package sget2
import javax.inject.{Inject, Named, Singleton}
import akka.actor.{ActorRef, ActorSystem}
import akka.actor.ActorRef
import play.api.Logger
import play.api.inject.ApplicationLifecycle
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
/**
* Created by sgyurko on 31/08/2016.
......@@ -18,14 +19,11 @@ class SGet2Startup @Inject() (private val sget2: SGet2, val lifecycle: Applicati
Logger.info("Starting SGet2")
sget2.actorSystem = ActorSystem.create("SGet2")
sget2.subscribeTopic(persister)
sget2.subscribeTopic(queueManager)
lifecycle.addStopHook(() {
lifecycle.addStopHook(() Future {
Logger.info("Stopping SGet2")
sget2.actorSystem.terminate()
})
/* load() will return a future. We will execute start() asynchronously once load() redeems */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment