return toReturn;
}
private static String getMasterServerInCluster( String from )
{
ClusterManager clusterManager = new ClusterManager( from );
Pair<String, Integer> masterServer = null;
try
{
clusterManager.waitForSyncConnected();
Machine master = clusterManager.getMaster();
masterServer = master.getServer();
if ( masterServer != null )
{
int backupPort = clusterManager.getBackupPort( master.getMachineId() );
return String.format( ServerAddressFormat,
masterServer.first(), backupPort );
}
throw new ComException(
"Master couldn't be found from cluster managed by " + from );
}
finally
{
clusterManager.shutdown();
}
}