Exemplo n.º 1
0
 protected AbstractStash(IActorContext context, int capacity = 100)
 {
     Context   = context;
     Self      = Context.Self;
     TheStash  = new LinkedList <Envelope>();
     ActorCell = context.AsInstanceOf <ActorCell>();
     Capacity  = 100;
 }
Exemplo n.º 2
0
        public override Routee NewRoutee(Props routeeProps, IActorContext context)
        {
            _nodeAddrEnumerator.MoveNext();
            var name   = "c" + _childNameCounter.GetAndIncrement();
            var deploy = new Deploy(routeeProps.RouterConfig, new RemoteScope(_nodeAddrEnumerator.Current));


            var actorRef = context.AsInstanceOf <ActorCell>()
                           .AttachChild(Local.EnrichWithPoolDispatcher(routeeProps, context).WithDeploy(deploy), false, name);

            return(new ActorRefRoutee(actorRef));
        }
Exemplo n.º 3
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="routeeProps">TBD</param>
        /// <param name="context">TBD</param>
        /// <returns>TBD</returns>
        internal override Routee NewRoutee(Props routeeProps, IActorContext context)
        {
            var name = "c" + _childNameCounter.IncrementAndGet();

            _nodeAddrEnumerator.MoveNext();

            var deploy = new Deploy(routeeProps.RouterConfig, new RemoteScope(_nodeAddrEnumerator.Current));

            // attachChild means that the provider will treat this call as if possibly done out of the wrong
            // context and use RepointableActorRef instead of LocalActorRef. Seems like a slightly sub-optimal
            // choice in a corner case (and hence not worth fixing).
            var actorRef = context.AsInstanceOf <ActorCell>()
                           .AttachChild(Local.EnrichWithPoolDispatcher(routeeProps, context).WithDeploy(deploy), false, name);

            return(new ActorRefRoutee(actorRef));
        }
Exemplo n.º 4
0
        public static IStash GetStash(this IActorContext context)
        {
            var actorCell = context.AsInstanceOf <ActorCell>();
            var actor     = actorCell.Actor;

            if (!(actor is IActorStash))
            {
                throw new NotSupportedException(string.Format("Cannot create stash for Actor {0} - needs to implement IActorStash interface", actor));
            }

            if (actor is WithBoundedStash)
            {
                return(new BoundedStashImpl(context));
            }

            if (actor is WithUnboundedStash)
            {
                return(new UnboundedStashImpl(context));
            }

            throw new ArgumentException(string.Format("Actor {0} implements unrecognized subclass of IActorStash - cannot instantiate", actor));
        }
Exemplo n.º 5
0
        public override Routee NewRoutee(Props routeeProps, IActorContext context)
        {
            _nodeAddrEnumerator.MoveNext();
            var name = "c" + _childNameCounter.GetAndIncrement();
            var deploy = new Deploy(routeeProps.RouterConfig, new RemoteScope(_nodeAddrEnumerator.Current));
            

            var actorRef = context.AsInstanceOf<ActorCell>()
                .AttachChild(Local.EnrichWithPoolDispatcher(routeeProps, context).WithDeploy(deploy), false, name);
            return new ActorRefRoutee(actorRef);
        }
Exemplo n.º 6
0
 protected AbstractStash(IActorContext context, int capacity = 100)
 {
     Context = context;
     Self = Context.Self;
     TheStash = new LinkedList<Envelope>();
     ActorCell = context.AsInstanceOf<ActorCell>();
     Capacity = 100;
 }