akka.remote
Class RemoteWatcher
java.lang.Object
akka.remote.RemoteWatcher
- All Implemented Interfaces:
- akka.actor.Actor, akka.actor.ActorLogging, akka.dispatch.RequiresMessageQueue<akka.dispatch.UnboundedMessageQueueSemantics>
public class RemoteWatcher
- extends java.lang.Object
- implements akka.actor.Actor, akka.actor.ActorLogging, akka.dispatch.RequiresMessageQueue<akka.dispatch.UnboundedMessageQueueSemantics>
INTERNAL API
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 hearbeat 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.
| Nested classes/interfaces inherited from interface akka.actor.Actor |
akka.actor.Actor.emptyBehavior$ |
|
Constructor Summary |
RemoteWatcher(FailureDetectorRegistry<akka.actor.Address> failureDetector,
scala.concurrent.duration.FiniteDuration heartbeatInterval,
scala.concurrent.duration.FiniteDuration unreachableReaperInterval,
scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter)
|
|
Method Summary |
scala.collection.immutable.Map<akka.actor.Address,java.lang.Object> |
addressUids()
|
void |
addWatching(akka.actor.ActorRef watchee,
akka.actor.ActorRef watcher)
|
void |
checkLastUnwatchOfNode(akka.actor.Address watcheeAddress)
|
akka.actor.Cancellable |
failureDetectorReaperTask()
|
akka.actor.Cancellable |
heartbeatTask()
|
void |
logActorForDeprecationWarning(akka.actor.ActorRef watchee)
|
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 |
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. |
void |
rewatchRemote(akka.actor.ActorRef watchee,
akka.actor.ActorRef watcher)
|
akka.actor.Scheduler |
scheduler()
|
RemoteWatcher.HeartbeatRsp |
selfHeartbeatRspMsg()
|
void |
sendHeartbeat()
|
void |
terminated(akka.actor.ActorRef watchee,
boolean existenceConfirmed,
boolean addressTerminated)
|
void |
triggerFirstHeartbeat(akka.actor.Address address)
|
scala.collection.immutable.Set<akka.actor.Address> |
unreachable()
|
void |
unwatchRemote(akka.actor.ActorRef watchee,
akka.actor.ActorRef watcher)
|
scala.collection.immutable.Set<scala.Tuple2<akka.actor.ActorRef,akka.actor.ActorRef>> |
watching()
|
scala.collection.immutable.Set<akka.actor.Address> |
watchingNodes()
|
void |
watchRemote(akka.actor.ActorRef watchee,
akka.actor.ActorRef watcher)
|
| 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 |
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, postRestart, preRestart, preStart, self, sender, supervisorStrategy, unhandled |
| Methods inherited from interface akka.actor.ActorLogging |
akka$actor$ActorLogging$$_log_$eq, akka$actor$ActorLogging$$_log, log |
RemoteWatcher
public RemoteWatcher(FailureDetectorRegistry<akka.actor.Address> failureDetector,
scala.concurrent.duration.FiniteDuration heartbeatInterval,
scala.concurrent.duration.FiniteDuration unreachableReaperInterval,
scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter)
props
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)
- Factory method for
RemoteWatcher Props.
scheduler
public akka.actor.Scheduler scheduler()
remoteProvider
public RemoteActorRefProvider remoteProvider()
selfHeartbeatRspMsg
public RemoteWatcher.HeartbeatRsp selfHeartbeatRspMsg()
watching
public scala.collection.immutable.Set<scala.Tuple2<akka.actor.ActorRef,akka.actor.ActorRef>> watching()
watchingNodes
public scala.collection.immutable.Set<akka.actor.Address> watchingNodes()
unreachable
public scala.collection.immutable.Set<akka.actor.Address> unreachable()
addressUids
public scala.collection.immutable.Map<akka.actor.Address,java.lang.Object> addressUids()
heartbeatTask
public akka.actor.Cancellable heartbeatTask()
failureDetectorReaperTask
public akka.actor.Cancellable failureDetectorReaperTask()
postStop
public void postStop()
- Specified by:
postStop in interface akka.actor.Actor
receive
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
- Specified by:
receive in interface akka.actor.Actor
receiveHeartbeat
public void receiveHeartbeat()
receiveHeartbeatRsp
public void receiveHeartbeatRsp(int uid)
reapUnreachable
public void reapUnreachable()
publishAddressTerminated
public void publishAddressTerminated(akka.actor.Address address)
quarantine
public void quarantine(akka.actor.Address address,
scala.Option<java.lang.Object> uid)
rewatchRemote
public void rewatchRemote(akka.actor.ActorRef watchee,
akka.actor.ActorRef watcher)
watchRemote
public void watchRemote(akka.actor.ActorRef watchee,
akka.actor.ActorRef watcher)
addWatching
public void addWatching(akka.actor.ActorRef watchee,
akka.actor.ActorRef watcher)
unwatchRemote
public void unwatchRemote(akka.actor.ActorRef watchee,
akka.actor.ActorRef watcher)
logActorForDeprecationWarning
public void logActorForDeprecationWarning(akka.actor.ActorRef watchee)
terminated
public void terminated(akka.actor.ActorRef watchee,
boolean existenceConfirmed,
boolean addressTerminated)
checkLastUnwatchOfNode
public void checkLastUnwatchOfNode(akka.actor.Address watcheeAddress)
sendHeartbeat
public void sendHeartbeat()
triggerFirstHeartbeat
public void triggerFirstHeartbeat(akka.actor.Address address)
reWatch
public 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.
Terminated will be triggered if the watchee (including correct Actor UID)
does not exist.