akka.cluster
Class ClusterCoreDaemon

java.lang.Object
  extended by akka.cluster.ClusterCoreDaemon
All Implemented Interfaces:
Actor, ActorLogging, RequiresMessageQueue<UnboundedMessageQueueSemantics>

public class ClusterCoreDaemon
extends java.lang.Object
implements Actor, ActorLogging, RequiresMessageQueue<UnboundedMessageQueueSemantics>

INTERNAL API.


Nested Class Summary
 class ClusterCoreDaemon.Ignored
           
 class ClusterCoreDaemon.Merge
           
 class ClusterCoreDaemon.Newer
           
 class ClusterCoreDaemon.Older
           
static interface ClusterCoreDaemon.ReceiveGossipType
          The types of gossip actions that receive gossip has performed.
 class ClusterCoreDaemon.Same
           
 
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$
 
Constructor Summary
ClusterCoreDaemon(ActorRef publisher)
           
 
Method Summary
 double adjustedGossipDifferentViewProbability()
          For large clusters we should avoid shooting down individual nodes.
 void becomeInitialized()
           
 void becomeUninitialized()
           
 Cluster cluster()
           
 void downing(Address address)
          State transition to DOWN.
 Cancellable failureDetectorReaperTask()
           
 void gossip()
          Initiates a new round of gossip.
 void gossipSpeedupTick()
           
 GossipStats gossipStats()
           
 void gossipStatusTo(UniqueAddress node)
           
 void gossipStatusTo(UniqueAddress node, ActorRef destination)
           
 Cancellable gossipTask()
           
 void gossipTick()
           
 void gossipTo(UniqueAddress node)
          Gossips latest gossip to a node.
 void gossipTo(UniqueAddress node, ActorRef destination)
           
 akka.cluster.ClusterCoreDaemon.Ignored$ Ignored()
           
 scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> initialized()
           
 void initJoin()
           
 boolean isGossipSpeedupNeeded()
           
 boolean isSingletonCluster()
           
 void join(Address address)
          Try to join this cluster node with the node specified by address.
 void joining(UniqueAddress node, scala.collection.immutable.Set<java.lang.String> roles)
          State transition to JOINING - new node joining.
 void joinSeedNodes(scala.collection.immutable.IndexedSeq<Address> seedNodes)
           
 Gossip latestGossip()
           
 int leaderActionCounter()
           
 void leaderActions()
          Runs periodic leader actions, such as member status transitions, assigning partitions etc.
 void leaderActionsOnConvergence()
          Leader actions are as follows: 1.
 Cancellable leaderActionsTask()
           
 void leaving(Address address)
          State transition to LEAVING.
 akka.cluster.ClusterCoreDaemon.Merge$ Merge()
           
 akka.cluster.ClusterCoreDaemon.Newer$ Newer()
           
 int NumberOfGossipsBeforeShutdownWhenLeaderExits()
           
 akka.cluster.ClusterCoreDaemon.Older$ Older()
           
 void postStop()
          User overridable callback.
 void preStart()
          User overridable callback.
 void publish(Gossip newGossip)
           
 void publishInternalStats()
           
 scala.Option<Cancellable> publishStatsTask()
           
 void quarantined(UniqueAddress node)
           
 void reapUnreachableMembers()
          Reaps the unreachable members according to the failure detector's verdict.
 scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
          This defines the initial actor behavior, it must return a partial function with the actor logic.
 ClusterCoreDaemon.ReceiveGossipType receiveGossip(GossipEnvelope envelope)
          Receive new gossip.
 void receiveGossipStatus(GossipStatus status)
           
 scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> removed()
           
 akka.cluster.ClusterCoreDaemon.Same$ Same()
           
 scala.Option<ActorRef> seedNodeProcess()
           
 int seedNodeProcessCounter()
           
 scala.Option<UniqueAddress> selectRandomNode(scala.collection.IndexedSeq<UniqueAddress> nodes)
           
protected  UniqueAddress selfUniqueAddress()
           
 void sendGossipTo(Address address)
           
 void shutdown()
          This method is called when a member sees itself as Exiting or Down.
 boolean statsEnabled()
           
 void stopSeedNodeProcess()
           
 scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> tryingToJoin(Address joinWith, scala.Option<scala.concurrent.duration.Deadline> deadline)
           
 void unhandled(java.lang.Object message)
          User overridable callback.
 scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> uninitialized()
           
 void updateLatestGossip(Gossip newGossip)
           
 boolean validNodeForGossip(UniqueAddress node)
           
 java.lang.String vclockName(UniqueAddress node)
           
 java.lang.String vclockNode()
           
 void welcome(Address joinWith, UniqueAddress from, Gossip gossip)
          Reply from Join request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface akka.actor.Actor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, postRestart, preRestart, self, sender, supervisorStrategy
 
Methods inherited from interface akka.actor.ActorLogging
_log, log
 

Constructor Detail

ClusterCoreDaemon

public ClusterCoreDaemon(ActorRef publisher)
Method Detail

cluster

public Cluster cluster()

selfUniqueAddress

protected UniqueAddress selfUniqueAddress()

NumberOfGossipsBeforeShutdownWhenLeaderExits

public int NumberOfGossipsBeforeShutdownWhenLeaderExits()

vclockName

public java.lang.String vclockName(UniqueAddress node)

vclockNode

public java.lang.String vclockNode()

latestGossip

public Gossip latestGossip()

statsEnabled

public boolean statsEnabled()

gossipStats

public GossipStats gossipStats()

seedNodeProcess

public scala.Option<ActorRef> seedNodeProcess()

seedNodeProcessCounter

public int seedNodeProcessCounter()

leaderActionCounter

public int leaderActionCounter()

gossipTask

public Cancellable gossipTask()

failureDetectorReaperTask

public Cancellable failureDetectorReaperTask()

leaderActionsTask

public Cancellable leaderActionsTask()

publishStatsTask

public scala.Option<Cancellable> publishStatsTask()

preStart

public void preStart()
Description copied from interface: Actor
User overridable callback.

Is called when an Actor is started. Actors are automatically started asynchronously when created. Empty default implementation.

Specified by:
preStart in interface Actor

postStop

public void postStop()
Description copied from interface: Actor
User overridable callback.

Is called asynchronously after 'actor.stop()' is invoked. Empty default implementation.

Specified by:
postStop in interface Actor

uninitialized

public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> uninitialized()

tryingToJoin

public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> tryingToJoin(Address joinWith,
                                                                                    scala.Option<scala.concurrent.duration.Deadline> deadline)

becomeUninitialized

public void becomeUninitialized()

becomeInitialized

public void becomeInitialized()

initialized

public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> initialized()

removed

public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> removed()

receive

public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Description copied from interface: Actor
This defines the initial actor behavior, it must return a partial function with the actor logic.

Specified by:
receive in interface Actor
Returns:
(undocumented)

unhandled

public void unhandled(java.lang.Object message)
Description copied from interface: Actor
User overridable callback.

Is called when a message isn't handled by the current behavior of the actor by default it fails with either a DeathPactException (in case of an unhandled Terminated message) or publishes an UnhandledMessage to the actor's system's EventStream

Specified by:
unhandled in interface Actor
Parameters:
message - (undocumented)

initJoin

public void initJoin()

joinSeedNodes

public void joinSeedNodes(scala.collection.immutable.IndexedSeq<Address> seedNodes)

join

public void join(Address address)
Try to join this cluster node with the node specified by address. It's only allowed to join from an empty state, i.e. when not already a member. A Join(selfUniqueAddress) command is sent to the node to join, which will reply with a Welcome message.

Parameters:
address - (undocumented)

stopSeedNodeProcess

public void stopSeedNodeProcess()

joining

public void joining(UniqueAddress node,
                    scala.collection.immutable.Set<java.lang.String> roles)
State transition to JOINING - new node joining. Received Join message and replies with Welcome message, containing current gossip state, including the new joining member.

Parameters:
node - (undocumented)
roles - (undocumented)

welcome

public void welcome(Address joinWith,
                    UniqueAddress from,
                    Gossip gossip)
Reply from Join request.

Parameters:
joinWith - (undocumented)
from - (undocumented)
gossip - (undocumented)

leaving

public void leaving(Address address)
State transition to LEAVING. The node will eventually be removed by the leader, after hand-off in EXITING, and only after removal a new node with same address can join the cluster through the normal joining procedure.

Parameters:
address - (undocumented)

shutdown

public void shutdown()
This method is called when a member sees itself as Exiting or Down.


downing

public void downing(Address address)
State transition to DOWN. Its status is set to DOWN. The node is also removed from the seen table.

The node will eventually be removed by the leader, and only after removal a new node with same address can join the cluster through the normal joining procedure.

Parameters:
address - (undocumented)

quarantined

public void quarantined(UniqueAddress node)

receiveGossipStatus

public void receiveGossipStatus(GossipStatus status)

Ignored

public akka.cluster.ClusterCoreDaemon.Ignored$ Ignored()

Older

public akka.cluster.ClusterCoreDaemon.Older$ Older()

Newer

public akka.cluster.ClusterCoreDaemon.Newer$ Newer()

Same

public akka.cluster.ClusterCoreDaemon.Same$ Same()

Merge

public akka.cluster.ClusterCoreDaemon.Merge$ Merge()

receiveGossip

public ClusterCoreDaemon.ReceiveGossipType receiveGossip(GossipEnvelope envelope)
Receive new gossip.

Parameters:
envelope - (undocumented)
Returns:
(undocumented)

gossipTick

public void gossipTick()

gossipSpeedupTick

public void gossipSpeedupTick()

isGossipSpeedupNeeded

public boolean isGossipSpeedupNeeded()

gossip

public void gossip()
Initiates a new round of gossip.


adjustedGossipDifferentViewProbability

public double adjustedGossipDifferentViewProbability()
For large clusters we should avoid shooting down individual nodes. Therefore the probability is reduced for large clusters.

Returns:
(undocumented)

leaderActions

public void leaderActions()
Runs periodic leader actions, such as member status transitions, assigning partitions etc.


leaderActionsOnConvergence

public void leaderActionsOnConvergence()
Leader actions are as follows: 1. Move JOINING => UP -- When a node joins the cluster 2. Move LEAVING => EXITING -- 3. Non-exiting remain -- 4. Move unreachable EXITING => REMOVED -- When all nodes have seen the EXITING node as unreachable (convergence) - remove the node from the node ring and seen table 5. Move unreachable DOWN/EXITING => REMOVED -- When all nodes have seen that the node is DOWN/EXITING (convergence) - remove the node from the node ring and seen table 7. Updating the vclock version for the changes 8. Updating the seen table 9. Update the state with the new gossip


reapUnreachableMembers

public void reapUnreachableMembers()
Reaps the unreachable members according to the failure detector's verdict.


selectRandomNode

public scala.Option<UniqueAddress> selectRandomNode(scala.collection.IndexedSeq<UniqueAddress> nodes)

isSingletonCluster

public boolean isSingletonCluster()

sendGossipTo

public void sendGossipTo(Address address)

gossipTo

public void gossipTo(UniqueAddress node)
Gossips latest gossip to a node.

Parameters:
node - (undocumented)

gossipTo

public void gossipTo(UniqueAddress node,
                     ActorRef destination)

gossipStatusTo

public void gossipStatusTo(UniqueAddress node,
                           ActorRef destination)

gossipStatusTo

public void gossipStatusTo(UniqueAddress node)

validNodeForGossip

public boolean validNodeForGossip(UniqueAddress node)

updateLatestGossip

public void updateLatestGossip(Gossip newGossip)

publish

public void publish(Gossip newGossip)

publishInternalStats

public void publishInternalStats()