ClusterConnectionConfiguration config = ConfigurationUtils.getReplicationClusterConfiguration(configuration);
locator = getFailbackLocator(config);
ClientSessionFactoryInternal factory = null;
NodeIdListener listener=new NodeIdListener(nodeId0);
locator.addClusterTopologyListener(listener);
try
{
locator.setReconnectAttempts(0);
try
{
locator.addClusterTopologyListener(listener);
factory = locator.connectNoWarnings();
}
catch (Exception notConnected)
{
return false;
}
listener.latch.await(5, TimeUnit.SECONDS);
return listener.isNodePresent;
}
finally
{
if (factory != null)
factory.close();
if (locator != null)
locator.close();
}
}