Exemple #1
0
        /// <summary>
        /// Constructs a new ActorSystem with a name.
        /// </summary>
        /// <param name="name">the string name of the system</param>
        private ActorSystem(string name)
        {
            // top level
            Actor system        = new _System();
            var   systemContext =
                new ActorContext(
                    this,
                    typeof(_System),
                    system,
                    ActorPath.RootName,
                    new Props(),
                    ActorRef.None,
                    new ActorPath(ActorPath.SystemName));

            // user guardian
            Actor userGuardian        = new _UserGuardian();
            var   userGuardianContext =
                new ActorContext(
                    this,
                    typeof(_UserGuardian),
                    userGuardian,
                    "user",
                    new Props(),
                    systemContext.Self,
                    systemContext.Path);

            // system guardian
            Actor systemGuardian        = new _System();
            var   systemGuardianContext =
                new ActorContext(
                    this,
                    typeof(_System),
                    systemGuardian,
                    "sys",
                    new Props(),
                    systemContext.Self,
                    systemContext.Path);

            Context = userGuardianContext;

            SystemContext = systemGuardianContext;

            DeadLetters =
                SystemContext.ActorOf(
                    typeof(DeadLetters),
                    Props.None,
                    "deadLetters");

            Name = name;

            Scheduler = new Scheduler();

            StartTime = DateTime.Now;
        }
Exemple #2
0
        /// <summary>
        /// Constructs a new ActorSystem with a name.
        /// </summary>
        /// <param name="name">the string name of the system</param>
        private ActorSystem(string name)
        {
            // top level
            Actor system = new _System();
            var systemContext =
                new ActorContext(
                    this,
                    typeof(_System),
                    system,
                    ActorPath.RootName,
                    new Props(),
                    ActorRef.None,
                    new ActorPath(ActorPath.SystemName));

            // user guardian
            Actor userGuardian = new _UserGuardian();
            var userGuardianContext =
                new ActorContext(
                    this,
                    typeof(_UserGuardian),
                    userGuardian,
                    "user",
                    new Props(),
                    systemContext.Self,
                    systemContext.Path);

            // system guardian
            Actor systemGuardian = new _System();
            var systemGuardianContext =
                new ActorContext(
                    this,
                    typeof(_System),
                    systemGuardian,
                    "sys",
                    new Props(),
                    systemContext.Self,
                    systemContext.Path);

            Context = userGuardianContext;

            SystemContext = systemGuardianContext;

            DeadLetters =
                SystemContext.ActorOf(
                    typeof(DeadLetters),
                    Props.None,
                    "deadLetters");

            Name = name;

            Scheduler = new Scheduler();

            StartTime = DateTime.Now;
        }