Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any reason for deprecating shutdown method?

Tags:

akka

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?

like image 808
stella Avatar asked Jul 10 '16 12:07

stella


1 Answers

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:

  • The related Akka issue
  • The related Akka.NET issue
  • The Actor system shutdown section of their 2.3 to 2.4 migration guide
like image 177
blacktide Avatar answered Oct 07 '22 01:10

blacktide