public class RemoteWatcher extends java.lang.Object implements Actor, ActorLogging, RequiresMessageQueue<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.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$ |
Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
RemoteWatcher(FailureDetectorRegistry<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<Address,java.lang.Object> |
addressUids() |
void |
addWatch(InternalActorRef watchee,
InternalActorRef watcher) |
protected abstract static void |
akka$actor$Actor$_setter_$context_$eq(ActorContext x$1) |
protected abstract static void |
akka$actor$Actor$_setter_$self_$eq(ActorRef x$1) |
static void |
akka$actor$ActorLogging$$_log_$eq(LoggingAdapter x$1) |
static LoggingAdapter |
akka$actor$ActorLogging$$_log() |
protected static void |
aroundPostRestart(java.lang.Throwable reason) |
protected static void |
aroundPostStop() |
protected static void |
aroundPreRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
protected static void |
aroundPreStart() |
protected static void |
aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
java.lang.Object msg) |
boolean |
artery() |
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
Cancellable |
failureDetectorReaperTask() |
HeartbeatMessage |
heartBeatMsg() |
Cancellable |
heartbeatTask() |
static LoggingAdapter |
log() |
static void |
postRestart(java.lang.Throwable reason) |
void |
postStop()
User overridable callback.
|
static void |
preRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
static void |
preStart() |
static Props |
props(FailureDetectorRegistry<Address> failureDetector,
scala.concurrent.duration.FiniteDuration heartbeatInterval,
scala.concurrent.duration.FiniteDuration unreachableReaperInterval,
scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter)
Factory method for
RemoteWatcher Props . |
void |
publishAddressTerminated(Address address) |
void |
quarantine(Address address,
scala.Option<java.lang.Object> uid,
java.lang.String reason) |
void |
reapUnreachable() |
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.
|
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() |
static ActorRef |
sender() |
void |
sendHeartbeat() |
static SupervisorStrategy |
supervisorStrategy() |
void |
terminated(InternalActorRef watchee,
boolean existenceConfirmed,
boolean addressTerminated) |
void |
triggerFirstHeartbeat(Address address) |
static void |
unhandled(java.lang.Object message) |
scala.collection.immutable.Set<Address> |
unreachable() |
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, preRestart, preStart, sender, supervisorStrategy, unhandled
log
public RemoteWatcher(FailureDetectorRegistry<Address> failureDetector, scala.concurrent.duration.FiniteDuration heartbeatInterval, scala.concurrent.duration.FiniteDuration unreachableReaperInterval, scala.concurrent.duration.FiniteDuration heartbeatExpectedResponseAfter)
public static Props props(FailureDetectorRegistry<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 static final ActorRef sender()
protected static void aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, java.lang.Object msg)
protected static void aroundPreStart()
protected static void aroundPostStop()
protected static void aroundPreRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message)
protected static void aroundPostRestart(java.lang.Throwable reason)
public static SupervisorStrategy supervisorStrategy()
public static void preStart() throws java.lang.Exception
java.lang.Exception
public static void preRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message) throws java.lang.Exception
java.lang.Exception
public static void postRestart(java.lang.Throwable reason) throws java.lang.Exception
java.lang.Exception
public static void unhandled(java.lang.Object message)
protected abstract static void akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
protected abstract static void akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
public static LoggingAdapter akka$actor$ActorLogging$$_log()
public static void akka$actor$ActorLogging$$_log_$eq(LoggingAdapter x$1)
public static LoggingAdapter log()
public ActorContext context()
Actor
forward
.
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 a
UntypedActorContext
, which is the Java API of the actor
context.
public final ActorRef self()
Actor
self ! message
public Scheduler scheduler()
public RemoteActorRefProvider remoteProvider()
public boolean artery()
public HeartbeatMessage heartBeatMsg()
public HeartbeatMessage selfHeartbeatRspMsg()
public scala.collection.mutable.HashMap<InternalActorRef,scala.collection.mutable.Set<InternalActorRef>> watching()
public scala.collection.mutable.HashMap<Address,scala.collection.mutable.Set<InternalActorRef>> watcheeByNodes()
public scala.collection.Set<Address> watchingNodes()
public scala.collection.immutable.Set<Address> unreachable()
public scala.collection.immutable.Map<Address,java.lang.Object> addressUids()
public Cancellable heartbeatTask()
public Cancellable failureDetectorReaperTask()
public void postStop()
Actor
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Actor
public void receiveHeartbeat()
public void receiveHeartbeatRsp(long uid)
public void reapUnreachable()
public void publishAddressTerminated(Address address)
public void quarantine(Address address, scala.Option<java.lang.Object> uid, java.lang.String reason)
public void addWatch(InternalActorRef watchee, InternalActorRef watcher)
public void watchNode(InternalActorRef watchee)
public void removeWatch(InternalActorRef watchee, InternalActorRef watcher)
public void removeWatchee(InternalActorRef watchee)
public void unwatchNode(Address watcheeAddress)
public void terminated(InternalActorRef watchee, boolean existenceConfirmed, boolean addressTerminated)
public void sendHeartbeat()
public void triggerFirstHeartbeat(Address address)
public void reWatch(Address address)
address
- (undocumented)