Akka.Actor.RepointableActorRef.Initialize C# (CSharp) Method

Initialize() public method

Initialize: make a dummy cell which holds just a mailbox, then tell our supervisor that we exist so that he can create the real Cell in handleSupervise(). Call twice on your own peril! This is protected so that others can have different initialization.
public Initialize ( bool async ) : RepointableActorRef
async bool
return RepointableActorRef
        public RepointableActorRef Initialize(bool async)
        {
            var underlying = Underlying;
            if (underlying == null)
            {
                var newCell = new UnstartedCell(_system, this, _props, _supervisor);
                SwapUnderlying(newCell);
                SwapLookup(newCell);
                _supervisor.SendSystemMessage(new Supervise(this, async));
                if (!async)
                    Point();

                return this;
            }
            else
            {
                throw new IllegalStateException("initialize called more than once!");
            }
        }

Usage Example

示例#1
0
        private InternalActorRef CreateNoRouter(ActorSystemImpl system, Props props, InternalActorRef supervisor, ActorPath path,
                                                Deploy deploy, bool async)
        {
            if (props.Deploy != deploy)
            {
                props = props.WithDeploy(deploy);
            }
            var dispatcher = system.Dispatchers.FromConfig(props.Dispatcher);
            var mailbox    = _system.Mailboxes.CreateMailbox(props, null /*dispatcher.Configurator.Config*/);

            //TODO: Should be: system.mailboxes.getMailboxType(props2, dispatcher.configurator.config)
            if (async)
            {
                var reActorRef = new RepointableActorRef(system, props, dispatcher, () => mailbox, supervisor, path);
                reActorRef.Initialize(async: true);
                return(reActorRef);
            }
            return(new LocalActorRef(system, props, dispatcher, () => mailbox, supervisor, path));
        }
All Usage Examples Of Akka.Actor.RepointableActorRef::Initialize