향후 호출에서 뭔가를 실행 중입니다. 성공적인 통화가 끝나면 결과를 발신자에게 돌려 주거나 향후 통화에 실패하면 배우를 실패합니다. 감독자 전략이있는 RoundRobinPool이 구현 된 부모에 의해 처리됩니다.미래 호출이 실패 할 경우 액터에 실패합니다.
다음은 코드 단편입니다.
private def getData(sender: ActorRef): Unit = {
dao.getData().mapTo[List[Data]].map(result => sender ! result)
.onFailure {
case e: NullPointerExcetpion => {
println("+++++++ Throwing exception")
// throwning the exception from here doesn't cause the supervisor to restart this actor
throw t
}
}
// throwing the exception from here makes the supervisor strategy to take action
throw new NullPointerExcetpion
}
미래가 예외를 반환하면 어떻게 할 수 있습니까?
건배
Utsav
당신은 "액터 실패"무엇을 의미합니까? –
다시 사용자에게 전파하고 배우를 죽입니다. 감독자가 액터를 다시 시작하게하는 동작입니다. null 포인터 예외의 경우 SupervisorStrategy.Restart가 감독자로 사용됩니다. – Utsav
더 중요한 것은 Future 함수 밖에서 명시 적으로 오류를 던질 때 왜 작동하는 것입니까? – Utsav