{
exhibitor.getLog().add(ActivityLog.Type.INFO, "Ensemble state is not yet stable. Automatic Instance Management will wait for stability.");
return true;
}
PseudoLock lock = exhibitor.getConfigManager().newConfigBasedLock();
try
{
if ( lock.lock(exhibitor.getLog(), Exhibitor.AUTO_INSTANCE_MANAGEMENT_PERIOD_MS / 2, TimeUnit.MILLISECONDS) )
{
ServerList potentialServerList = ensembleBuilder.createPotentialServerList();
if ( !potentialServerList.equals(serverList) ) // otherwise, no change
{
if ( potentialServerList.getSpecs().size() == 0 )
{
exhibitor.getLog().add(ActivityLog.Type.INFO, "Automatic Instance Management skipped because new potential server list is empty");
}
else
{
exhibitor.getLog().add(ActivityLog.Type.INFO, "Automatic Instance Management will change the server list: " + serverList + " ==> " + potentialServerList);
adjustConfig(potentialServerList.toSpecString(), clusterState.getLeaderHostname());
}
}
}
}
finally
{
lock.unlock();
}
return true;
}