org.mobicents.servlet.sip.startup.failover
Class SipStandardBalancerNodeService

java.lang.Object
  extended by org.apache.catalina.core.StandardService
      extended by org.mobicents.servlet.sip.startup.SipStandardService
          extended by org.mobicents.servlet.sip.startup.failover.SipStandardBalancerNodeService
All Implemented Interfaces:
javax.management.MBeanRegistration, org.apache.catalina.Lifecycle, org.apache.catalina.Service, SipBalancerNodeService, SipService

public class SipStandardBalancerNodeService
extends SipStandardService
implements SipBalancerNodeService

Sip Servlet implementation of the Service interface.

This implementation extends the SipStandardService (that allows Tomcat to become a converged container) with the failover features.
This implementation will send heartbeats and health information to the sip balancers configured for this service (configured in the server.xml as balancers attribute fo the Service Tag)

Author:
Jean Deruelle

Field Summary
 
Fields inherited from class org.mobicents.servlet.sip.startup.SipStandardService
concurrencyControlMode, congestionControlCheckingInterval, congestionControlPolicy, connectorsStartedExternally, darConfigurationFileLocation, memoryThreshold, sipApplicationDispatcher, sipApplicationDispatcherClassName, sipMessageQueueSize
 
Fields inherited from class org.apache.catalina.core.StandardService
connectors, container, controller, domain, executors, initialized, mserver, oname, suffix, support, type
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
SipStandardBalancerNodeService()
           
 
Method Summary
 boolean addBalancer(java.lang.String addr, int sipPort)
          
 boolean addBalancer(java.lang.String hostName, int sipPort, int index)
          Adds balancer address to distribution list.
 java.lang.String[] getBalancers()
          
 long getHeartBeatInterval()
          
 java.lang.String getInfo()
           
 void initialize()
           
 boolean removeBalancer(java.lang.String addr, int sipPort)
          Tries to remove balancer with name: addr[0].addr[1].addr[2].addr[3]
 boolean removeBalancer(java.lang.String hostName, int sipPort, int index)
          
 void sendSwitchoverInstruction(java.lang.String fromJvmRoute, java.lang.String toJvmRoute)
           
 void setBalancers(java.lang.String balancers)
           
 void setHeartBeatInterval(long heartBeatInterval)
          
 void start()
           
 void stop()
           
 
Methods inherited from class org.mobicents.servlet.sip.startup.SipStandardService
addConnector, getConcurrencyControlMode, getCongestionControlCheckingInterval, getCongestionControlPolicy, getDarConfigurationFileLocation, getMemoryThreshold, getSipApplicationDispatcher, getSipApplicationDispatcherClassName, getSipMessageQueueSize, removeConnector, setConcurrencyControlMode, setCongestionControlCheckingInterval, setCongestionControlPolicy, setDarConfigurationFileLocation, setMemoryThreshold, setSipApplicationDispatcher, setSipApplicationDispatcherClassName, setSipMessageQueueSize
 
Methods inherited from class org.apache.catalina.core.StandardService
addExecutor, addLifecycleListener, addPropertyChangeListener, destroy, findConnectors, findExecutors, findLifecycleListeners, getConnectorNames, getContainer, getContainerName, getDomain, getExecutor, getName, getObjectName, getServer, init, postDeregister, postRegister, preDeregister, preRegister, removeExecutor, removeLifecycleListener, removePropertyChangeListener, setContainer, setName, setServer, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Service
addExecutor, findConnectors, findExecutors, getContainer, getExecutor, getName, getServer, removeExecutor, setContainer, setName, setServer
 

Constructor Detail

SipStandardBalancerNodeService

public SipStandardBalancerNodeService()
Method Detail

getInfo

public java.lang.String getInfo()
Specified by:
getInfo in interface org.apache.catalina.Service
Overrides:
getInfo in class SipStandardService

initialize

public void initialize()
                throws org.apache.catalina.LifecycleException
Specified by:
initialize in interface org.apache.catalina.Service
Overrides:
initialize in class SipStandardService
Throws:
org.apache.catalina.LifecycleException

start

public void start()
           throws org.apache.catalina.LifecycleException
Specified by:
start in interface org.apache.catalina.Lifecycle
Overrides:
start in class SipStandardService
Throws:
org.apache.catalina.LifecycleException

stop

public void stop()
          throws org.apache.catalina.LifecycleException
Specified by:
stop in interface org.apache.catalina.Lifecycle
Overrides:
stop in class SipStandardService
Throws:
org.apache.catalina.LifecycleException

getHeartBeatInterval

public long getHeartBeatInterval()

Specified by:
getHeartBeatInterval in interface SipBalancerNodeService

setHeartBeatInterval

public void setHeartBeatInterval(long heartBeatInterval)

Specified by:
setHeartBeatInterval in interface SipBalancerNodeService

getBalancers

public java.lang.String[] getBalancers()

Specified by:
getBalancers in interface SipBalancerNodeService
Returns:
- list of String objects representing balancer addresses. Example content:
  • 192.168.1.100
  • ala.ma.kota.pl

addBalancer

public boolean addBalancer(java.lang.String addr,
                           int sipPort)

Specified by:
addBalancer in interface SipBalancerNodeService

addBalancer

public boolean addBalancer(java.lang.String hostName,
                           int sipPort,
                           int index)
Adds balancer address to distribution list. Tries to connect to it.

Specified by:
addBalancer in interface SipBalancerNodeService
Parameters:
hostName - - name of the host to be looked up in DNS
index - - possible index of IP address when host has more than one address - like InetAddress.getAllByName(..);
Returns:
  • true - if address didnt exist and it has been injected into list
  • false - otherwise

removeBalancer

public boolean removeBalancer(java.lang.String addr,
                              int sipPort)
Tries to remove balancer with name: addr[0].addr[1].addr[2].addr[3]

Specified by:
removeBalancer in interface SipBalancerNodeService
Parameters:
addr - - The argument is address representation in network byte order: the highest order byte of the address is in [0].
Returns:
  • true - if name exists and was removed
  • false - otherwise

removeBalancer

public boolean removeBalancer(java.lang.String hostName,
                              int sipPort,
                              int index)

Specified by:
removeBalancer in interface SipBalancerNodeService

sendSwitchoverInstruction

public void sendSwitchoverInstruction(java.lang.String fromJvmRoute,
                                      java.lang.String toJvmRoute)
Parameters:
info -

setBalancers

public void setBalancers(java.lang.String balancers)
Parameters:
balancers - the balancers to set


Copyright © 2009. All Rights Reserved.