stella
stella

Reputation: 2596

Any reason for deprecating shutdown method?

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?

Upvotes: 9

Views: 3659

Answers (1)

blacktide
blacktide

Reputation: 12126

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:

Upvotes: 8

Related Questions