=clu #18345 Support local address in cluster commands
* and clarify the doc sample for leave
This commit is contained in:
parent
4cbfe3d682
commit
f98b4c1f5e
6 changed files with 113 additions and 7 deletions
|
|
@ -158,7 +158,9 @@ above.
|
|||
|
||||
A more graceful exit can be performed if you tell the cluster that a node shall leave.
|
||||
This can be performed using :ref:`cluster_jmx_java` or :ref:`cluster_command_line_java`.
|
||||
It can also be performed programmatically with ``Cluster.get(system).leave(address)``.
|
||||
It can also be performed programmatically with:
|
||||
|
||||
.. includecode:: code/docs/cluster/ClusterDocTest.java#leave
|
||||
|
||||
Note that this command can be issued to any member in the cluster, not necessarily the
|
||||
one that is leaving. The cluster extension, but not the actor system or JVM, of the
|
||||
|
|
|
|||
41
akka-docs/rst/java/code/docs/cluster/ClusterDocTest.java
Normal file
41
akka-docs/rst/java/code/docs/cluster/ClusterDocTest.java
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
package docs.cluster;
|
||||
|
||||
import com.typesafe.config.ConfigFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.cluster.Cluster;
|
||||
import akka.testkit.JavaTestKit;
|
||||
|
||||
|
||||
public class ClusterDocTest {
|
||||
|
||||
static ActorSystem system;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() {
|
||||
system = ActorSystem.create("ClusterDocTest",
|
||||
ConfigFactory.parseString(ClusterDocSpec.config()));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown() {
|
||||
JavaTestKit.shutdownActorSystem(system);
|
||||
system = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void demonstrateLeave() {
|
||||
//#leave
|
||||
final Cluster cluster = Cluster.get(system);
|
||||
cluster.leave(cluster.selfAddress());
|
||||
//#leave
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue