Created
October 31, 2013 23:25
-
-
Save Mortimerp9/7258848 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
case object IdentifyTimeout | |
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) | |
context.scheduler.scheduleOnce(10 seconds, self, IdentifyTimeout) | |
} | |
private def waitingForDriver: Receive = { | |
case IdentifyTimeout => | |
// do something smart | |
//tell someone that we couldn't initialize in time | |
context stop(self) | |
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
some stuff for @squito working on spark internals