Esempio n. 1
0
 public RemoteRouterConfig(Pool local, IEnumerable<Address> nodes) : base(local.NrOfInstances,local.Resizer,local.SupervisorStrategy,local.RouterDispatcher,local.UsePoolDispatcher)
 {
     
     Local = local;
     Nodes = nodes.ToList();
     if (!Nodes.Any()) throw new ArgumentException("Must specify list of remote target nodes.", "nodes");
     _nodeAddrEnumerator = Nodes.GetContinuousEnumerator();
 }
        public ResizablePoolCell(ActorSystemImpl system, IInternalActorRef self, Props routerProps, MessageDispatcher dispatcher, Props routeeProps, IInternalActorRef supervisor, Pool pool)
            : base(system,self, routerProps,dispatcher, routeeProps, supervisor)
        {
            if (pool.Resizer == null) throw new ArgumentException("RouterConfig must be a Pool with defined resizer");

            resizer = pool.Resizer;
            _routerProps = routerProps;
            _pool = pool;
            _resizeCounter = new AtomicCounterLong(0);
            _resizeInProgress = new AtomicBoolean();
        }
Esempio n. 3
0
        public ResizablePoolCell(ActorSystem system, InternalActorRef supervisor, Props routerProps,
            Props routeeProps, ActorPath path, Mailbox mailbox, Pool pool)
            : base(system, supervisor, routerProps, routeeProps, path, mailbox)
        {
            if (pool.Resizer == null)
                throw new ArgumentException("RouterConfig must be a Pool with defined resizer");

            resizer = pool.Resizer;
            this._pool = pool;
            this._resizeCounter = 0;
            this._resizeInProgress = ResizeInProgressState.False;
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RouterPoolActor"/> class.
        /// </summary>
        /// <param name="supervisorStrategy">The supervisor strategy.</param>
        /// <exception cref="ActorInitializationException"></exception>
        public RouterPoolActor(SupervisorStrategy supervisorStrategy)
        {
            _supervisorStrategy = supervisorStrategy;

            var pool = Cell.RouterConfig as Pool;
            if (pool != null)
            {
                Pool = pool;
            }
            else
            {
                throw new ActorInitializationException($"RouterPoolActor can only be used with Pool, not {Cell.RouterConfig.GetType()}");
            }
        }
Esempio n. 5
0
 public RouterConfig Copy(Pool local = null, IEnumerable<Address> nodes = null)
 {
     return new RemoteRouterConfig(local ?? Local, nodes ?? Nodes);
 }
 public RouterConfig Copy(Pool local = null, ClusterRouterPoolSettings settings = null)
 {
     return new ClusterRouterPool(local ?? (Pool)Local, settings ?? (ClusterRouterPoolSettings)Settings);
 }
        public ClusterRouterPool(Pool local, ClusterRouterPoolSettings settings)
        {
            Settings = settings;
            Local = local;
            RouterDispatcher = local.RouterDispatcher;

            if(local.Resizer != null) throw new ConfigurationException("Resizer can't be used together with cluster router.");
            NrOfInstances = Settings.AllowLocalRoutees ? settings.MaxInstancesPerNode : 0;
            Resizer = local.Resizer;
            SupervisorStrategy = local.SupervisorStrategy;
        }
Esempio n. 8
0
        public ClusterRouterPoolActor(SupervisorStrategy supervisorStrategy, ClusterRouterPoolSettings settings) : base(settings)
        {
            _supervisorStrategy = supervisorStrategy;
            Settings = settings;

            var pool = Cell.RouterConfig as Pool;
            if (pool != null)
            {
                Pool = pool;
            }
            else
            {
                throw new ActorInitializationException("RouterPoolActor can only be used with Pool, not " +
                                                       Cell.RouterConfig.GetType());
            }
        }
Esempio n. 9
0
 internal RouterConfig Copy(Pool local = null, ClusterRouterPoolSettings settings = null)
 {
     return new ClusterRouterPool(local ?? Local, settings ?? Settings);
 }
Esempio n. 10
0
 public ClusterRouterPool(Pool local, ClusterRouterPoolSettings settings)
     : base(settings.AllowLocalRoutees ? settings.MaxInstancesPerNode : 0,
     local.Resizer,
     local.SupervisorStrategy,
     local.RouterDispatcher,
     false)
 {
     if (local.Resizer != null)
         throw new ConfigurationException("Resizer can't be used together with cluster router.");
     Settings = settings;
     Local = local;
 }