org.mobicents.tools.sip.balancer
Class DefaultBalancerAlgorithm

java.lang.Object
  extended by org.mobicents.tools.sip.balancer.DefaultBalancerAlgorithm
All Implemented Interfaces:
BalancerAlgorithm
Direct Known Subclasses:
CallIDAffinityBalancerAlgorithm, HeaderConsistentHashBalancerAlgorithm, PersistentConsistentHashBalancerAlgorithm

public abstract class DefaultBalancerAlgorithm
extends java.lang.Object
implements BalancerAlgorithm


Field Summary
protected  java.util.Properties properties
           
 
Constructor Summary
DefaultBalancerAlgorithm()
           
 
Method Summary
 void assignToNode(java.lang.String id, SIPNode node)
          Assign callid to node
 BalancerContext getBalancerContext()
          Get the balancer context, which exposes useful information such as the available AS nodes at the moment or the listening points if you need the local address.
 java.util.Properties getProperties()
          Get the properties used to load the load balancer.
 void jvmRouteSwitchover(java.lang.String fromJvmRoute, java.lang.String toJvmRoute)
          Move load from one node to another to follow mod_jk/mod_cluster
 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 processAssignedExternalRequest(javax.sip.message.Request request, SIPNode assignedNode)
           
 void processExternalResponse(javax.sip.message.Response response)
          Allow algorithms to process responses
 SIPNode processHttpRequest(org.jboss.netty.handler.codec.http.HttpRequest request)
          Handle HttpRequests here.
 void processInternalRequest(javax.sip.message.Request request)
           
 void processInternalResponse(javax.sip.message.Response response)
           
 void setProperties(java.util.Properties properties)
          Also allows to change the properties completely when it makes sense
 void start()
           
 void stop()
          Lifecycle method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mobicents.tools.sip.balancer.BalancerAlgorithm
init, processExternalRequest
 

Field Detail

properties

protected java.util.Properties properties
Constructor Detail

DefaultBalancerAlgorithm

public DefaultBalancerAlgorithm()
Method Detail

setProperties

public void setProperties(java.util.Properties properties)
Description copied from interface: BalancerAlgorithm
Also allows to change the properties completely when it makes sense

Specified by:
setProperties in interface BalancerAlgorithm

getBalancerContext

public BalancerContext getBalancerContext()
Description copied from interface: BalancerAlgorithm
Get the balancer context, which exposes useful information such as the available AS nodes at the moment or the listening points if you need the local address.

Specified by:
getBalancerContext in interface BalancerAlgorithm
Returns:

getProperties

public java.util.Properties getProperties()
Description copied from interface: BalancerAlgorithm
Get the properties used to load the load balancer. This way you can read algorithm-specific settings from the main configuration file - the lb.properties.

Specified by:
getProperties in interface BalancerAlgorithm
Returns:

processInternalRequest

public void processInternalRequest(javax.sip.message.Request request)
Specified by:
processInternalRequest in interface BalancerAlgorithm

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
Returns:

processAssignedExternalRequest

public SIPNode processAssignedExternalRequest(javax.sip.message.Request request,
                                              SIPNode assignedNode)
Specified by:
processAssignedExternalRequest in interface BalancerAlgorithm

processInternalResponse

public void processInternalResponse(javax.sip.message.Response response)
Specified by:
processInternalResponse in interface BalancerAlgorithm

processExternalResponse

public void processExternalResponse(javax.sip.message.Response response)
Description copied from interface: BalancerAlgorithm
Allow algorithms to process responses

Specified by:
processExternalResponse in interface BalancerAlgorithm

start

public void start()

stop

public void stop()
Description copied from interface: BalancerAlgorithm
Lifecycle method. Notifies the algorithm when it's being shut down.

Specified by:
stop in interface BalancerAlgorithm

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

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

jvmRouteSwitchover

public void jvmRouteSwitchover(java.lang.String fromJvmRoute,
                               java.lang.String toJvmRoute)
Description copied from interface: BalancerAlgorithm
Move load from one node to another to follow mod_jk/mod_cluster

Specified by:
jvmRouteSwitchover in interface BalancerAlgorithm

assignToNode

public void assignToNode(java.lang.String id,
                         SIPNode node)
Description copied from interface: BalancerAlgorithm
Assign callid to node

Specified by:
assignToNode in interface BalancerAlgorithm


Copyright © 2010. All Rights Reserved.