public class AutoReconnectController extends Object implements ConnectionStateListener
In order to use the reconnect controller put the connection in the
constructor and call connect()
.
Connection connection = ...;
AutoReconnectController controller = new AutoReconnectController ( connection );
controller.connect ();
The AutoReconnectController
needs to be disposed since 0.17.0
Constructor and Description |
---|
AutoReconnectController(Connection connection)
Create a new reconnect controller for the provided connection using the
default reconnect delay
|
AutoReconnectController(Connection connection,
long reconnectDelay)
Create a new reconnect controller for the provided connection
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkDead() |
void |
connect() |
void |
connect(CallbackHandler connectCallbackHandler) |
void |
disconnect() |
void |
dispose()
Dispose controller forcibly
|
void |
dispose(boolean disconnect)
Dispose controller forcibly
|
protected void |
finalize() |
void |
stateChange(Connection connection,
ConnectionState state,
Throwable error)
Notify a state change
|
public AutoReconnectController(Connection connection)
connection
- the connection to managepublic AutoReconnectController(Connection connection, long reconnectDelay)
connection
- the connection to managereconnectDelay
- the minimum delay between reconnect attemptsprotected void checkDead()
public void dispose()
This will also close the connection
public void dispose(boolean disconnect)
disconnect
- if true
the connection will also be disconnectedprotected void finalize() throws Throwable
public void connect()
public void connect(CallbackHandler connectCallbackHandler)
public void disconnect()
public void stateChange(Connection connection, ConnectionState state, Throwable error)
ConnectionStateListener
stateChange
in interface ConnectionStateListener
connection
- the connection that changedstate
- the new state of the connectionerror
- some error information that lead to the new state (can be null
if it was not an error)Copyright © 2016 Eclipse NeoSCADA Project. All rights reserved.