clu #17565 Invoke OnMemberRemoved callback when
cluster.shutdown * must also be done when the listener actor stops before the MemberRemoved event has been received * add test for this * clarify docs with example that shuts down actor system and exit jvm
This commit is contained in:
parent
ba8756d485
commit
8a7d7715b5
6 changed files with 60 additions and 13 deletions
|
|
@ -107,7 +107,8 @@ An actor system can only join a cluster once. Additional attempts will be ignore
|
|||
When it has successfully joined it must be restarted to be able to join another
|
||||
cluster or to join the same cluster again.It can use the same host name and port
|
||||
after the restart, when it come up as new incarnation of existing member in the cluster,
|
||||
trying to join in ,then the existing one will be removed from the cluster and then it will be allowed to join.
|
||||
trying to join in, then the existing one will be removed from the cluster and then it will
|
||||
be allowed to join.
|
||||
|
||||
.. _automatic-vs-manual-downing-scala:
|
||||
|
||||
|
|
@ -281,15 +282,21 @@ has at least the defined number of members.
|
|||
|
||||
This callback can be used for other things than starting actors.
|
||||
|
||||
How To Cleanup when Member is Removed
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
You can do some clean up in a ``registerOnMemberRemoved`` callback, which will
|
||||
be invoked when the current member status is changed to 'Removed' or the cluster have been shutdown,i.e.
|
||||
terminate the actor system.
|
||||
|
||||
For example, this is how to shut down the ``ActorSystem`` and thereafter exit the JVM:
|
||||
|
||||
.. includecode:: ../../../akka-samples/akka-sample-cluster-scala/src/main/scala/sample/cluster/factorial/FactorialFrontend.scala#registerOnRemoved
|
||||
|
||||
.. note:: Register a OnMemberRemoved callback on a cluster that have been shutdown, the callback will be invoked immediately on
|
||||
.. note::
|
||||
Register a OnMemberRemoved callback on a cluster that have been shutdown, the callback will be invoked immediately on
|
||||
the caller thread, otherwise it will be invoked later when the current member status changed to 'Removed'. You may
|
||||
want to install some cleanup handling after the cluster was started up,but the cluster might already be shutting
|
||||
want to install some cleanup handling after the cluster was started up, but the cluster might already be shutting
|
||||
down when you installing, and depending on the race is not healthy.
|
||||
|
||||
Cluster Singleton
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue