parentSession = ActiveRepairService.instance.prepareForRepair(neighbours, ranges, columnFamilyStores);
List<RepairFuture> futures = new ArrayList<>(ranges.size());
for (Range<Token> range : ranges)
{
RepairFuture future;
try
{
future = forceKeyspaceRepair(parentSession, range, keyspace, isSequential, neighbours, columnFamilies);
}
catch (IllegalArgumentException e)
{
logger.error("Repair session failed:", e);
sendNotification("repair", message, new int[]{cmd, ActiveRepairService.Status.SESSION_FAILED.ordinal()});
continue;
}
if (future == null)
continue;
futures.add(future);
// wait for a session to be done with its differencing before starting the next one
try
{
future.session.differencingDone.await();
}
catch (InterruptedException e)
{
message = "Interrupted while waiting for the differencing of repair session " + future.session + " to be done. Repair may be imprecise.";
logger.error(message, e);
sendNotification("repair", message, new int[]{cmd, ActiveRepairService.Status.SESSION_FAILED.ordinal()});
}
}
for (RepairFuture future : futures)
{
try
{
future.get();
message = String.format("Repair session %s for range %s finished", future.session.getId(), future.session.getRange().toString());
logger.info(message);
sendNotification("repair", message, new int[]{cmd, ActiveRepairService.Status.SESSION_SUCCESS.ordinal()});
}
catch (ExecutionException e)