Removed retries policy during the send of CONNECT message
This commit is contained in:
@@ -100,23 +100,14 @@ public final class Client {
|
|||||||
public void connect() throws MQTTException {
|
public void connect() throws MQTTException {
|
||||||
int retries = 0;
|
int retries = 0;
|
||||||
|
|
||||||
//TODO perhaps by proto deinifinition should be an implicit retry policy
|
try {
|
||||||
// for (; retries < m_connectRetries; retries++) {
|
ConnectFuture future = m_connector.connect(new InetSocketAddress(m_hostname, m_port));
|
||||||
try {
|
LOG.fine("Client waiting to connect to server");
|
||||||
ConnectFuture future = m_connector.connect(new InetSocketAddress(m_hostname, m_port));
|
future.awaitUninterruptibly();
|
||||||
LOG.fine("Client waiting to connect to server");
|
m_session = future.getSession();
|
||||||
future.awaitUninterruptibly();
|
} catch (RuntimeIoException e) {
|
||||||
m_session = future.getSession();
|
LOG.log(Level.FINE, "Failed to connect, retry " + retries + " of ("+m_connectRetries+")", e);
|
||||||
// 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);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (retries == m_connectRetries) {
|
if (retries == m_connectRetries) {
|
||||||
throw new MQTTException("Can't connect to the server after " + retries + "retries");
|
throw new MQTTException("Can't connect to the server after " + retries + "retries");
|
||||||
|
|||||||
Reference in New Issue
Block a user