Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait ActorsSystem {
- protected val System: ActorSystem
- protected val actors: Map[String, ActorRef]
- def apply(actorName: String) = {
- actors(actorName)
- }
- //Use the System's dispatcher as ExecutionContext
- import System.dispatcher
- def schedule(delay: Int, event: Any) {
- System.scheduler.scheduleOnce(delay seconds) {
- this("sender") ! event
- }
- }
- }
- object ActorsSystem extends ActorsSystem {
- protected val System: ActorSystem = ActorSystem("System", Configuration.RawConfiguration)
- protected val actors: Map[String, ActorRef] = Map("event1" -> System.actorOf(BackendActor.event1Pool, "event1"),...)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement