문제

When is the supervisor strategy invoked ? Is it when the exception is thrown for an Actor. In below code :

@Override
public SupervisorStrategy supervisorStrategy() {

    System.out.println("supervisorStrategy");
   return strategy;
}

The println statement is not invoked when actor is created. Is this expected behaviour ?

도움이 되었습니까?

해결책

Unlike the not-to-well-named receive method, which is only called during Actor initialization to acquire the PartialFunction that will handle incoming messages, the supervisorStrategy method is used when failures occur. It is a regular method that does the work of deciding how to handle a failure in a descendant Actor.

Hmm... I just noticed you're using Java, so the part about receive is presumably different for you, but the supervisorStrategy statement still applies.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top