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);
     });
 }
Exemplo n.º 2
0
 internal static int SizeInner(SystemMessage head, int acc)
 {
     while (true)
     {
         if (head == null) return acc;
         head = head.Next;
         acc = acc + 1;
     }
 }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new message list.
 /// </summary>
 /// <param name="head">The current head item.</param>
 public LatestFirstSystemMessageList(SystemMessage head)
 {
     Head = head;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Unlinks this message from the linked list.
 /// </summary>
 public void Unlink()
 {
     Next = null;
 }
Exemplo n.º 6
0
 /// <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"));
     }
 }
Exemplo n.º 8
0
 internal override void SystemEnqueue(IActorRef receiver, SystemMessage message)
 {
     _deadLetters.Tell(new DeadLetter(message, receiver, receiver));
 }
Exemplo n.º 9
0
 protected void Stash(SystemMessage msg)
 {
     Assert.Assert(msg.Unlinked);
     _sysMsgStash = _sysMsgStash + msg;
 }
Exemplo n.º 10
0
 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;
     }
 }
Exemplo n.º 11
0
 /// <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);
 }
Exemplo n.º 12
0
 public LatestFirstSystemMessageList(SystemMessage head)
 {
     Head = head;
 }
Exemplo n.º 13
0
 public void Unlink()
 {
     Next = null;
 }
Exemplo n.º 14
0
 public EarliestFirstSystemMessageList(SystemMessage head)
 {
     Head = head;
 }
Exemplo n.º 15
0
 private void SendSystemMessage(SystemMessage message)
 {
     Mailbox.DebugPrint("EmptyLocalActorRef {0} having enqueued {1}", Path, message);
     SpecialHandle(message, _provider.DeadLetters);
 }
Exemplo n.º 16
0
 /// <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);
 }
Exemplo n.º 17
0
        /// <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 _                         ⇒
            //}
        }
Exemplo n.º 18
0
 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)));
 }