Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class FailoverConnectionMonitor

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.jabber.FailoverConnectionMonitor
All Implemented Interfaces:
EventListener, RegistrationStateChangeListener

public class FailoverConnectionMonitor
extends Object
implements RegistrationStateChangeListener

When provider registers, check whether we are connected to the first server in the dns records, if its not - considers in failover state and start a task that will periodically checks to see if server has come back and when this happens, re-register to it. If in the meanwhile, while in failover state the server we are connected became primary (became with highest priority in srv records) we consider ourselves out of failover state and stop all checks considering as we are connected to primary one.

Author:
Damian Minkov

Field Summary
static String FAILOVER_CHECK_INTERVAL_PROP
          Property to specify the interval between checks when in failover state.
static String REVERSE_FAILOVER_ENABLED_PROP
          Property to enable/disable failover functionality.
 
Method Summary
static FailoverConnectionMonitor getInstance(ProtocolProviderServiceJabberImpl provider)
          Returns instance of the monitor for provider, if missing create it.
 void registrationStateChanged(RegistrationStateChangeEvent evt)
          Get notified for server registration change events.
(package private)  void setCurrent(String serviceName, String currentAddress)
          Sets current values that PP will use for connecting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVERSE_FAILOVER_ENABLED_PROP

public static final String REVERSE_FAILOVER_ENABLED_PROP
Property to enable/disable failover functionality.

See Also:
Constant Field Values

FAILOVER_CHECK_INTERVAL_PROP

public static final String FAILOVER_CHECK_INTERVAL_PROP
Property to specify the interval between checks when in failover state. Default is one minute.

See Also:
Constant Field Values
Method Detail

getInstance

public static FailoverConnectionMonitor getInstance(ProtocolProviderServiceJabberImpl provider)
Returns instance of the monitor for provider, if missing create it.

Parameters:
provider - the povider for the monitor we will return
Returns:
the monitor for the provider.

setCurrent

void setCurrent(String serviceName,
                String currentAddress)
Sets current values that PP will use for connecting.

Parameters:
serviceName - the service name.
currentAddress - the current address used.

registrationStateChanged

public void registrationStateChanged(RegistrationStateChangeEvent evt)
Get notified for server registration change events.

Specified by:
registrationStateChanged in interface RegistrationStateChangeListener
Parameters:
evt - the event

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.