Hi all,
Im the sample code there is a reconnection handling which does 3 light reconnects on a onDisconnect() event, if that fails
all it does is:
try {
client.connect(JNLP_URL, JNLP_USERNAME, JNLP_PASSWORD);
} catch (final Exception e) {
e.printStackTrace();
}
If I get an Exception while client.connect(...), this ends up in an unconnected client.
I decided to implement the following onDisconnect(..):
@Override
public void onDisconnect() {
LOGGER.warn("Disconnected");
if (lightReconnects > 0) {
client.reconnect();
--lightReconnects;
} else {
while (!client.isConnected()) {
LOGGER.warn("reconnecting in 3 sec...");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
client.connect(jnlpUrl, userName, password);
} catch (JFAuthenticationException e) {
LOGGER.error("JFAuthenticationException",
e.getMessage());
} catch (JFVersionException e) {
LOGGER.error("JFVersionException", e.getMessage());
} catch (Exception e) {
LOGGER.error("Exception", e.getMessage());
}
}
}
}
1. Do I need to resubscribe the instruments or set the client.setSystemListener(new ISystemListener() again after a full reconnect?
2. Since I reuse the same "client" instance, I would say not. But that would mean I can subscribe instruments on the client while I'm offline (before I connect) - is that correct?
Regards,
Chris