Removed retries policy during the send of CONNECT message

This commit is contained in:
selva.andre
2012-07-31 22:21:33 +02:00
parent 80466f6c5f
commit ae404f047e
@@ -100,23 +100,14 @@ public final class Client {
public void connect() throws MQTTException {
int retries = 0;
//TODO perhaps by proto deinifinition should be an implicit retry policy
// for (; retries < m_connectRetries; retries++) {
try {
ConnectFuture future = m_connector.connect(new InetSocketAddress(m_hostname, m_port));
LOG.fine("Client waiting to connect to server");
future.awaitUninterruptibly();
m_session = future.getSession();
// break;
} catch (RuntimeIoException e) {
LOG.log(Level.FINE, "Failed to connect, retry " + retries + " of ("+m_connectRetries+")", e);
}
// try {
// Thread.sleep(1000);
// } catch (InterruptedException ex) {
// LOG.log(Level.SEVERE, "Error while sleeping for retry", ex);
// }
// }
try {
ConnectFuture future = m_connector.connect(new InetSocketAddress(m_hostname, m_port));
LOG.fine("Client waiting to connect to server");
future.awaitUninterruptibly();
m_session = future.getSession();
} catch (RuntimeIoException e) {
LOG.log(Level.FINE, "Failed to connect, retry " + retries + " of ("+m_connectRetries+")", e);
}
if (retries == m_connectRetries) {
throw new MQTTException("Can't connect to the server after " + retries + "retries");