public class RemoteWatcher
extends java.lang.Object
implements akka.actor.Actor, akka.actor.ActorLogging, akka.dispatch.RequiresMessageQueue<akka.dispatch.UnboundedMessageQueueSemantics>
Remote 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 corresponding
RemoteWatcher.WatchRemote
and RemoteWatcher.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 with RemoteWatcher.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 publish
AddressTerminated
to the AddressTerminatedTopic
.
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.
Modifier and Type | Class and Description |
---|---|
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$ |
Constructor and Description |
---|
RemoteWatcher(FailureDetectorRegistry<akka.actor.Address> failureDetector,
scala.concurrent.duration.FiniteDuration heartbeatInterval,
scala.concurrent.duration.FiniteDuration unreachableReaperInterval,
scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter) |
Modifier and Type | Method and Description |
---|---|
scala.collection.immutable.Map<akka.actor.Address,java.lang.Object> |
addressUids() |
void |
addWatch(akka.actor.InternalActorRef watchee,
akka.actor.InternalActorRef watcher) |
akka.actor.Cancellable |
failureDetectorReaperTask() |
akka.actor.Cancellable |
heartbeatTask() |
void |
postStop() |
static akka.actor.Props |
props(FailureDetectorRegistry<akka.actor.Address> failureDetector,
scala.concurrent.duration.FiniteDuration heartbeatInterval,
scala.concurrent.duration.FiniteDuration unreachableReaperInterval,
scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter)
Factory method for
RemoteWatcher Props . |
void |
publishAddressTerminated(akka.actor.Address address) |
void |
quarantine(akka.actor.Address address,
scala.Option<java.lang.Object> uid) |
void |
reapUnreachable() |
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive() |
void |
receiveHeartbeat() |
void |
receiveHeartbeatRsp(int uid) |
RemoteActorRefProvider |
remoteProvider() |
void |
removeWatch(akka.actor.InternalActorRef watchee,
akka.actor.InternalActorRef watcher) |
void |
removeWatchee(akka.actor.InternalActorRef watchee) |
void |
reWatch(akka.actor.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.
|
akka.actor.Scheduler |
scheduler() |
RemoteWatcher.HeartbeatRsp |
selfHeartbeatRspMsg() |
void |
sendHeartbeat() |
void |
terminated(akka.actor.InternalActorRef watchee,
boolean existenceConfirmed,
boolean addressTerminated) |
void |
triggerFirstHeartbeat(akka.actor.Address address) |
scala.collection.immutable.Set<akka.actor.Address> |
unreachable() |
void |
unwatchNode(akka.actor.Address watcheeAddress) |
scala.collection.mutable.HashMap<akka.actor.Address,scala.collection.mutable.Set<akka.actor.InternalActorRef>> |
watcheeByNodes() |
scala.collection.mutable.HashMap<akka.actor.InternalActorRef,scala.collection.mutable.Set<akka.actor.InternalActorRef>> |
watching() |
scala.collection.Set<akka.actor.Address> |
watchingNodes() |
void |
watchNode(akka.actor.InternalActorRef watchee) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public RemoteWatcher(FailureDetectorRegistry<akka.actor.Address> failureDetector, scala.concurrent.duration.FiniteDuration heartbeatInterval, scala.concurrent.duration.FiniteDuration unreachableReaperInterval, scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter)
public static akka.actor.Props props(FailureDetectorRegistry<akka.actor.Address> failureDetector, scala.concurrent.duration.FiniteDuration heartbeatInterval, scala.concurrent.duration.FiniteDuration unreachableReaperInterval, scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter)
RemoteWatcher
Props
.failureDetector
- (undocumented)heartbeatInterval
- (undocumented)unreachableReaperInterval
- (undocumented)heartbeatExpectedResponseAfter
- (undocumented)public akka.actor.Scheduler scheduler()
public RemoteActorRefProvider remoteProvider()
public RemoteWatcher.HeartbeatRsp selfHeartbeatRspMsg()
public scala.collection.mutable.HashMap<akka.actor.InternalActorRef,scala.collection.mutable.Set<akka.actor.InternalActorRef>> watching()
public scala.collection.mutable.HashMap<akka.actor.Address,scala.collection.mutable.Set<akka.actor.InternalActorRef>> watcheeByNodes()
public scala.collection.Set<akka.actor.Address> watchingNodes()
public scala.collection.immutable.Set<akka.actor.Address> unreachable()
public scala.collection.immutable.Map<akka.actor.Address,java.lang.Object> addressUids()
public akka.actor.Cancellable heartbeatTask()
public akka.actor.Cancellable failureDetectorReaperTask()
public void postStop()
postStop
in interface akka.actor.Actor
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
receive
in interface akka.actor.Actor
public void receiveHeartbeat()
public void receiveHeartbeatRsp(int uid)
public void reapUnreachable()
public void publishAddressTerminated(akka.actor.Address address)
public void quarantine(akka.actor.Address address, scala.Option<java.lang.Object> uid)
public void addWatch(akka.actor.InternalActorRef watchee, akka.actor.InternalActorRef watcher)
public void watchNode(akka.actor.InternalActorRef watchee)
public void removeWatch(akka.actor.InternalActorRef watchee, akka.actor.InternalActorRef watcher)
public void removeWatchee(akka.actor.InternalActorRef watchee)
public void unwatchNode(akka.actor.Address watcheeAddress)
public void terminated(akka.actor.InternalActorRef watchee, boolean existenceConfirmed, boolean addressTerminated)
public void sendHeartbeat()
public void triggerFirstHeartbeat(akka.actor.Address address)
public void reWatch(akka.actor.Address address)
address
- (undocumented)