Reputation: 519
I have an Akka Actor(ARCWorker) that has a one-to-one supervisor strategy to restart upon any exception.
def idle: Receive = {
case UnitOfWork(data, service) =>
{
data.HelperRef = Some(ftpHelper)
val futurework = service(data)
futurework pipeTo self
context.become(busy)
}
}
This futurework take some time to complete. My ARCWorker watches the master and if the master dies it restarts itself and goes to un-initialized state. At that point I don't want my ARCWorker to receive the result of the futurework.
So my questions:
1) What happens to my futurework if I throw an exception and let supervisor take care of restarting ARCWorker?
2) What happens if I do a context.stop of the ARCWorker? ( I think supervisor won't deal with but want to confirm)
3) Is there a way to cancel my futurework in case no other option is available to me?
Thanks Manas
Upvotes: 4
Views: 148
Reputation: 26486
A Future
created by an actor is unaffected by the subsequent restart or death of the actor whose receive function created it.
Upvotes: 1