HessianProxyFactory factory = new HessianProxyFactory(executor, host.getName()+":"+host.getPort());
bootstrap.setPipelineFactory(
new RPCClientPipelineFactory(executor, factory));
// Start the connection attempt.
ChannelFuture future = bootstrap.connect(new InetSocketAddress(host.getName(), host.getPort()));
try
{
future.await(10000);
connected = future.isSuccess();
if (connected)
{
Map options = new HashMap();
options.put("sync", true);
options.put("timeout", new Long(10000));
proxy = (AsyncServiceManagerServer) factory.create(AsyncServiceManagerServer.class, HubMain.class.getClassLoader(), options);
connected = ((Boolean)proxy.isServiceManager()).booleanValue();
if (connected)
{
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)