コード例 #1
0
ファイル: Random.cs プロジェクト: Micha-kun/akka.net
 /// <summary>
 /// Initializes a new instance of the <see cref="RandomPool"/> class.
 /// </summary>
 /// <param name="nrOfInstances">The initial number of routees in the pool.</param>
 /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param>
 /// <param name="supervisorStrategy">The strategy to use when supervising the pool.</param>
 /// <param name="routerDispatcher">The dispatcher to use when passing messages to the routees.</param>
 /// <param name="usePoolDispatcher"><c>true</c> to use the pool dispatcher; otherwise <c>false</c>.</param>
 public RandomPool(
     int nrOfInstances,
     Resizer resizer,
     SupervisorStrategy supervisorStrategy,
     string routerDispatcher,
     bool usePoolDispatcher = false)
     : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher)
 {
 }
コード例 #2
0
        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();
        }
コード例 #3
0
ファイル: ResizablePoolCell.cs プロジェクト: pdoh00/akka.net
        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;
        }
コード例 #4
0
 /// <summary>
 /// </summary>
 /// <param name="nrOfInstances">The nr of instances.</param>
 /// <param name="resizer">The resizer.</param>
 /// <param name="supervisorStrategy">The supervisor strategy.</param>
 /// <param name="routerDispatcher">The router dispatcher.</param>
 /// <param name="usePoolDispatcher">if set to <c>true</c> [use pool dispatcher].</param>
 public ScatterGatherFirstCompletedPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy,
     string routerDispatcher,TimeSpan within, bool usePoolDispatcher = false)
     : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher)
 {
     _within = within;
 }
コード例 #5
0
ファイル: RoundRobin.cs プロジェクト: juergenhoetzel/akka.net
 /// <summary>
 /// Initializes a new instance of the <see cref="RoundRobinPool"/> class.
 /// 
 /// <note>
 /// A <see cref="RoundRobinPool"/> configured in this way uses the <see cref="Pool.DefaultStrategy"/> supervisor strategy.
 /// </note>
 /// </summary>
 /// <param name="nrOfInstances">The initial number of routees in the pool.</param>
 /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param>
 public RoundRobinPool(int nrOfInstances, Resizer resizer) : base(nrOfInstances, resizer, DefaultStrategy, null) { }
コード例 #6
0
 /// <summary>
 /// Creates a new <see cref="ScatterGatherFirstCompletedPool" /> router with a given <see cref="Resizer" />.
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer" />.</returns>
 public override Pool WithResizer(Resizer resizer)
 {
     return new ScatterGatherFirstCompletedPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, _within, UsePoolDispatcher);
 }
コード例 #7
0
ファイル: SmallestMailbox.cs プロジェクト: Micha-kun/akka.net
 /// <summary>
 /// Creates a new <see cref="SmallestMailboxPool" /> router with a given <see cref="Routing.Resizer" />.
 /// 
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Routing.Resizer" /> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer" />.</returns>
 public SmallestMailboxPool WithResizer(Resizer resizer)
 {
     return new SmallestMailboxPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher);
 }
コード例 #8
0
ファイル: Broadcast.cs プロジェクト: marcpiechura/akka.net
 /// <summary>
 /// Initializes a new instance of the <see cref="BroadcastPool"/> class.
 /// </summary>
 /// <param name="nrOfInstances">The initial number of routees in the pool.</param>
 /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param>
 /// <param name="supervisorStrategy">The strategy to use when supervising the pool.</param>
 /// <param name="routerDispatcher">The dispatcher to use when passing messages to the routees.</param>
 /// <param name="usePoolDispatcher"><c>true</c> to use the pool dispatcher; otherwise <c>false</c>.</param>
 public BroadcastPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, bool usePoolDispatcher = false)
     : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher)
 {
 }
コード例 #9
0
 /// <summary>
 /// </summary>
 /// <param name="nrOfInstances">The nr of instances.</param>
 /// <param name="resizer">The resizer.</param>
 /// <param name="supervisorStrategy">The supervisor strategy.</param>
 /// <param name="routerDispatcher">The router dispatcher.</param>
 /// <param name="within">Expect a response within the given timespan</param>
 /// <param name="usePoolDispatcher">if set to <c>true</c> [use pool dispatcher].</param>
 public ScatterGatherFirstCompletedPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy,
                                        string routerDispatcher, TimeSpan within, bool usePoolDispatcher = false)
     : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher)
 {
     _within = within;
 }
コード例 #10
0
 /// <summary>
 /// Creates a new <see cref="ScatterGatherFirstCompletedPool" /> router with a given <see cref="Resizer" />.
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer" />.</returns>
 public ScatterGatherFirstCompletedPool WithResizer(Resizer resizer)
 {
     return(new ScatterGatherFirstCompletedPool(NrOfInstances, resizer, Within, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher));
 }
コード例 #11
0
ファイル: RoundRobin.cs プロジェクト: Micha-kun/akka.net
 /// <summary>
 /// Creates a new <see cref="RoundRobinPool"/> router with a given <see cref="Resizer"/>.
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer"/>.</returns>
 public RoundRobinPool WithResizer(Resizer resizer)
 {
     return new RoundRobinPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher);
 }
コード例 #12
0
ファイル: RoundRobin.cs プロジェクト: Micha-kun/akka.net
 /// <summary>
 /// Initializes a new instance of the <see cref="RoundRobinPool"/> class.
 /// <note>
 /// A <see cref="RoundRobinPool"/> configured in this way uses the <see cref="Pool.DefaultSupervisorStrategy"/> supervisor strategy.
 /// </note>
 /// </summary>
 /// <param name="nrOfInstances">The initial number of routees in the pool.</param>
 /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param>
 public RoundRobinPool(int nrOfInstances, Resizer resizer) : this(nrOfInstances, resizer, Pool.DefaultSupervisorStrategy, Dispatchers.DefaultDispatcherId) { }
コード例 #13
0
 /// <summary>
 /// Creates a new <see cref="SmallestMailboxPool" /> router with a given <see cref="Routing.Resizer" />.
 ///
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Routing.Resizer" /> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer" />.</returns>
 public SmallestMailboxPool WithResizer(Resizer resizer)
 {
     return(new SmallestMailboxPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher));
 }
コード例 #14
0
 /// <summary>
 /// Sets the resizer to use for the pool.
 /// </summary>
 /// <param name="strategy">The resizer to use.</param>
 /// <returns>The tail chopping pool.</returns>
 public TailChoppingPool WithResizer(Resizer resizer)
 {
     Resizer = resizer;
     return(this);
 }
コード例 #15
0
ファイル: Random.cs プロジェクト: yunfan501/sonardotnet714
 /// <summary>
 /// Creates a new <see cref="RandomPool" /> router with a given <see cref="Resizer" />.
 ///
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer" />.</returns>
 public override Pool WithResizer(Resizer resizer)
 {
     return(new RandomPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher));
 }
コード例 #16
0
ファイル: TailChopping.cs プロジェクト: Micha-kun/akka.net
 /// <summary>
 /// Initializes a new instance of the <see cref="TailChoppingPool"/> class.
 /// </summary>
 /// <param name="nrOfInstances">The initial number of routees in the pool.</param>
 /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param>
 /// <param name="supervisorStrategy">The strategy to use when supervising the pool.</param>
 /// <param name="routerDispatcher">The dispatcher to use when passing messages to the routees.</param>
 /// <param name="within">The amount of time to wait for a response.</param>
 /// <param name="interval">The interval to wait before sending to the next routee.</param>
 /// <param name="usePoolDispatcher"><c>true</c> to use the pool dispatcher; otherwise <c>false</c>.</param>
 public TailChoppingPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, TimeSpan within, TimeSpan interval, bool usePoolDispatcher = false)
     : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher)
 {
     Within = within;
     Interval = interval;
 }
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConsistentHashingPool"/> class.
 /// </summary>
 /// <param name="nrOfInstances">The initial number of routees in the pool.</param>
 /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param>
 /// <param name="supervisorStrategy">The strategy to use when supervising the pool.</param>
 /// <param name="routerDispatcher">The dispatcher to use when passing messages to the routees.</param>
 /// <param name="usePoolDispatcher"><c>true</c> to use the pool dispatcher; otherwise <c>false</c>.</param>
 /// <param name="virtualNodesFactor">The number of virtual nodes to use on the hash ring.</param>
 /// <param name="hashMapping">The consistent hash mapping function to use on incoming messages.</param>
 public ConsistentHashingPool(
     int nrOfInstances,
     Resizer resizer,
     SupervisorStrategy supervisorStrategy,
     string routerDispatcher,
     bool usePoolDispatcher = false,
     int virtualNodesFactor = 0,
     ConsistentHashMapping hashMapping = null)
     : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher)
 {
     VirtualNodesFactor = virtualNodesFactor;
     _hashMapping = hashMapping;
 }
コード例 #18
0
ファイル: RoundRobin.cs プロジェクト: wayneYaw/sonarlint-vs
 /// <summary>
 /// Simple form of RoundRobin constructor
 /// </summary>
 /// <param name="nrOfInstances">The nr of instances.</param>
 /// <param name="resizer">A <see cref="Resizer"/> for specifying how to grow the pool of underlying routees based on pressure</param>
 public RoundRobinPool(int nrOfInstances, Resizer resizer) : base(nrOfInstances, resizer, DefaultStrategy, null)
 {
 }
コード例 #19
0
ファイル: Broadcast.cs プロジェクト: marcpiechura/akka.net
 /// <summary>
 /// Creates a new <see cref="BroadcastPool"/> router with a given <see cref="Resizer"/>.
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer" />.</returns>
 public BroadcastPool WithResizer(Resizer resizer)
 {
     return(new BroadcastPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher));
 }
コード例 #20
0
ファイル: RouterConfig.cs プロジェクト: wanglong/akka.net
 /// <summary>
 /// Returns a new instance of the <see cref="Pool"/> router with a new <see cref="Resizer"/>.
 ///
 /// NOTE: this method is immutable and returns a new instance of the <see cref="Pool"/>.
 /// </summary>
 public abstract Pool WithResizer(Resizer resizer);
コード例 #21
0
 /// <summary>
 /// Sets the resizer to use for the pool.
 /// </summary>
 /// <param name="strategy">The resizer to use.</param>
 /// <returns>The tail chopping pool.</returns>
 public TailChoppingPool WithResizer(Resizer resizer)
 {
     Resizer = resizer;
     return this;
 }
コード例 #22
0
 /// <summary>
 /// Creates a new <see cref="ConsistentHashingPool" /> router with a given <see cref="Resizer" />.
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// <note>
 /// Using <see cref="Resizer"/> with <see cref="ConsistentHashingPool"/> is potentially harmful, as hash ranges
 /// might change radically during live message processing. This router works best with fixed-sized pools or fixed
 /// number of routees per node in the event of clustered deployments.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer" />.</returns>
 public ConsistentHashingPool WithResizer(Resizer resizer)
 {
     return(new ConsistentHashingPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher,
                                      UsePoolDispatcher, VirtualNodesFactor, _hashMapping));
 }
コード例 #23
0
ファイル: RouterConfig.cs プロジェクト: jweimann/akka.net
 protected Pool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher,
     bool usePoolDispatcher = false)
 {
     NrOfInstances = nrOfInstances;
     Resizer = resizer;
     SupervisorStrategy = supervisorStrategy ?? Pool.DefaultStrategy;
     UsePoolDispatcher = usePoolDispatcher;
     RouterDispatcher = routerDispatcher;
 }
コード例 #24
0
ファイル: Random.cs プロジェクト: wendell620/akka.net
 /// <summary>
 /// Simple form of RandomPool constructor
 /// </summary>
 /// <param name="nrOfInstances">The nr of instances.</param>
 /// <param name="resizer">A <see cref="Resizer"/> for specifying how to grow the pool of underlying routees based on pressure</param>
 public RandomPool(int nrOfInstances, Resizer resizer) : base(nrOfInstances, resizer, Pool.DefaultStrategy, null)
 {
 }
コード例 #25
0
 public override Pool WithResizer(Resizer resizer)
 {
     return new RemoteRouterConfig(Local.WithResizer(resizer), Nodes);
 }
コード例 #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TailChoppingPool"/> class.
 /// </summary>
 /// <param name="nrOfInstances">The initial number of routees in the pool.</param>
 /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param>
 /// <param name="supervisorStrategy">The strategy to use when supervising the pool.</param>
 /// <param name="routerDispatcher">The dispatcher to use when passing messages to the routees.</param>
 /// <param name="within">The amount of time to wait for a response.</param>
 /// <param name="interval">The interval to wait before sending to the next routee.</param>
 /// <param name="usePoolDispatcher"><c>true</c> to use the pool dispatcher; otherwise <c>false</c>.</param>
 public TailChoppingPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, TimeSpan within, TimeSpan interval, bool usePoolDispatcher = false)
     : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher)
 {
     Within   = within;
     Interval = interval;
 }
コード例 #27
0
ファイル: RoundRobin.cs プロジェクト: ziez/akka.net
 /// <summary>
 /// Initializes a new instance of the <see cref="RoundRobinPool"/> class.
 /// <note>
 /// A <see cref="RoundRobinPool"/> configured in this way uses the <see cref="Pool.DefaultSupervisorStrategy"/> supervisor strategy.
 /// </note>
 /// </summary>
 /// <param name="nrOfInstances">The initial number of routees in the pool.</param>
 /// <param name="resizer">The resizer to use when dynamically allocating routees to the pool.</param>
 public RoundRobinPool(int nrOfInstances, Resizer resizer) : this(nrOfInstances, resizer, Pool.DefaultSupervisorStrategy, Dispatchers.DefaultDispatcherId)
 {
 }
コード例 #28
0
ファイル: RoundRobin.cs プロジェクト: ziez/akka.net
 /// <summary>
 /// Creates a new <see cref="RoundRobinPool"/> router with a given <see cref="Resizer"/>.
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer"/>.</returns>
 public RoundRobinPool WithResizer(Resizer resizer)
 {
     return(new RoundRobinPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher));
 }
コード例 #29
0
ファイル: Random.cs プロジェクト: ClusterReply/akka.net
 /// <summary>
 /// Simple form of RandomPool constructor
 /// </summary>
 /// <param name="nrOfInstances">The nr of instances.</param>
 /// <param name="resizer">A <see cref="Resizer"/> for specifying how to grow the pool of underlying routees based on pressure</param>
 public RandomPool(int nrOfInstances, Resizer resizer) : base(nrOfInstances, resizer, Pool.DefaultStrategy, null) { }
コード例 #30
0
ファイル: RouterConfig.cs プロジェクト: jarlrasm/akka.net
 /// <summary>
 /// Initializes a new instance of the <see cref="FromConfig" /> class.
 /// </summary>
 /// <param name="resizer">TBD</param>
 /// <param name="supervisorStrategy">TBD</param>
 /// <param name="routerDispatcher">TBD</param>
 public FromConfig(Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher)
     : base(0, resizer, supervisorStrategy, routerDispatcher, false)
 {
 }
コード例 #31
0
ファイル: Broadcast.cs プロジェクト: njannink/sonarlint-vs
 public override Pool WithResizer(Resizer resizer)
 {
     return new BroadcastPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, UsePoolDispatcher);
 }
コード例 #32
0
ファイル: RouterConfig.cs プロジェクト: jarlrasm/akka.net
 /// <summary>
 /// Setting the resizer to be used.
 /// </summary>
 /// <param name="resizer">TBD</param>
 /// <returns>TBD</returns>
 public FromConfig WithResizer(Resizer resizer)
 {
     return(new FromConfig(resizer, SupervisorStrategy, RouterDispatcher));
 }
コード例 #33
0
ファイル: TailChopping.cs プロジェクト: Micha-kun/akka.net
 /// <summary>
 /// Creates a new <see cref="TailChoppingPool"/> router with a given <see cref="Resizer"/>.
 /// 
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer"/>.</returns>
 public TailChoppingPool WithResizer(Resizer resizer)
 {
     return new TailChoppingPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, Within, Interval, UsePoolDispatcher);
 }
コード例 #34
0
 /// <summary>
 /// Creates a new <see cref="TailChoppingPool"/> router with a given <see cref="Resizer"/>.
 ///
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer"/> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer"/>.</returns>
 public override Pool WithResizer(Resizer resizer)
 {
     return(new TailChoppingPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher, _within, _interval, UsePoolDispatcher));
 }
コード例 #35
0
 /// <summary>
 /// Creates a new <see cref="ConsistentHashingPool" /> router with a given <see cref="Resizer" />.
 /// <note>
 /// This method is immutable and returns a new instance of the router.
 /// </note>
 /// <note>
 /// Using <see cref="Resizer"/> with <see cref="ConsistentHashingPool"/> is potentially harmful, as hash ranges
 /// might change radically during live message processing. This router works best with fixed-sized pools or fixed
 /// number of routees per node in the event of clustered deployments.
 /// </note>
 /// </summary>
 /// <param name="resizer">The <see cref="Resizer" /> used to configure the new router.</param>
 /// <returns>A new router with the provided <paramref name="resizer" />.</returns>
 public ConsistentHashingPool WithResizer(Resizer resizer)
 {
     return new ConsistentHashingPool(NrOfInstances, resizer, SupervisorStrategy, RouterDispatcher,
         UsePoolDispatcher, VirtualNodesFactor, _hashMapping);
 }
コード例 #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConsistentHashingPool"/> class.
 /// </summary>
 /// <param name="nrOfInstances">The nr of instances.</param>
 /// <param name="resizer">The resizer.</param>
 /// <param name="supervisorStrategy">The supervisor strategy.</param>
 /// <param name="routerDispatcher">The router dispatcher.</param>
 /// <param name="usePoolDispatcher">if set to <c>true</c> [use pool dispatcher].</param>
 public ConsistentHashingPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, bool usePoolDispatcher = false)
     : base(nrOfInstances, resizer, supervisorStrategy, routerDispatcher, usePoolDispatcher)
 {
 }