private void SendSystemMessage(SystemMessage systemMessage) { _stopped.IfOff(() => { var failed = systemMessage as Failed; if(failed != null) { var cause = failed.Cause; var child = failed.Child; _log.Error(cause, "guardian {0} failed, shutting down!", child); CauseOfTermination = cause; ((InternalActorRef) child).Stop(); return; } var supervise = systemMessage as Supervise; if(supervise != null) { // This comment comes from AKKA: TO DO register child in some map to keep track of it and enable shutdown after all dead return; } var deathWatchNotification = systemMessage as DeathWatchNotification; if(deathWatchNotification != null) { Stop(); return; } _log.Error("{0} received unexpected system message [{1}]",_path,systemMessage); }); }
internal static int SizeInner(SystemMessage head, int acc) { while (true) { if (head == null) return acc; head = head.Next; acc = acc + 1; } }
internal static SystemMessage ReverseInner(SystemMessage head, SystemMessage acc) { while (true) { if (head == null) return acc; var next = head.Next; head.Next = acc; var head1 = head; head = next; acc = head1; } }
/// <summary> /// Creates a new message list. /// </summary> /// <param name="head">The current head item.</param> public LatestFirstSystemMessageList(SystemMessage head) { Head = head; }
/// <summary> /// Unlinks this message from the linked list. /// </summary> public void Unlink() { Next = null; }
/// <summary> /// Creates a new message list. /// </summary> /// <param name="head">The current head item.</param> public EarliestFirstSystemMessageList(SystemMessage head) { Head = head; }
private void SendSystemMessage(SystemMessage systemMessage) { try { Self.Tell(systemMessage); } catch (Exception e) { _systemImpl.EventStream.Publish(new Error(e, _self.Parent.ToString(), ActorType, "Swallowing exception during message send")); } }
internal override void SystemEnqueue(IActorRef receiver, SystemMessage message) { _deadLetters.Tell(new DeadLetter(message, receiver, receiver)); }
protected void Stash(SystemMessage msg) { Assert.Assert(msg.Unlinked); _sysMsgStash = _sysMsgStash + msg; }
private static bool ShouldStash(SystemMessage m, int state) { switch (state) { case SuspendedWaitForChildrenState: return m is IStashWhenWaitingForChildren; case SuspendedState: return m is IStashWhenFailed; case DefaultState: default: return false; } }
/// <summary> /// Dispatches a <see cref="SystemMessage"/> from a mailbox to an <see cref="ActorCell"/> /// </summary> public virtual void SystemDispatch(ActorCell cell, SystemMessage message) { var mbox = cell.Mailbox; mbox.SystemEnqueue(cell.Self, message); RegisterForExecution(mbox, false, true); }
public LatestFirstSystemMessageList(SystemMessage head) { Head = head; }
public void Unlink() { Next = null; }
public EarliestFirstSystemMessageList(SystemMessage head) { Head = head; }
private void SendSystemMessage(SystemMessage message) { Mailbox.DebugPrint("EmptyLocalActorRef {0} having enqueued {1}", Path, message); SpecialHandle(message, _provider.DeadLetters); }
/// <summary> /// Sends the system message. /// </summary> /// <param name="message">The message.</param> private void SendSystemMessage(SystemMessage message) { Remote.Send(message, null, this); Provider.AfterSendSystemMessage(message); }
/// <summary> /// Afters the send system message. /// </summary> /// <param name="message">The message.</param> public void AfterSendSystemMessage(SystemMessage message) { message.Match() .With<Watch>(m => { }) .With<Unwatch>(m => { }); // message match { // // Sending to local remoteWatcher relies strong delivery guarantees of local send, i.e. // // default dispatcher must not be changed to an implementation that defeats that // case rew: RemoteWatcher.Rewatch ⇒ // remoteWatcher ! RemoteWatcher.RewatchRemote(rew.watchee, rew.watcher) // case Watch(watchee, watcher) ⇒ remoteWatcher ! RemoteWatcher.WatchRemote(watchee, watcher) // case Unwatch(watchee, watcher) ⇒ remoteWatcher ! RemoteWatcher.UnwatchRemote(watchee, watcher) // case _ ⇒ //} }
protected void SendSystemMessage(SystemMessage message, ActorRef sender) { PatternMatch.Match(message) .With<Terminate>(t => Stop()) .With<DeathWatchNotification>(d => Tell(new Terminated(d.Actor, d.ExistenceConfirmed, d.AddressTerminated))); }