org.mobicents.tools.sip.balancer
Class SIPBalancerForwarder

java.lang.Object
  extended by org.mobicents.tools.sip.balancer.SIPBalancerForwarder
All Implemented Interfaces:
java.util.EventListener, javax.sip.SipListener

public class SIPBalancerForwarder
extends java.lang.Object
implements javax.sip.SipListener

A transaction stateful UDP Forwarder that listens at a port and forwards to multiple outbound addresses. It keeps a timer thread around that pings the list of proxy servers and sends to the first proxy server. It uses double record routing to be able to listen on one transport and sends on another transport or allows support for multihoming.

Author:
M. Ranganathan, baranowb, Jean Deruelle

Field Summary
protected static java.util.HashSet<java.lang.String> dialogCreationMethods
           
protected  java.lang.String[] extraServerAddresses
           
protected  int[] extraServerPorts
           
 NodeRegister register
           
static java.lang.String ROUTE_PARAM_NODE_HOST
           
static java.lang.String ROUTE_PARAM_NODE_PORT
           
 
Constructor Summary
SIPBalancerForwarder(java.util.Properties properties, NodeRegister register)
           
 
Method Summary
 BalancerContext getBalancerAlgorithmContext()
           
 long getNumberOfRequestsProcessed()
           
 java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong> getNumberOfRequestsProcessedByMethod()
           
 long getNumberOfResponsesProcessed()
           
 java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong> getNumberOfResponsesProcessedByStatusCode()
           
 long getRequestsProcessedByMethod(java.lang.String method)
           
 long getResponsesProcessedByStatusCode(java.lang.String statusCode)
           
 boolean isGatherStatistics()
           
 void processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent)
           
 void processIOException(javax.sip.IOExceptionEvent exceptionEvent)
           
 void processRequest(javax.sip.RequestEvent requestEvent)
           
 void processResponse(javax.sip.ResponseEvent responseEvent)
           
 void processTimeout(javax.sip.TimeoutEvent timeoutEvent)
           
 void processTransactionTerminated(javax.sip.TransactionTerminatedEvent transactionTerminatedEvent)
           
 void setBalancerAlgorithmContext(BalancerContext balancerAlgorithmContext)
           
 void setGatherStatistics(boolean skipStatistics)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUTE_PARAM_NODE_HOST

public static final java.lang.String ROUTE_PARAM_NODE_HOST
See Also:
Constant Field Values

ROUTE_PARAM_NODE_PORT

public static final java.lang.String ROUTE_PARAM_NODE_PORT
See Also:
Constant Field Values

dialogCreationMethods

protected static final java.util.HashSet<java.lang.String> dialogCreationMethods

register

public NodeRegister register

extraServerAddresses

protected java.lang.String[] extraServerAddresses

extraServerPorts

protected int[] extraServerPorts
Constructor Detail

SIPBalancerForwarder

public SIPBalancerForwarder(java.util.Properties properties,
                            NodeRegister register)
                     throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException
Method Detail

start

public void start()

stop

public void stop()

processDialogTerminated

public void processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent)
Specified by:
processDialogTerminated in interface javax.sip.SipListener

processIOException

public void processIOException(javax.sip.IOExceptionEvent exceptionEvent)
Specified by:
processIOException in interface javax.sip.SipListener

processRequest

public void processRequest(javax.sip.RequestEvent requestEvent)
Specified by:
processRequest in interface javax.sip.SipListener

processResponse

public void processResponse(javax.sip.ResponseEvent responseEvent)
Specified by:
processResponse in interface javax.sip.SipListener
Parameters:
originalRequest -
serverTransaction -
Throws:
java.text.ParseException
javax.sip.SipException
javax.sip.InvalidArgumentException
javax.sip.TransactionUnavailableException

processTimeout

public void processTimeout(javax.sip.TimeoutEvent timeoutEvent)
Specified by:
processTimeout in interface javax.sip.SipListener

processTransactionTerminated

public void processTransactionTerminated(javax.sip.TransactionTerminatedEvent transactionTerminatedEvent)
Specified by:
processTransactionTerminated in interface javax.sip.SipListener

getNumberOfRequestsProcessed

public long getNumberOfRequestsProcessed()
Returns:
the requestsProcessed

getNumberOfResponsesProcessed

public long getNumberOfResponsesProcessed()
Returns:
the requestsProcessed

getRequestsProcessedByMethod

public long getRequestsProcessedByMethod(java.lang.String method)
Returns:
the requestsProcessed

getResponsesProcessedByStatusCode

public long getResponsesProcessedByStatusCode(java.lang.String statusCode)

getNumberOfRequestsProcessedByMethod

public java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong> getNumberOfRequestsProcessedByMethod()

getNumberOfResponsesProcessedByStatusCode

public java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong> getNumberOfResponsesProcessedByStatusCode()

getBalancerAlgorithmContext

public BalancerContext getBalancerAlgorithmContext()

setBalancerAlgorithmContext

public void setBalancerAlgorithmContext(BalancerContext balancerAlgorithmContext)

setGatherStatistics

public void setGatherStatistics(boolean skipStatistics)
Parameters:
skipStatistics - the skipStatistics to set

isGatherStatistics

public boolean isGatherStatistics()
Returns:
the skipStatistics


Copyright © 2010. All Rights Reserved.