Init() public method

public Init ( bool sendSupervise, Func createMailbox ) : void
sendSupervise bool
createMailbox Func
return void
Exemplo n.º 1
0
        protected virtual ActorCell NewCell()
        {
            var actorCell = new ActorCell(_system, this, _props, _dispatcher, _supervisor);

            actorCell.Init(sendSupervise: false, createMailbox: _createMailbox);
            return(actorCell);
        }
Exemplo n.º 2
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <returns>TBD</returns>
        protected virtual ActorCell NewCell()
        {
            var actorCell = new ActorCell(System, this, Props, Dispatcher, Supervisor);

            actorCell.Init(false, MailboxType);
            return(actorCell);
        }
Exemplo n.º 3
0
        //This mimics what's done in Akka`s construction of an LocalActorRef.
        //The actorCell is created in the overridable newActorCell() during creation of the instance.
        //Since we don't want calls to virtual members in C# we must supply it.
        //
        //This is the code from Akka:
        //    private[akka] class LocalActorRef private[akka] (
        //        _system: ActorSystemImpl,
        //        _props: Props,
        //        _dispatcher: MessageDispatcher,
        //        _mailboxType: MailboxType,
        //        _supervisor: InternalActorRef,
        //        override val path: ActorPath) extends ActorRefWithCell with LocalRef {
        //      private val actorCell: ActorCell = newActorCell(_system, this, _props, _dispatcher, _supervisor)
        //      actorCell.init(sendSupervise = true, _mailboxType)
        //      ...
        //    }
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="system">TBD</param>
        /// <param name="props">TBD</param>
        /// <param name="dispatcher">TBD</param>
        /// <param name="mailboxType">TBD</param>
        /// <param name="supervisor">TBD</param>
        /// <param name="path">TBD</param>
        public LocalActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, MailboxType mailboxType,
                             IInternalActorRef supervisor, ActorPath path)
        {
            _system     = system;
            _props      = props;
            _dispatcher = dispatcher;
            MailboxType = mailboxType;
            _supervisor = supervisor;
            _path       = path;

            /*
             * Safe publication of this class’s fields is guaranteed by Mailbox.SetActor()
             * which is called indirectly from ActorCell.init() (if you’re wondering why
             * this is at all important, remember that under the CLR readonly fields are only
             * frozen at the _end_ of the constructor, but we are publishing "this" before
             * that is reached).
             * This means that the result of NewActorCell needs to be written to the field
             * _cell before we call init and start, since we can start using "this"
             * object from another thread as soon as we run init.
             */
            // ReSharper disable once VirtualMemberCallInConstructor
            _cell = NewActorCell(_system, this, _props, _dispatcher,
                                 _supervisor); // _cell needs to be assigned before Init is called.
            _cell.Init(true, MailboxType);
        }
Exemplo n.º 4
0
 //This mimics what's done in Akka`s construction of an LocalActorRef.
 //The actorCell is created in the overridable newActorCell() during creation of the instance.
 //Since we don't want calls to virtual members in C# we must supply it.
 //
 //This is the code from Akka:
 //    private[akka] class LocalActorRef private[akka] (
 //        _system: ActorSystemImpl,
 //        _props: Props,
 //        _dispatcher: MessageDispatcher,
 //        _mailboxType: MailboxType,
 //        _supervisor: InternalActorRef,
 //        override val path: ActorPath) extends ActorRefWithCell with LocalRef {
 //      private val actorCell: ActorCell = newActorCell(_system, this, _props, _dispatcher, _supervisor)
 //      actorCell.init(sendSupervise = true, _mailboxType)
 //      ...
 //    }
 public LocalActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, Func <Mailbox> createMailbox, InternalActorRef supervisor, ActorPath path) //TODO: switch from  Func<Mailbox> createMailbox to MailboxType mailboxType
     : this(system, props, dispatcher, createMailbox, supervisor, path, self =>
 {
     var cell = new ActorCell(system, self, props, dispatcher, supervisor);
     cell.Init(sendSupervise: true, createMailbox: createMailbox);
     return(cell);
 })
 {
     //Intentionally left blank
 }
Exemplo n.º 5
0
        //This mimics what's done in Akka`s construction of an LocalActorRef.
        //The actorCell is created in the overridable newActorCell() during creation of the instance.
        //Since we don't want calls to virtual members in C# we must supply it. 
        //
        //This is the code from Akka:
        //    private[akka] class LocalActorRef private[akka] (
        //        _system: ActorSystemImpl,
        //        _props: Props,
        //        _dispatcher: MessageDispatcher,
        //        _mailboxType: MailboxType,
        //        _supervisor: InternalActorRef,
        //        override val path: ActorPath) extends ActorRefWithCell with LocalRef {
        //      private val actorCell: ActorCell = newActorCell(_system, this, _props, _dispatcher, _supervisor)
        //      actorCell.init(sendSupervise = true, _mailboxType)
        //      ...
        //    }
        public LocalActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, Func<Mailbox> createMailbox, IInternalActorRef supervisor, ActorPath path) //TODO: switch from  Func<Mailbox> createMailbox to MailboxType mailboxType      
            : this(system, props, dispatcher, createMailbox, supervisor, path, self =>
            {
                var cell= new ActorCell(system, self, props, dispatcher, supervisor);
                cell.Init(sendSupervise: true, createMailbox: createMailbox);
                return cell;
            })
        {
            //Intentionally left blank

        }
Exemplo n.º 6
0
        //This mimics what's done in Akka`s construction of an LocalActorRef.
        //The actorCell is created in the overridable newActorCell() during creation of the instance.
        //Since we don't want calls to virtual members in C# we must supply it. 
        //
        //This is the code from Akka:
        //    private[akka] class LocalActorRef private[akka] (
        //        _system: ActorSystemImpl,
        //        _props: Props,
        //        _dispatcher: MessageDispatcher,
        //        _mailboxType: MailboxType,
        //        _supervisor: InternalActorRef,
        //        override val path: ActorPath) extends ActorRefWithCell with LocalRef {
        //      private val actorCell: ActorCell = newActorCell(_system, this, _props, _dispatcher, _supervisor)
        //      actorCell.init(sendSupervise = true, _mailboxType)
        //      ...
        //    }
        public LocalActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, MailboxType mailboxType, IInternalActorRef supervisor, ActorPath path) 
        {
            _system = system;
            _props = props;
            _dispatcher = dispatcher;
            MailboxType = mailboxType;
            _supervisor = supervisor;
            _path = path;

           /*
            * Safe publication of this class’s fields is guaranteed by Mailbox.SetActor()
            * which is called indirectly from ActorCell.init() (if you’re wondering why
            * this is at all important, remember that under the CLR readonly fields are only
            * frozen at the _end_ of the constructor, but we are publishing “this” before
            * that is reached).
            * This means that the result of NewActorCell needs to be written to the field
            * _cell before we call init and start, since we can start using "this"
            * object from another thread as soon as we run init.
            */
            // ReSharper disable once VirtualMemberCallInContructor 
            _cell = NewActorCell(_system, this, _props, _dispatcher, _supervisor); // _cell needs to be assigned before Init is called. 
            _cell.Init(true, MailboxType);
        }
Exemplo n.º 7
0
 protected virtual ActorCell NewCell()
 {
     var actorCell = new ActorCell(_system, this, _props, _dispatcher, _supervisor);
     actorCell.Init(sendSupervise: false, createMailbox: _createMailbox);
     return actorCell;
 }
Exemplo n.º 8
0
 protected virtual ActorCell NewCell()
 {
     var actorCell = new ActorCell(System, this, Props, Dispatcher, Supervisor);
     actorCell.Init(false, MailboxType);
     return actorCell;
 }