Пример #1
0
        public static Unit Restart()
        {
            ObservableRouter.Restart();

            ActorConfig config = ActorConfig.Default;

            if (system != null)
            {
                system.Shutdown();
            }

            Store = map(tuple("", (IProcess)null));

            // Root
            root = new Actor <Unit, object>(new ProcessId(), config.RootProcessName, Process.pub);

            // Top tier
            system = new Actor <Unit, object>(root.Id, config.SystemProcessName, Process.pub);
            self   = user = new Actor <Unit, object>(root.Id, config.UserProcessName, Process.pub);

            // Second tier
            deadLetters = new Actor <Unit, object>(system.Id, config.DeadLettersProcessName, Process.pub);

            noSender   = new Actor <Unit, object>(system.Id, config.NoSenderProcessName, Process.pub);
            registered = new Actor <Unit, object>(system.Id, config.RegisteredProcessName, Process.pub);

            return(unit);
        }
        public ActorSystemState(Option <ICluster> cluster, ProcessId rootId, IActor rootProcess, IActorInbox rootInbox, ProcessName rootProcessName, ActorConfig config)
        {
            var parent = new ActorItem(new NullProcess(), new NullInbox(), ProcessFlags.Default);

            rootProcess = new Actor <ActorSystemState, Unit>(
                cluster,
                parent,
                rootProcessName,
                ActorSystem.Inbox,
                _ => this,
                null,
                Process.DefaultStrategy,
                ProcessFlags.Default
                );

            root            = new ActorItem(rootProcess, RootInbox, rootProcess.Flags);
            Config          = config;
            Cluster         = cluster;
            RootProcess     = rootProcess;
            RootInbox       = rootInbox;
            RootProcessName = rootProcessName;
        }