コード例 #1
0
 @Override
 public void beforeIndexShardClosed(
     ShardId shardId, @Nullable IndexShard indexShard, Settings indexSettings) {
   if (indexShard != null) {
     onGoingRecoveries.cancelRecoveriesForShard(shardId, "shard closed");
   }
 }
コード例 #2
0
 /**
  * cancel all ongoing recoveries for the given shard, if their status match a predicate
  *
  * @param reason reason for cancellation
  * @param shardId shardId for which to cancel recoveries
  * @param shouldCancel a predicate to check if a recovery should be cancelled or not. Null means
  *     cancel without an extra check. note that the recovery state can change after this check,
  *     but before it is being cancelled via other already issued outstanding references.
  * @return true if a recovery was cancelled
  */
 public boolean cancelRecoveriesForShard(
     ShardId shardId, String reason, @Nullable Predicate<RecoveryStatus> shouldCancel) {
   return onGoingRecoveries.cancelRecoveriesForShard(shardId, reason, shouldCancel);
 }