Class RemoteWatcher
- java.lang.Object
-
- akka.remote.RemoteWatcher
-
- All Implemented Interfaces:
Actor
,ActorLogging
,RequiresMessageQueue<UnboundedMessageQueueSemantics>
- Direct Known Subclasses:
ClusterRemoteWatcher
public class RemoteWatcher extends java.lang.Object implements Actor, ActorLogging, RequiresMessageQueue<UnboundedMessageQueueSemantics>
INTERNAL APIRemote nodes with actors that are watched are monitored by this actor to be able to detect network failures and JVM crashes.
RemoteActorRefProvider
intercepts Watch and Unwatch system messages and sends correspondingRemoteWatcher.WatchRemote
andRemoteWatcher.UnwatchRemote
to this actor.For a new node to be watched this actor periodically sends
RemoteWatcher.Heartbeat
to the peer actor on the other node, which replies withRemoteWatcher.HeartbeatRsp
message back. The failure detector on the watching side monitors these heartbeat messages. If arrival of heartbeat messages stops it will be detected and this actor will publishAddressTerminated
to theAddressTerminatedTopic
.When all actors on a node have been unwatched it will stop sending heartbeat messages.
For bi-directional watch between two nodes the same thing will be established in both directions, but independent of each other.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RemoteWatcher.ArteryHeartbeat$
static class
RemoteWatcher.ArteryHeartbeatRsp
static class
RemoteWatcher.ArteryHeartbeatRsp$
static class
RemoteWatcher.ExpectedFirstHeartbeat
static class
RemoteWatcher.ExpectedFirstHeartbeat$
static class
RemoteWatcher.Heartbeat$
static class
RemoteWatcher.HeartbeatRsp
static class
RemoteWatcher.HeartbeatRsp$
static class
RemoteWatcher.HeartbeatTick$
static class
RemoteWatcher.ReapUnreachableTick$
static class
RemoteWatcher.Stats
static class
RemoteWatcher.Stats$
static class
RemoteWatcher.UnwatchRemote
static class
RemoteWatcher.UnwatchRemote$
static class
RemoteWatcher.WatchRemote
static class
RemoteWatcher.WatchRemote$
-
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$
-
-
Constructor Summary
Constructors Constructor Description RemoteWatcher(FailureDetectorRegistry<Address> failureDetector, scala.concurrent.duration.FiniteDuration heartbeatInterval, scala.concurrent.duration.FiniteDuration unreachableReaperInterval, scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description scala.collection.immutable.Map<Address,java.lang.Object>
addressUids()
void
addressUids_$eq(scala.collection.immutable.Map<Address,java.lang.Object> x$1)
void
addWatch(InternalActorRef watchee, InternalActorRef watcher)
protected void
akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
Scala API: Stores the context for this actor, including self, and sender.protected void
akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
The 'self' field holds the ActorRef for this actor.boolean
artery()
ActorContext
context()
Scala API: Stores the context for this actor, including self, and sender.Cancellable
failureDetectorReaperTask()
HeartbeatMessage
heartBeatMsg()
Cancellable
heartbeatTask()
void
postStop()
User overridable callback.static Props
props(RemoteSettings settings, FailureDetectorRegistry<Address> failureDetector)
Factory method forRemoteWatcher
Props
.void
publishAddressTerminated(Address address)
void
quarantine(Address address, scala.Option<java.lang.Object> uid, java.lang.String reason, boolean harmless)
void
reapUnreachable()
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
receive()
Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.void
receiveHeartbeat()
void
receiveHeartbeatRsp(long uid)
RemoteActorRefProvider
remoteProvider()
void
removeWatch(InternalActorRef watchee, InternalActorRef watcher)
void
removeWatchee(InternalActorRef watchee)
void
reWatch(Address address)
To ensure that we receive heartbeat messages from the right actor system incarnation we send Watch again for the first HeartbeatRsp (containing the system UID) and if HeartbeatRsp contains a new system UID.Scheduler
scheduler()
ActorRef
self()
The 'self' field holds the ActorRef for this actor.HeartbeatMessage
selfHeartbeatRspMsg()
void
sendHeartbeat()
protected boolean
shouldWatch(InternalActorRef watchee)
Returns true if either has cluster orakka.remote.use-unsafe-remote-features-outside-cluster
is enabled.void
terminated(InternalActorRef watchee, boolean existenceConfirmed, boolean addressTerminated)
void
triggerFirstHeartbeat(Address address)
scala.collection.immutable.Set<Address>
unreachable()
void
unreachable_$eq(scala.collection.immutable.Set<Address> x$1)
void
unwatchNode(Address watcheeAddress)
scala.collection.mutable.HashMap<Address,scala.collection.mutable.Set<InternalActorRef>>
watcheeByNodes()
scala.collection.mutable.HashMap<InternalActorRef,scala.collection.mutable.Set<InternalActorRef>>
watching()
scala.collection.Set<Address>
watchingNodes()
void
watchNode(InternalActorRef watchee)
-
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, postRestart, preRestart, preStart, sender, supervisorStrategy, unhandled
-
Methods inherited from interface akka.actor.ActorLogging
_log_$eq, log
-
-
-
-
Constructor Detail
-
RemoteWatcher
public RemoteWatcher(FailureDetectorRegistry<Address> failureDetector, scala.concurrent.duration.FiniteDuration heartbeatInterval, scala.concurrent.duration.FiniteDuration unreachableReaperInterval, scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter)
-
-
Method Detail
-
props
public static Props props(RemoteSettings settings, FailureDetectorRegistry<Address> failureDetector)
Factory method forRemoteWatcher
Props
.
-
context
public ActorContext context()
Description copied from interface:Actor
Scala API: Stores the context for this actor, including self, and sender. It is implicit to support operations such asforward
.WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API.getContext
returns aAbstractActor.ActorContext
, which is the Java API of the actor context.
-
self
public final ActorRef self()
Description copied from interface:Actor
The 'self' field holds the ActorRef for this actor. Can be used to send messages to itself:self ! message
-
akka$actor$Actor$_setter_$context_$eq
protected void akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
Description copied from interface:Actor
Scala API: Stores the context for this actor, including self, and sender. It is implicit to support operations such asforward
.WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API.getContext
returns aAbstractActor.ActorContext
, which is the Java API of the actor context.- Specified by:
akka$actor$Actor$_setter_$context_$eq
in interfaceActor
-
akka$actor$Actor$_setter_$self_$eq
protected final void akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
Description copied from interface:Actor
The 'self' field holds the ActorRef for this actor. Can be used to send messages to itself:self ! message
- Specified by:
akka$actor$Actor$_setter_$self_$eq
in interfaceActor
-
scheduler
public Scheduler scheduler()
-
remoteProvider
public RemoteActorRefProvider remoteProvider()
-
artery
public boolean artery()
-
heartBeatMsg
public HeartbeatMessage heartBeatMsg()
-
selfHeartbeatRspMsg
public HeartbeatMessage selfHeartbeatRspMsg()
-
watching
public scala.collection.mutable.HashMap<InternalActorRef,scala.collection.mutable.Set<InternalActorRef>> watching()
-
watcheeByNodes
public scala.collection.mutable.HashMap<Address,scala.collection.mutable.Set<InternalActorRef>> watcheeByNodes()
-
watchingNodes
public scala.collection.Set<Address> watchingNodes()
-
unreachable
public scala.collection.immutable.Set<Address> unreachable()
-
unreachable_$eq
public void unreachable_$eq(scala.collection.immutable.Set<Address> x$1)
-
addressUids
public scala.collection.immutable.Map<Address,java.lang.Object> addressUids()
-
addressUids_$eq
public void addressUids_$eq(scala.collection.immutable.Map<Address,java.lang.Object> x$1)
-
heartbeatTask
public Cancellable heartbeatTask()
-
failureDetectorReaperTask
public Cancellable failureDetectorReaperTask()
-
postStop
public void postStop()
Description copied from interface:Actor
User overridable callback. Is called asynchronously after 'actor.stop()' is invoked. Empty default implementation.
-
receive
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Description copied from interface:Actor
Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.
-
receiveHeartbeat
public void receiveHeartbeat()
-
receiveHeartbeatRsp
public void receiveHeartbeatRsp(long uid)
-
reapUnreachable
public void reapUnreachable()
-
publishAddressTerminated
public void publishAddressTerminated(Address address)
-
quarantine
public void quarantine(Address address, scala.Option<java.lang.Object> uid, java.lang.String reason, boolean harmless)
-
shouldWatch
protected boolean shouldWatch(InternalActorRef watchee)
Returns true if either has cluster orakka.remote.use-unsafe-remote-features-outside-cluster
is enabled. Can be overridden when using RemoteWatcher as a superclass.
-
addWatch
public void addWatch(InternalActorRef watchee, InternalActorRef watcher)
-
watchNode
public void watchNode(InternalActorRef watchee)
-
removeWatch
public void removeWatch(InternalActorRef watchee, InternalActorRef watcher)
-
removeWatchee
public void removeWatchee(InternalActorRef watchee)
-
unwatchNode
public void unwatchNode(Address watcheeAddress)
-
terminated
public void terminated(InternalActorRef watchee, boolean existenceConfirmed, boolean addressTerminated)
-
sendHeartbeat
public void sendHeartbeat()
-
triggerFirstHeartbeat
public void triggerFirstHeartbeat(Address address)
-
reWatch
public void reWatch(Address address)
To ensure that we receive heartbeat messages from the right actor system incarnation we send Watch again for the first HeartbeatRsp (containing the system UID) and if HeartbeatRsp contains a new system UID. Terminated will be triggered if the watchee (including correct Actor UID) does not exist.
-
-