Skip to content

Commit d37b2f0

Browse files
author
tzihan
committed
bug 443365:[feature] App is killed, after mqtt service is restarted, mqtt service should reconnect to the mqtt server
Roll back the change . Still keep the changes to MqttConnection.java, the logic help make the service more stable. bug:44365 Change-Id: I92467f6bc32dafbf2212b7fbaef6692cd32490b7 Signed-off-by: tzihan <zhtang@cn.ibm.com>
1 parent 63c185c commit d37b2f0

1 file changed

Lines changed: 0 additions & 34 deletions

File tree

  • org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service

org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/org/eclipse/paho/android/service/MqttService.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,6 @@ void reconnect() {
362362
for (MqttConnection client : connections.values()) {
363363
traceDebug("Reconnect Client:",
364364
client.getClientId() + '/' + client.getServerURI());
365-
// persist model connection data to retrieve persistId with
366-
// clientHandle;
367-
String[] connectionsurl = client.getServerURI().split(":");
368-
boolean issll = connectionsurl[0].startsWith("ssl") ? true : false;
369-
ModelConnectionPersistence con = ModelConnectionPersistence
370-
.createConnection(client.getClientId(),
371-
connectionsurl[1].substring(2),
372-
Integer.valueOf(connectionsurl[2]),
373-
this.getApplicationContext(), issll, null);
374-
modelConnections.put(client.getClientHandle(), con);
375365
if(this.isOnline()){
376366
client.reconnect();
377367
}
@@ -674,30 +664,6 @@ public void onCreate() {
674664
//new serviceNTFCallback instance
675665
makeNTFCallBackInstance(serviceNTFCallbackCls);
676666
}
677-
//try to reconnect
678-
try {
679-
List<ModelConnectionPersistence> l = persistence
680-
.restoreConnections(this.getApplicationContext());
681-
for (ModelConnectionPersistence c : l) {
682-
String handle = getClient(c.getServerURI(), c.getId(),
683-
c.getCtxId(), null);
684-
connections.get(handle).setConnectOptions(
685-
c.getConnectionOptions());
686-
if (isOnline()) {
687-
// we have an internet connection - have another try
688-
// at
689-
// connecting
690-
connect(handle, c.getConnectionOptions(), null, "0");
691-
}
692-
}
693-
694-
} catch (ConnectionPersistenceException e) {
695-
Log.e("MqttService", e.toString());
696-
} catch (MqttSecurityException e) {
697-
Log.e("MqttService", e.toString());
698-
} catch (MqttException e) {
699-
Log.e("MqttService", e.toString());
700-
}
701667

702668
}
703669
}

0 commit comments

Comments
 (0)