- Scala Machine Learning Projects
- Md. Rezaul Karim
- 87字
- 2021-06-30 19:05:40
Scheduler
Scheduler takes the frequency constant from the application.conf and uses the Actor system to send an update message (the content does not matter; SchedulerActor reacts to any message) to SchedulerActor every X seconds:
class Scheduler @Inject()
(val system: ActorSystem, @Named("scheduler-actor") val schedulerActor: ActorRef, configuration: Configuration)(implicit ec: ExecutionContext) {
//constants.frequency is set in conf/application.conf file
val frequency = configuration.getInt("constants.frequency").get
var actor = system.scheduler.schedule(
0.microseconds, //initial delay: whether execution starts immediately after app launch
frequency.seconds, //every X seconds, specified above
schedulerActor,
"update")
}
推薦閱讀
- 現代測控系統典型應用實例
- GNU-Linux Rapid Embedded Programming
- 電力自動化實用技術問答
- Splunk 7 Essentials(Third Edition)
- 圖解PLC控制系統梯形圖和語句表
- Getting Started with Containerization
- 電腦上網直通車
- 群體智能與數據挖掘
- OpenStack Cloud Computing Cookbook(Second Edition)
- AutoCAD 2012中文版繪圖設計高手速成
- Machine Learning with the Elastic Stack
- Dreamweaver CS6精彩網頁制作與網站建設
- 工業自動化技術實訓指導
- 基于Proteus的單片機應用技術
- Photoshop CS4數碼照片處理入門、進階與提高