public class ReconnectionManager extends Object
There are two possible reconnection policies:
ReconnectionManager.ReconnectionPolicy.RANDOM_INCREASING_DELAY
- The reconnection mechanism will try to reconnect periodically:
ReconnectionManager.ReconnectionPolicy.FIXED_DELAY
- The reconnection mechanism will try to reconnect after a fixed delay
independently from the number of reconnection attempts already performedModifier and Type | Class and Description |
---|---|
static class |
ReconnectionManager.ReconnectionPolicy
Reconnection Policy, where
ReconnectionManager.ReconnectionPolicy.RANDOM_INCREASING_DELAY is the default policy used by smack and ReconnectionManager.ReconnectionPolicy.FIXED_DELAY implies
a fixed amount of time between reconnection attempts |
Modifier and Type | Method and Description |
---|---|
void |
disableAutomaticReconnection()
Disable the automatic reconnection mechanism.
|
void |
enableAutomaticReconnection()
Enable the automatic reconnection mechanism.
|
static boolean |
getEnabledPerDefault()
Get the current default reconnection mechanism setting for new XMPP connections.
|
static ReconnectionManager |
getInstanceFor(AbstractXMPPConnection connection)
Get a instance of ReconnectionManager for the given connection.
|
boolean |
isAutomaticReconnectEnabled()
Returns if the automatic reconnection mechanism is enabled.
|
static void |
setDefaultFixedDelay(int fixedDelay)
Set the default fixed delay in seconds between the reconnection attempts.
|
static void |
setDefaultReconnectionPolicy(ReconnectionManager.ReconnectionPolicy reconnectionPolicy)
Set the default Reconnection Policy to use
|
static void |
setEnabledPerDefault(boolean enabled)
Set if the automatic reconnection mechanism will be enabled per default for new XMPP connections.
|
void |
setFixedDelay(int fixedDelay)
Set the fixed delay in seconds between the reconnection attempts Also set the connection
policy to
ReconnectionManager.ReconnectionPolicy.FIXED_DELAY |
void |
setReconnectionPolicy(ReconnectionManager.ReconnectionPolicy reconnectionPolicy)
Set the Reconnection Policy to use
|
public static ReconnectionManager getInstanceFor(AbstractXMPPConnection connection)
connection
- public static void setEnabledPerDefault(boolean enabled)
enabled
- public static boolean getEnabledPerDefault()
public static void setDefaultFixedDelay(int fixedDelay)
ReconnectionManager.ReconnectionPolicy.FIXED_DELAY
fixedDelay
- Delay expressed in secondspublic static void setDefaultReconnectionPolicy(ReconnectionManager.ReconnectionPolicy reconnectionPolicy)
reconnectionPolicy
- public void setFixedDelay(int fixedDelay)
ReconnectionManager.ReconnectionPolicy.FIXED_DELAY
fixedDelay
- Delay expressed in secondspublic void setReconnectionPolicy(ReconnectionManager.ReconnectionPolicy reconnectionPolicy)
reconnectionPolicy
- public void enableAutomaticReconnection()
public void disableAutomaticReconnection()
public boolean isAutomaticReconnectEnabled()
disableAutomaticReconnection()
and enable the mechanism with enableAutomaticReconnection()
.