{
synchronized(proxies)
{
proxies.put(host.getName(), proxy);
}
Host newHost = new Host(host.getName(), host.getPort());
newHost.setIncluded(true);
newHost.setState("CONNECTED");
hostsList.remove(host.getName());
hostsList.put(newHost.getName(), newHost);
//if (host.isIncluded())
// TODO servicesList.addService(host.getName(), proxy);
}
else
future.getChannel().close();
}
}
catch (Exception e)
{
System.out.println("error accessing "+host.getName());
e.printStackTrace();
connected = false;
if (future != null)
future.getChannel().close();
}
}
if (!connected)
{
synchronized(proxies)
{
disconnect(host, proxies.remove(host.getName()));
}
changed = true;
}
else if (proxy == null && !"DISCONNECTED".equals(host.getState()))
{
Host newHost = new Host(host.getName(), host.getPort());
newHost.setIncluded(host.isIncluded());
newHost.setState("DISCONNECTED");
hostsList.put(newHost.getName(), newHost);
}
}
}
}