org.mobicents.tools.sip.balancer
Class HeaderConsistentHashBalancerAlgorithm

java.lang.Object
  extended by org.mobicents.tools.sip.balancer.DefaultBalancerAlgorithm
      extended by org.mobicents.tools.sip.balancer.HeaderConsistentHashBalancerAlgorithm
All Implemented Interfaces:
BalancerAlgorithm

public class HeaderConsistentHashBalancerAlgorithm
extends DefaultBalancerAlgorithm


Field Summary
protected  java.lang.String httpAffinityKey
           
protected  java.lang.String sipHeaderAffinityKey
           
 
Fields inherited from class org.mobicents.tools.sip.balancer.DefaultBalancerAlgorithm
properties
 
Constructor Summary
HeaderConsistentHashBalancerAlgorithm()
           
HeaderConsistentHashBalancerAlgorithm(java.lang.String headerName)
           
 
Method Summary
protected  int hashAffinityKeyword(java.lang.String keyword)
           
 void init()
          Lifecycle method.
 void nodeAdded(SIPNode node)
          Notify the algorithm when a node is added.
 void nodeRemoved(SIPNode node)
          Notifying the algorithm when a node is dead.
 SIPNode processExternalRequest(javax.sip.message.Request request)
          When a request comes it is passed to the algorithm.
 SIPNode processHttpRequest(org.jboss.netty.handler.codec.http.HttpRequest request)
          Handle HttpRequests here.
 
Methods inherited from class org.mobicents.tools.sip.balancer.DefaultBalancerAlgorithm
assignToNode, getBalancerContext, getProperties, jvmRouteSwitchover, processAssignedExternalRequest, processExternalResponse, processInternalRequest, processInternalResponse, setProperties, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sipHeaderAffinityKey

protected java.lang.String sipHeaderAffinityKey

httpAffinityKey

protected java.lang.String httpAffinityKey
Constructor Detail

HeaderConsistentHashBalancerAlgorithm

public HeaderConsistentHashBalancerAlgorithm()

HeaderConsistentHashBalancerAlgorithm

public HeaderConsistentHashBalancerAlgorithm(java.lang.String headerName)
Method Detail

processExternalRequest

public SIPNode processExternalRequest(javax.sip.message.Request request)
Description copied from interface: BalancerAlgorithm
When a request comes it is passed to the algorithm. The algorithm must add the Route headers to the node or nodes where the request should go. The actual proxying is done at the LB. Allowing the algorithm to add headers allows more flexibility for example when you need to pass some information to the AS or the application to make further LB decisions or multiprotocol cooperative load balancing. It is very little effort for great flexibility.

Returns:

nodeAdded

public void nodeAdded(SIPNode node)
Description copied from interface: BalancerAlgorithm
Notify the algorithm when a node is added.

Specified by:
nodeAdded in interface BalancerAlgorithm
Overrides:
nodeAdded in class DefaultBalancerAlgorithm

nodeRemoved

public void nodeRemoved(SIPNode node)
Description copied from interface: BalancerAlgorithm
Notifying the algorithm when a node is dead.

Specified by:
nodeRemoved in interface BalancerAlgorithm
Overrides:
nodeRemoved in class DefaultBalancerAlgorithm

processHttpRequest

public SIPNode processHttpRequest(org.jboss.netty.handler.codec.http.HttpRequest request)
Description copied from interface: BalancerAlgorithm
Handle HttpRequests here. Use the Netty API for Http request analysis.

Specified by:
processHttpRequest in interface BalancerAlgorithm
Overrides:
processHttpRequest in class DefaultBalancerAlgorithm
Returns:

hashAffinityKeyword

protected int hashAffinityKeyword(java.lang.String keyword)

init

public void init()
Description copied from interface: BalancerAlgorithm
Lifecycle method. Notifies the algorithm when it's initialized with properties and balancer context.



Copyright © 2010. All Rights Reserved.