Fix ArrayIndexOutOfException on remote client reconnect
@@ -331,6 +331,7 @@ public class OStorageRemote extends OStorageAbstract implements OStorageProxy, O
// Remove the current url because the node is offline
synchronized (serverURLs) {
serverURLs.remove(serverUrl);
+ this.nextServerToConnect = 0;
}
for (OStorageRemoteSession activeSession : sessions) {
// Not thread Safe ...
@@ -1252,6 +1253,7 @@ public class OStorageRemote extends OStorageAbstract implements OStorageProxy, O
public void removeSessions(final String url) {
synchronized (serverURLs) {
serverURLs.remove(url);
+ this.nextServerToConnect = 0;
}
for (OStorageRemoteSession session : sessions) {
@@ -1564,6 +1566,7 @@ public class OStorageRemote extends OStorageAbstract implements OStorageProxy, O
synchronized (serverURLs) {
// REMOVE INVALID URL
serverURLs.remove(url);
+ this.nextServerToConnect = 0;
for (OStorageRemoteSession activeSession : sessions) {
// Not thread Safe ...
activeSession.removeServerSession(url + "/" + getName());
@@ -1616,6 +1619,7 @@ public class OStorageRemote extends OStorageAbstract implements OStorageProxy, O
List<String> toAdd = fetchHostsFromDns(lastHost);
if (toAdd.size() > 0) {
serverURLs.clear();
+ this.nextServerToConnect = 0;
for (String host : toAdd)
addHost(host);
}
