Наследование: Akka.Actor.ActorRefWithCell, ILocalRef
Пример #1
0
 public PreRestartException(LocalActorRef actor, Exception restartException, Exception cause,
     object optionalMessage)
 {
     Actor = actor;
     e = restartException;
     exception = cause;
     this.optionalMessage = optionalMessage;
 }
Пример #2
0
        public ActorCell(ActorSystem system, string name, Mailbox mailbox)
        {
            Parent = null;

            System     = system;
            Self       = new LocalActorRef(new RootActorPath(System.Provider.Address, name), this);
            Props      = null;
            Dispatcher = System.Dispatchers.FromConfig("akka.actor.default-dispatcher");
            mailbox.Setup(Dispatcher);
            Mailbox           = mailbox;
            Mailbox.ActorCell = this;
        }
Пример #3
0
        private LocalActorRef CreateSystemGuardian(LocalActorRef rootGuardian, string name, LocalActorRef userGuardian)     //Corresponds to Akka's: override lazy val guardian: systemGuardian
        {
            //TODO: When SystemGuardianActor has been implemented switch to this:
            //return CreateRootGuardianChild(rootGuardian, name, () =>
            //{
            //    var props = Props.Create(() => new SystemGuardianActor(userGuardian), _systemGuardianStrategy);

            //    var systemGuardian = new LocalActorRef(_system, props, DefaultDispatcher, _defaultMailbox, rootGuardian, RootPath / name);
            //    return systemGuardian;
            //});
            return((LocalActorRef)rootGuardian.Cell.ActorOf <GuardianActor>(name));
        }
Пример #4
0
        private LocalActorRef CreateSystemGuardian(LocalActorRef rootGuardian, string name, LocalActorRef userGuardian)     //Corresponds to Akka's: override lazy val guardian: systemGuardian
        {
            var cell = rootGuardian.Cell;

            cell.ReserveChild(name);
            var props = Props.Create(() => new SystemGuardianActor(userGuardian), _systemGuardianStrategy);

            var systemGuardian = new LocalActorRef(_system, props, InternalDispatcher, _defaultMailbox, rootGuardian, RootPath / name);

            cell.InitChild(systemGuardian);
            systemGuardian.Start();
            return(systemGuardian);
        }
Пример #5
0
        private LocalActorRef CreateUserGuardian(LocalActorRef rootGuardian, string name)   //Corresponds to Akka's: override lazy val guardian: LocalActorRef
        {
            var cell = rootGuardian.Cell;

            cell.ReserveChild(name);
            var props = Props.Create <GuardianActor>(UserGuardianSupervisorStrategy);

            var userGuardian = new LocalActorRef(_system, props, DefaultDispatcher, _defaultMailbox, rootGuardian, RootPath / name);

            cell.InitChild(userGuardian);
            userGuardian.Start();
            return(userGuardian);
        }
Пример #6
0
        public void Init(ActorSystemImpl system)
        {
            _system = system;
            //The following are the lazy val statements in Akka
            var defaultDispatcher = system.Dispatchers.DefaultGlobalDispatcher;

            _defaultMailbox = () => new ConcurrentQueueMailbox(); //TODO:system.Mailboxes.FromConfig(Mailboxes.DefaultMailboxId)
            _rootGuardian   = CreateRootGuardian(system);
            _tempContainer  = new VirtualPathContainer(system.Provider, _tempNode, _rootGuardian, _log);
            _rootGuardian.SetTempContainer(_tempContainer);
            _userGuardian   = CreateUserGuardian(_rootGuardian, "user");
            _systemGuardian = CreateSystemGuardian(_rootGuardian, "system", _userGuardian);
            //End of lazy val

            _rootGuardian.Start();
            // chain death watchers so that killing guardian stops the application
            _systemGuardian.Tell(new Watch(_userGuardian, _systemGuardian));    //Should be SendSystemMessage
            _rootGuardian.Tell(new Watch(_systemGuardian, _rootGuardian));      //Should be SendSystemMessage
            _eventStream.StartDefaultLoggers(_system);
        }
Пример #7
0
        public void Init(ActorSystemImpl system)
        {
            _system = system;
            //The following are the lazy val statements in Akka
            var defaultDispatcher = system.Dispatchers.DefaultGlobalDispatcher;
            _defaultMailbox = () => new ConcurrentQueueMailbox(); //TODO:system.Mailboxes.FromConfig(Mailboxes.DefaultMailboxId)
            _rootGuardian = CreateRootGuardian(system);
            _tempContainer = new VirtualPathContainer(system.Provider, _tempNode, _rootGuardian, _log);
            _rootGuardian.SetTempContainer(_tempContainer);
            _userGuardian = CreateUserGuardian(_rootGuardian, "user");
            _systemGuardian = CreateSystemGuardian(_rootGuardian, "system", _userGuardian);
            //End of lazy val

            _rootGuardian.Start();
            // chain death watchers so that killing guardian stops the application
            _systemGuardian.SendSystemMessage(new Watch(_userGuardian, _systemGuardian)); 
            _rootGuardian.SendSystemMessage(new Watch(_systemGuardian, _rootGuardian)); 
            _eventStream.StartDefaultLoggers(_system);
        }
Пример #8
0
 private LocalActorRef CreateRootGuardianChild(LocalActorRef rootGuardian, string name, Func<LocalActorRef> childCreator)
 {
     var cell = rootGuardian.Cell;
     cell.ReserveChild(name);
     var child = childCreator();
     cell.InitChild(child);
     child.Start();
     return child;
 }
Пример #9
0
        private LocalActorRef CreateSystemGuardian(LocalActorRef rootGuardian, string name, LocalActorRef userGuardian)     //Corresponds to Akka's: override lazy val guardian: systemGuardian
        {
            return CreateRootGuardianChild(rootGuardian, name, () =>
            {
                var props = Props.Create(() => new SystemGuardianActor(userGuardian), _systemGuardianStrategy);

                var systemGuardian = new LocalActorRef(_system, props, DefaultDispatcher, _defaultMailbox, rootGuardian, RootPath/name);
                return systemGuardian;
            });
        }
Пример #10
0
        private LocalActorRef CreateUserGuardian(LocalActorRef rootGuardian, string name)   //Corresponds to Akka's: override lazy val guardian: LocalActorRef
        {
            return CreateRootGuardianChild(rootGuardian, name, () =>
            {
                var props = Props.Create<GuardianActor>(UserGuardianSupervisorStrategy);

                var userGuardian = new LocalActorRef(_system, props, DefaultDispatcher, _defaultMailbox, rootGuardian, RootPath/name);
                return userGuardian;
            });         
        }
Пример #11
0
        private LocalActorRef CreateSystemGuardian(LocalActorRef rootGuardian, string name, LocalActorRef userGuardian)     //Corresponds to Akka's: override lazy val guardian: systemGuardian
        {
            return(CreateRootGuardianChild(rootGuardian, name, () =>
            {
                var props = Props.Create(() => new SystemGuardianActor(userGuardian), _systemGuardianStrategy);

                var systemGuardian = new LocalActorRef(_system, props, DefaultDispatcher, _defaultMailbox, rootGuardian, RootPath / name);
                return systemGuardian;
            }));
        }
Пример #12
0
 protected static ActorCell NewActorCell(ActorSystem system, LocalActorRef actorRef, Props props, MessageDispatcher dispatcher, IInternalActorRef supervisor, Func<Mailbox> createMailbox)
 {
     var cell = new TestActorCell((ActorSystemImpl)system, actorRef, props, dispatcher, supervisor);
     cell.Init(sendSupervise: true, createMailbox: createMailbox);
     return cell;
 }
Пример #13
0
        private LocalActorRef CreateSystemGuardian(LocalActorRef rootGuardian, string name, LocalActorRef userGuardian)     //Corresponds to Akka's: override lazy val guardian: systemGuardian
        {
            //TODO: When SystemGuardianActor has been implemented switch to this:
            //return CreateRootGuardianChild(rootGuardian, name, () =>
            //{
            //    var props = Props.Create(() => new SystemGuardianActor(userGuardian), _systemGuardianStrategy);

            //    var systemGuardian = new LocalActorRef(_system, props, DefaultDispatcher, _defaultMailbox, rootGuardian, RootPath / name);
            //    return systemGuardian;
            //});   
            return (LocalActorRef)rootGuardian.Cell.ActorOf<GuardianActor>(name);           
        }
Пример #14
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="StopChild" /> class.
 /// </summary>
 /// <param name="child">The child.</param>
 public StopChild(LocalActorRef child)
 {
     Child = child;
 }
Пример #15
0
        private LocalActorRef CreateSystemGuardian(LocalActorRef rootGuardian, string name, LocalActorRef userGuardian)     //Corresponds to Akka's: override lazy val guardian: systemGuardian
        {
            var cell = rootGuardian.Cell;
            cell.ReserveChild(name);
            var props = Props.Create(() => new SystemGuardianActor(userGuardian), _systemGuardianStrategy);

            var systemGuardian = new LocalActorRef(_system, props, DefaultDispatcher, _defaultMailbox, rootGuardian, RootPath / name);
            cell.InitChild(systemGuardian);
            systemGuardian.Start();
            return systemGuardian;
        }
Пример #16
0
        private LocalActorRef CreateUserGuardian(LocalActorRef rootGuardian, string name)   //Corresponds to Akka's: override lazy val guardian: LocalActorRef
        {
            var cell = rootGuardian.Cell;
            cell.ReserveChild(name);
            var props = Props.Create<GuardianActor>(UserGuardianSupervisorStrategy);

            var userGuardian = new LocalActorRef(_system, props, DefaultDispatcher, _defaultMailbox, rootGuardian, RootPath / name);
            cell.InitChild(userGuardian);
            userGuardian.Start();
            return userGuardian;
        }