public synchronized void clear() {
   parentIndexFieldData = null;
   List<Throwable> exceptions = new ArrayList<>(0);
   final Collection<IndexFieldDataCache> fieldDataCacheValues = fieldDataCaches.values();
   for (IndexFieldDataCache cache : fieldDataCacheValues) {
     try {
       cache.clear();
     } catch (Throwable t) {
       exceptions.add(t);
     }
   }
   fieldDataCacheValues.clear();
   ExceptionsHelper.maybeThrowRuntimeAndSuppress(exceptions);
 }
 public synchronized void clearField(final String fieldName) {
   if (ParentFieldMapper.NAME.equals(fieldName)) {
     parentIndexFieldData = null;
   }
   List<Throwable> exceptions = new ArrayList<>(0);
   final IndexFieldDataCache cache = fieldDataCaches.remove(fieldName);
   if (cache != null) {
     try {
       cache.clear();
     } catch (Throwable t) {
       exceptions.add(t);
     }
   }
   ExceptionsHelper.maybeThrowRuntimeAndSuppress(exceptions);
 }
 synchronized void cancel(IndexShard shard, String reason) {
   final ShardRecoveryContext shardRecoveryContext = ongoingRecoveries.get(shard);
   if (shardRecoveryContext != null) {
     final List<Exception> failures = new ArrayList<>();
     for (RecoverySourceHandler handlers : shardRecoveryContext.recoveryHandlers) {
       try {
         handlers.cancel(reason);
       } catch (Exception ex) {
         failures.add(ex);
       } finally {
         shard.recoveryStats().decCurrentAsSource();
       }
     }
     ExceptionsHelper.maybeThrowRuntimeAndSuppress(failures);
   }
 }