Advertisement
Guest User

Untitled

a guest
Oct 8th, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.97 KB | None | 0 0
  1.   def init(dbType: DatabaseType.Value)(implicit system: ActorSystem): Unit = {
  2.     try {
  3.       Database.init(dbType)
  4.       DatabaseUpdater.runUpdate(dbType)
  5.     } catch {
  6.       case e: Exception =>
  7.         log.error(s"couldn't init database, exiting now", e)
  8.         System.exit(1)
  9.     }
  10.  
  11.     //TODO: create one main actor for supervising startup order
  12.  
  13.     system.actorOf(Props[BrandexRouter], ActorNames.Router)
  14.     system.actorOf(Props[ViewCreator], ActorNames.ViewCreator)
  15.     system.actorOf(Props[StatsCollector], ActorNames.ServerStats)
  16.  
  17.     //wait for loading open orders
  18.     Thread.sleep(30000L)
  19.       Trading.init()
  20.  
  21.     //wait for trading module start up
  22.     Thread.sleep(30000L)
  23.       Analytics.init()
  24.  
  25.     system.actorOf(Props[DatabaseCleaner], ActorNames.DatabaseCleaner)
  26.  
  27.     Runtime.getRuntime.addShutdownHook(new Thread() {
  28.       override def run() {
  29.         system.shutdown()
  30.         system.awaitTermination()
  31.         Database.close()
  32.       }
  33.     })
  34.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement