{
// Ensure there are blockFor distinct living nodes (hints (local) are ok).
// Thus we include the local node (coordinator) as a valid replica if it is there already.
int effectiveEndpoints = writeEndpoints.contains(FBUtilities.getBroadcastAddress()) ? writeEndpoints.size() : writeEndpoints.size() + 1;
if (effectiveEndpoints < responses.get())
throw new UnavailableException(consistencyLevel, responses.get(), effectiveEndpoints);
return;
}
// count destinations that are part of the desired target set
int liveNodes = 0;
for (InetAddress destination : writeEndpoints)
{
if (FailureDetector.instance.isAlive(destination))
liveNodes++;
}
if (liveNodes < responses.get())
{
throw new UnavailableException(consistencyLevel, responses.get(), liveNodes);
}
}