LOG.info("Done!");
// Point deflector to new index.
LOG.info("Pointing deflector to new target index....");
final Activity activity = new Activity(Deflector.class);
if (oldTargetNumber == -1) {
// Only pointing, not cycling.
pointTo(newTarget);
activity.setMessage("Cycled deflector from <none> to <" + newTarget + ">");
} else {
// Re-pointing from existing old index to the new one.
pointTo(newTarget, oldTarget);
LOG.info("Flushing old index <{}>.", oldTarget);
indices.flush(oldTarget);
LOG.info("Setting old index <{}> to read-only.", oldTarget);
indices.setReadOnly(oldTarget);
activity.setMessage("Cycled deflector from <" + oldTarget + "> to <" + newTarget + ">");
if (!configuration.isDisableIndexOptimization()) {
try {
systemJobManager.submit(optimizeIndexJobFactory.create(oldTarget));
} catch (SystemJobConcurrencyException e) {