org.apache.camel.processor.loadbalancer
Class StickyLoadBalancer
java.lang.Object
org.apache.camel.processor.loadbalancer.LoadBalancerSupport
org.apache.camel.processor.loadbalancer.QueueLoadBalancer
org.apache.camel.processor.loadbalancer.StickyLoadBalancer
- All Implemented Interfaces:
- Processor, LoadBalancer
public class StickyLoadBalancer
- extends QueueLoadBalancer
Implements a sticky load balancer using an Expression
to calculate
a correlation key to perform the sticky load balancing; rather like jsessionid in the web
or JMSXGroupID in JMS.
- Version:
- $Revision: 1.1 $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StickyLoadBalancer
public StickyLoadBalancer(Expression<Exchange> correlationExpression)
StickyLoadBalancer
public StickyLoadBalancer(Expression<Exchange> correlationExpression,
QueueLoadBalancer loadBalancer)
chooseProcessor
protected Processor chooseProcessor(List<Processor> processors,
Exchange exchange)
- Specified by:
chooseProcessor
in class QueueLoadBalancer
removeProcessor
public void removeProcessor(Processor processor)
- Description copied from interface:
LoadBalancer
- Removes the given processor from the load balancer
- Specified by:
removeProcessor
in interface LoadBalancer
- Overrides:
removeProcessor
in class LoadBalancerSupport
- Parameters:
processor
- the processor to be removed from the load balancer
getNumberOfHashGroups
public int getNumberOfHashGroups()
setNumberOfHashGroups
public void setNumberOfHashGroups(int numberOfHashGroups)
getStickyKey
protected Object getStickyKey(Object value)
- A strategy to create the key for the sticky load balancing map.
The default implementation uses the hash code of the value
then modulos by the numberOfHashGroups to avoid the sticky map getting too big
- Parameters:
value
- the correlation value
- Returns:
- the key to be used in the sticky map
Copyright © 2007 Apache Software Foundation. All Rights Reserved.