public final class AdaptiveLoadBalancingPool
extends java.lang.Object
implements akka.routing.Pool, scala.Product, scala.Serializable
It uses random selection of routees based on probabilities derived from the remaining capacity of corresponding node.
The configuration parameter trumps the constructor arguments. This means that
if you provide nrOfInstances
during instantiation they will be ignored if
the router is defined in the configuration file for the actor being used.
Any routees that are created by a router will be created as the router's children. The router is therefore also the children's supervisor.
The supervision strategy of the router actor can be configured with
withSupervisorStrategy(akka.actor.SupervisorStrategy)
. If no strategy is provided, routers default to
a strategy of “always escalate”. This means that errors are passed up to the
router's supervisor for handling.
The router's supervisor will treat the error as an error with the router itself. Therefore a directive to stop or restart will cause the router itself to stop or restart. The router, in turn, will cause its children to stop and restart.
param: metricsSelector decides what probability to use for selecting a routee, based on remaining capacity as indicated by the node metrics
param: nrOfInstances initial number of routees in the pool
param: supervisorStrategy strategy for supervising the routees, see 'Supervision Setup'
param: routerDispatcher dispatcher to use for the router head actor, which handles supervision, death watch and router management messages
Constructor and Description |
---|
AdaptiveLoadBalancingPool(com.typesafe.config.Config config,
akka.actor.DynamicAccess dynamicAccess) |
AdaptiveLoadBalancingPool(MetricsSelector metricsSelector,
int nr)
Java API
|
AdaptiveLoadBalancingPool(MetricsSelector metricsSelector,
int nrOfInstances,
akka.actor.SupervisorStrategy supervisorStrategy,
java.lang.String routerDispatcher,
boolean usePoolDispatcher) |
Modifier and Type | Method and Description |
---|---|
akka.routing.Router |
createRouter(akka.actor.ActorSystem system) |
MetricsSelector |
metricsSelector() |
int |
nrOfInstances() |
int |
nrOfInstances(akka.actor.ActorSystem sys) |
scala.Option<akka.routing.Resizer> |
resizer() |
java.lang.String |
routerDispatcher() |
scala.Option<akka.actor.Props> |
routingLogicController(akka.routing.RoutingLogic routingLogic) |
akka.actor.SupervisorStrategy |
supervisorStrategy() |
boolean |
usePoolDispatcher() |
AdaptiveLoadBalancingPool |
withDispatcher(java.lang.String dispatcherId)
Setting the dispatcher to be used for the router head actor, which handles
supervision, death watch and router management messages.
|
akka.routing.RouterConfig |
withFallback(akka.routing.RouterConfig other)
Uses the supervisor strategy of the given RouterConfig
if this RouterConfig doesn't have one
|
AdaptiveLoadBalancingPool |
withSupervisorStrategy(akka.actor.SupervisorStrategy strategy)
Setting the supervisor strategy to be used for the “head” Router actor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createRouterActor, enrichWithPoolDispatcher, newRoutee, props, stopRouterWhenAllRouteesRemoved
public AdaptiveLoadBalancingPool(MetricsSelector metricsSelector, int nrOfInstances, akka.actor.SupervisorStrategy supervisorStrategy, java.lang.String routerDispatcher, boolean usePoolDispatcher)
public AdaptiveLoadBalancingPool(com.typesafe.config.Config config, akka.actor.DynamicAccess dynamicAccess)
public AdaptiveLoadBalancingPool(MetricsSelector metricsSelector, int nr)
metricsSelector
- decides what probability to use for selecting a routee, based
on remaining capacity as indicated by the node metricsnr
- initial number of routees in the poolpublic MetricsSelector metricsSelector()
public int nrOfInstances()
nrOfInstances
in interface akka.routing.Pool
public akka.actor.SupervisorStrategy supervisorStrategy()
supervisorStrategy
in interface akka.routing.Pool
public java.lang.String routerDispatcher()
routerDispatcher
in interface akka.routing.RouterConfig
public boolean usePoolDispatcher()
usePoolDispatcher
in interface akka.routing.Pool
public scala.Option<akka.routing.Resizer> resizer()
resizer
in interface akka.routing.Pool
public int nrOfInstances(akka.actor.ActorSystem sys)
nrOfInstances
in interface akka.routing.Pool
public akka.routing.Router createRouter(akka.actor.ActorSystem system)
createRouter
in interface akka.routing.RouterConfig
public scala.Option<akka.actor.Props> routingLogicController(akka.routing.RoutingLogic routingLogic)
routingLogicController
in interface akka.routing.RouterConfig
public AdaptiveLoadBalancingPool withSupervisorStrategy(akka.actor.SupervisorStrategy strategy)
strategy
- (undocumented)public AdaptiveLoadBalancingPool withDispatcher(java.lang.String dispatcherId)
dispatcherId
- (undocumented)public akka.routing.RouterConfig withFallback(akka.routing.RouterConfig other)
withFallback
in interface akka.routing.RouterConfig
other
- (undocumented)