When one should call resetProxy and clearSelf methods of Actor?
This is a followup of my previous question. When one should invoke resetProxy
and clearSelf
of Actor ? W开发者_Go百科hat are they actually useful for?
These methods are used when a "regular" thread ( not threads executing actors ) is talking to an actor. Since there isn't a proper actor sending a message to another actor a proxy actor is instantiated for the thread. You should use the clearSelf method when a thread is long lived and periodically talks to actors especially threads from a thread pool. This method clears the proxy actor created for the thread to have a conversation with other actors so it should be called at the end of an actor dialog. resetProxy is useful when you suspect a proxy actor has died during a dialog and plan to retry.
精彩评论