When shuting down an ActorSystem I found that ActorSystem::shutdown
was deprecated. It's suggested "Use the terminate() method instead"
.
But the decumentation of those methods is almost the same:
/**
* Terminates this actor system. This will stop the guardian actor, which in turn
* will recursively stop all its child actors, then the system guardian
* (below which the logging actors reside) and the execute all registered
* termination handlers (see [[ActorSystem#registerOnTermination]]).
* Be careful to not schedule any operations on completion of the returned future
* using the `dispatcher` of this actor system as it will have been shut down before the
* future completes.
*/
def terminate(): Future[Terminated]
and
/**
* Stop this actor system. This will stop the guardian actor, which in turn
* will recursively stop all its child actors, then the system guardian
* (below which the logging actors reside) and the execute all registered
* termination handlers (see [[ActorSystem#registerOnTermination]]).
*/
@deprecated("Use the terminate() method instead", "2.4")
def shutdown(): Unit
with one exception that the return type has changed. What was the reason of deprecating shutdown
? Was it not safe?
It appears that the deprecation was to follow the "terminate" convention used in other areas of the project, as well as exposing termination events.
The important part is the termination events:
The termination hooks allow system actors to perform final cleanup before the system shuts down or restarts - in this particular case it's to let remote systems know that any remote-deployed actors on the shutting down system are dead, but there are other cases where this gets used inside Akka core
See the following for more information:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With