Last active
December 27, 2015 03:19
-
-
Save Mortimerp9/7258790 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyActor extends Actor { | |
var driver: ActorRef = null | |
val identifyId = //get a unique identifyId for that driverUrl | |
override def preStart() { | |
val driverSel = context.actorSelection(driverUrl) | |
driverSel ! Identify(identifyId) | |
} | |
private def waitingForDriver: Receive = { | |
case ActorIdentity(identifyId, Some(actorRef)) => | |
val timeout = 100.millis | |
driver = context.actorOf(Props(classOf[ReliableProxy], actorRef, timeout)) | |
driver ! RegisterExecutor(executorId, hostPort, cores) | |
context.system.eventStream.subscribe(self, classOf[RemotingLifecycleEvent]) | |
context watch driver | |
context become mainReceive | |
} | |
private def mainReceive: Receive = { | |
// the current receive | |
} | |
override def receive = waitingForDriver | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment