|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.cluster.Cluster
public class Cluster
This module is responsible for Gossiping cluster information. The abstraction maintains the list of live and dead members. Periodically i.e. every 1 second this module chooses a random member and initiates a round of Gossip with it.
During each round of gossip exchange it sends Gossip to random node with newer or older state information, if any, based on the current gossip overview, with some probability. Otherwise Gossip to any random live node.Example:
if (Cluster(system).isLeader) { ... }
Constructor Summary | |
---|---|
Cluster(ExtendedActorSystem system)
|
Method Summary | ||
---|---|---|
ActorRef |
clusterCore()
INTERNAL API |
|
static Cluster |
createExtension(ExtendedActorSystem system)
|
|
void |
down(Address address)
Send command to DOWN the node specified by 'address'. |
|
FailureDetector |
failureDetector()
|
|
static Cluster |
get(ActorSystem system)
|
|
boolean |
isTerminated()
Returns true if this cluster instance has be shutdown. |
|
void |
join(Address address)
Try to join this cluster node with the node specified by 'address'. |
|
void |
leave(Address address)
Send command to issue state transition to LEAVING for the node specified by 'address'. |
|
static Cluster$ |
lookup()
|
|
void |
publishCurrentClusterState()
Publish current (full) state of the cluster to subscribers, that are subscribing to ClusterEvent.ClusterDomainEvent
or ClusterEvent.CurrentClusterState . |
|
akka.cluster.ClusterReadView |
readView()
|
|
|
registerOnMemberUp(scala.Function0<T> code)
The supplied thunk will be run, once, when current cluster member is Up . |
|
void |
registerOnMemberUp(java.lang.Runnable callback)
Java API: The supplied callback will be run, once, when current cluster member is Up . |
|
Scheduler |
scheduler()
INTERNAL API |
|
Address |
selfAddress()
|
|
void |
sendCurrentClusterState(ActorRef receiver)
Publish current (full) state of the cluster to the specified receiver. |
|
ClusterSettings |
settings()
|
|
void |
subscribe(ActorRef subscriber,
java.lang.Class<?> to)
Subscribe to cluster domain events. |
|
ExtendedActorSystem |
system()
|
|
void |
unsubscribe(ActorRef subscriber)
Unsubscribe to all cluster domain events. |
|
void |
unsubscribe(ActorRef subscriber,
java.lang.Class<?> to)
Unsubscribe to a specific type of cluster domain events, matching previous subscribe registration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Cluster(ExtendedActorSystem system)
Method Detail |
---|
public static Cluster get(ActorSystem system)
public static Cluster$ lookup()
public static Cluster createExtension(ExtendedActorSystem system)
public ExtendedActorSystem system()
public ClusterSettings settings()
public Address selfAddress()
public FailureDetector failureDetector()
public Scheduler scheduler()
public ActorRef clusterCore()
public akka.cluster.ClusterReadView readView()
public boolean isTerminated()
public void subscribe(ActorRef subscriber, java.lang.Class<?> to)
to
Class can be ClusterEvent.ClusterDomainEvent
or subclass.
A snapshot of ClusterEvent.CurrentClusterState
will be sent to the subscriber as the first event. When
to
Class is a ClusterEvent.InstantMemberEvent
(or subclass) the snapshot event will instead be a
ClusterEvent.InstantClusterState
.
public void unsubscribe(ActorRef subscriber)
public void unsubscribe(ActorRef subscriber, java.lang.Class<?> to)
subscribe
registration.
public void publishCurrentClusterState()
ClusterEvent.ClusterDomainEvent
or ClusterEvent.CurrentClusterState
.
If you want this to happen periodically you need to schedule a call to
this method yourself.
public void sendCurrentClusterState(ActorRef receiver)
public void join(Address address)
public void leave(Address address)
public void down(Address address)
public <T> void registerOnMemberUp(scala.Function0<T> code)
Up
.
Typically used together with configuration option akka.cluster.min-nr-of-members'
to defer some action, such as starting actors, until the cluster has reached
a certain size.
public void registerOnMemberUp(java.lang.Runnable callback)
Up
.
Typically used together with configuration option akka.cluster.min-nr-of-members'
to defer some action, such as starting actors, until the cluster has reached
a certain size.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |