net.sf.xenqtt.client
Interface ReconnectionStrategy

All Superinterfaces:
Cloneable
All Known Implementing Classes:
FixedReconnectionStrategy, NullReconnectStrategy, ProgressiveReconnectionStrategy

public interface ReconnectionStrategy
extends Cloneable

Implementations are strategies used by MqttClient implementation to reconnect to the broker if the connection is lost. Implementations must be thread safe.


Method Summary
 ReconnectionStrategy clone()
           
 void connectionEstablished()
          Called by an MqttClient instance when a connection to the broker is established.
 long connectionLost(MqttClient client, Throwable cause)
          Called by an MqttClient each time the connection to the broker is lost other than by an intentional disconnect.
 

Method Detail

connectionLost

long connectionLost(MqttClient client,
                    Throwable cause)
Called by an MqttClient each time the connection to the broker is lost other than by an intentional disconnect.

Parameters:
cause - The exception that cause the connection to close or resulted from the connection closing. May be null.
Returns:
Milliseconds the client should wait before trying to connect to the broker again. If <= 0 the client will stop trying to connect to the broker.

connectionEstablished

void connectionEstablished()
Called by an MqttClient instance when a connection to the broker is established.


clone

ReconnectionStrategy clone()
Returns:
A new instance of the same type as this object. This is used to create a new strategy for each client created by the MqttClientFactory.


Copyright © 2013. All Rights Reserved.