class ClusterSingletonManager extends Actor with FSM[State, Data]
Manages singleton actor instance among all cluster nodes or a group of nodes tagged with a specific role. At most one singleton instance is running at any point in time.
The ClusterSingletonManager is supposed to be started on all nodes,
or all nodes with specified role, in the cluster with actorOf.
The actual singleton is started on the oldest node by creating a child
actor from the supplied singletonProps.
The singleton actor is always running on the oldest member with specified role. The oldest member is determined by pekko.cluster.Member#isOlderThan. This can change when removing members. A graceful hand over can normally be performed when current oldest node is leaving the cluster. Be aware that there is a short time period when there is no active singleton during the hand-over process.
The cluster failure detector will notice when oldest node becomes unreachable due to things like JVM crash, hard shut down, or network failure. When the crashed node has been removed (via down) from the cluster then a new oldest node will take over and a new singleton actor is created. For these failure scenarios there will not be a graceful hand-over, but more than one active singletons is prevented by all reasonable means. Some corner cases are eventually resolved by configurable timeouts.
You access the singleton actor with ClusterSingletonProxy. Alternatively the singleton actor may broadcast its existence when it is started.
Use factory method ClusterSingletonManager#props to create the pekko.actor.Props for the actor.
Not intended for subclassing by user code.
- Annotations
- @DoNotInherit()
- Alphabetic
- By Inheritance
- ClusterSingletonManager
- FSM
- ActorLogging
- Listeners
- Actor
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ClusterSingletonManager(singletonProps: Props, terminationMessage: Any, settings: ClusterSingletonManagerSettings)
- singletonProps
pekko.actor.Props of the singleton actor instance.
- terminationMessage
When handing over to a new oldest node this
terminationMessageis sent to the singleton actor to tell it to finish its work, close resources, and stop. The hand-over to the new oldest node is completed when the singleton actor is terminated. Note that pekko.actor.PoisonPill is a perfectly fineterminationMessageif you only need to stop the actor.- settings
Type Members
- type Event = actor.FSM.Event[Data]
- Definition Classes
- FSM
- type Receive = PartialFunction[Any, Unit]
- Definition Classes
- Actor
- type State = actor.FSM.State[ClusterSingletonManager.State, Data]
- Definition Classes
- FSM
- type StateFunction = PartialFunction[Event, State]
- Definition Classes
- FSM
- type StopEvent = actor.FSM.StopEvent[ClusterSingletonManager.State, Data]
- Definition Classes
- FSM
- type Timeout = Option[FiniteDuration]
- Definition Classes
- FSM
- final class TransformHelper extends AnyRef
- Definition Classes
- FSM
- type TransitionHandler = PartialFunction[(ClusterSingletonManager.State, ClusterSingletonManager.State), Unit]
- Definition Classes
- FSM
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- val ->: actor.FSM.->.type
- Definition Classes
- FSM
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val Event: actor.FSM.Event.type
- Definition Classes
- FSM
- val StateTimeout: actor.FSM.StateTimeout.type
- Definition Classes
- FSM
- val StopEvent: actor.FSM.StopEvent.type
- Definition Classes
- FSM
- def addRemoved(node: UniqueAddress): Unit
- def aroundPostRestart(reason: Throwable): Unit
- Attributes
- protected[pekko]
- Definition Classes
- Actor
- Annotations
- @InternalApi()
- def aroundPostStop(): Unit
- Attributes
- protected[pekko]
- Definition Classes
- Actor
- Annotations
- @InternalApi()
- def aroundPreRestart(reason: Throwable, message: Option[Any]): Unit
- Attributes
- protected[pekko]
- Definition Classes
- Actor
- Annotations
- @InternalApi()
- def aroundPreStart(): Unit
- Attributes
- protected[pekko]
- Definition Classes
- Actor
- Annotations
- @InternalApi()
- def aroundReceive(receive: actor.Actor.Receive, msg: Any): Unit
- Attributes
- protected[pekko]
- Definition Classes
- Actor
- Annotations
- @InternalApi()
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def cancelTimer(name: String): Unit
- Definition Classes
- FSM
- def cleanupOverdueNotMemberAnyMore(): Unit
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- val cluster: Cluster
- implicit val context: ActorContext
- Definition Classes
- Actor
- val coordShutdown: CoordinatedShutdown
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getNextOldestChanged(): Unit
- def gossip(msg: Any)(implicit sender: ActorRef): Unit
- Attributes
- protected
- Definition Classes
- Listeners
- final def goto(nextStateName: ClusterSingletonManager.State): State
- Definition Classes
- FSM
- def gotoHandingOver(singleton: Option[ActorRef], handOverTo: Option[ActorRef]): State
- def gotoOldest(): State
- Annotations
- @InternalStableApi()
- def gotoStopping(singleton: ActorRef): State
- def handOverDone(handOverTo: Option[ActorRef]): State
- def handleMemberEvent(event: MemberEvent): State
- def handleOldestChanged(singleton: Option[ActorRef], oldestOption: Option[UniqueAddress]): State
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def initialize(): Unit
- Definition Classes
- FSM
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def isTimerActive(name: String): Boolean
- Definition Classes
- FSM
- val lease: Option[Lease]
- val leaseRetryInterval: FiniteDuration
- def listenerManagement: actor.Actor.Receive
- Attributes
- protected
- Definition Classes
- Listeners
- val listeners: Set[ActorRef]
- Attributes
- protected
- Definition Classes
- Listeners
- val log: MarkerLoggingAdapter
- Definition Classes
- ClusterSingletonManager → ActorLogging
- def logInfo(template: String, arg1: Any, arg2: Any, arg3: Any): Unit
- def logInfo(marker: LogMarker, template: String, arg1: Any, arg2: Any): Unit
- def logInfo(template: String, arg1: Any, arg2: Any): Unit
- def logInfo(marker: LogMarker, template: String, arg1: Any): Unit
- def logInfo(template: String, arg1: Any): Unit
- def logInfo(marker: LogMarker, message: String): Unit
- def logInfo(message: String): Unit
- def logTermination(reason: Reason): Unit
- Attributes
- protected
- Definition Classes
- FSM
- val maxHandOverRetries: Int
- val maxTakeOverRetries: Int
- val memberExitingProgress: Promise[Done]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def nextStateData: Data
- Definition Classes
- FSM
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- var oldestChangedBuffer: ActorRef
- var oldestChangedReceived: Boolean
- final def onTermination(terminationHandler: PartialFunction[StopEvent, Unit]): Unit
- Definition Classes
- FSM
- final def onTransition(transitionHandler: TransitionHandler): Unit
- Definition Classes
- FSM
- def peer(at: Address): ActorSelection
- def postRestart(reason: Throwable): Unit
- Definition Classes
- Actor
- Annotations
- @throws(classOf[java.lang.Exception])
- def postStop(): Unit
- Definition Classes
- ClusterSingletonManager → FSM → Actor
- def preRestart(reason: Throwable, message: Option[Any]): Unit
- Definition Classes
- Actor
- Annotations
- @throws(classOf[java.lang.Exception])
- def preStart(): Unit
- Definition Classes
- ClusterSingletonManager → Actor
- var preparingForFullShutdown: Boolean
- def receive: Receive
- Definition Classes
- FSM → Actor
- val removalMargin: FiniteDuration
- var removed: Map[UniqueAddress, Deadline]
- def scheduleDelayedMemberRemoved(m: Member): Unit
- implicit final val self: ActorRef
- Definition Classes
- Actor
- var selfExited: Boolean
- def selfMemberExited(): Unit
- val selfUniqueAddressOption: Some[UniqueAddress]
- final def sender(): ActorRef
- Definition Classes
- Actor
- final def setStateTimeout(state: ClusterSingletonManager.State, timeout: Timeout): Unit
- Definition Classes
- FSM
- def startSingleTimer(name: String, msg: Any, delay: FiniteDuration): Unit
- Definition Classes
- FSM
- def startTimerAtFixedRate(name: String, msg: Any, interval: FiniteDuration): Unit
- Definition Classes
- FSM
- def startTimerWithFixedDelay(name: String, msg: Any, delay: FiniteDuration): Unit
- Definition Classes
- FSM
- final def startWith(stateName: ClusterSingletonManager.State, stateData: Data, timeout: Timeout): Unit
- Definition Classes
- FSM
- final def stateData: Data
- Definition Classes
- FSM
- final def stateName: ClusterSingletonManager.State
- Definition Classes
- FSM
- final def stay(): State
- Definition Classes
- FSM
- final def stop(reason: Reason, stateData: Data): State
- Definition Classes
- FSM
- final def stop(reason: Reason): State
- Definition Classes
- FSM
- final def stop(): State
- Definition Classes
- FSM
- def supervisorStrategy: SupervisorStrategy
- Definition Classes
- Actor
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- implicit final def total2pf(transitionHandler: (ClusterSingletonManager.State, ClusterSingletonManager.State) => Unit): TransitionHandler
- Definition Classes
- FSM
- final def transform(func: StateFunction): TransformHelper
- Definition Classes
- FSM
- def tryAcquireLease(): actor.FSM.State[ClusterSingletonManager.State, Data]
- def tryGotoOldest(): State
- def unhandled(message: Any): Unit
- Definition Classes
- Actor
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def when(stateName: ClusterSingletonManager.State, stateTimeout: FiniteDuration)(stateFunction: StateFunction): Unit
- Definition Classes
- FSM
- final def whenUnhandled(stateFunction: StateFunction): Unit
- Definition Classes
- FSM
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated
- final def setTimer(name: String, msg: Any, timeout: FiniteDuration, repeat: Boolean): Unit
- Definition Classes
- FSM
- Annotations
- @deprecated
- Deprecated
(Since version Akka 2.6.0) Use startSingleTimer, startTimerWithFixedDelay or startTimerAtFixedRate instead. This has the same semantics as startTimerAtFixedRate, but startTimerWithFixedDelay is often preferred.