/// <summary>
        /// Initialized SimulationActorRefs when necessary and LocalActorRefs otherwise.
        /// </summary>
        /// <param name="system"></param>
        /// <param name="props"></param>
        /// <param name="supervisor"></param>
        /// <param name="path"></param>
        /// <param name="systemService"></param>
        /// <param name="deploy"></param>
        /// <param name="lookupDeploy"></param>
        /// <param name="async"></param>
        /// <returns></returns>
        public IInternalActorRef ActorOf(ActorSystemImpl system, Props props, IInternalActorRef supervisor, ActorPath path,
                                         bool systemService, Deploy deploy, bool lookupDeploy, bool async)
        {
            // TODO: This should definitely be moved somewhere else.
            if (!system.Dispatchers.HasDispatcher(CallingThreadDispatcher.Id))
            {
                system.Dispatchers.RegisterConfigurator(
                    CallingThreadDispatcher.Id,
                    new CallingThreadDispatcherConfigurator(system.Settings.Config, system.Dispatchers.Prerequisites)
                    );
            }

            // If the instance that needs to be created is
            // - a SystemService
            // - or a Router
            // just return a regular LocalActorRef, because
            // we currently do not render messages sent to the router or system messages.
            if (systemService || !(props.Deploy.RouterConfig is NoRouter))
            {
                return(_localActorRefProvider.ActorOf(system, props.WithDispatcher(CallingThreadDispatcher.Id), supervisor, path, systemService, deploy, lookupDeploy, async));
            }

            // Create dispatchers and mailboxes according to the configurations.
            var dispatcher  = system.Dispatchers.Lookup(CallingThreadDispatcher.Id);
            var mailboxType = system.Mailboxes.GetMailboxType(props, dispatcher.Configurator.Config);

            return(new SimulationActorRef(SimulationMessageDelegate, system, props, dispatcher, mailboxType, supervisor, path));
        }
예제 #2
0
        public IInternalActorRef ActorOf(ActorSystemImpl system, Props props, IInternalActorRef supervisor, ActorPath path,
                                         bool systemService, Deploy deploy, bool lookupDeploy, bool async)
        {
            IInternalActorRef ret;

            if (typeof(TracedActor).IsAssignableFrom(props.Type))
            {
                props = props.WithMailbox("traced-mailbox");
                ret   = _delegate.ActorOf(system, props, supervisor, path, systemService, deploy, lookupDeploy, async);
            }
            else
            {
                ret = _delegate.ActorOf(system, props, supervisor, path, systemService, deploy, lookupDeploy, async);
            }

            return(ret);
        }