private synchronized void abortMerges(){
  stopMerges=true;
  for (  final MergePolicy.OneMerge merge : pendingMerges) {
    if (infoStream.isEnabled("IW")) {
      infoStream.message("IW","now abort pending merge " + segString(merge.segments));
    }
    merge.rateLimiter.setAbort();
    mergeFinish(merge);
  }
  pendingMerges.clear();
  for (  final MergePolicy.OneMerge merge : runningMerges) {
    if (infoStream.isEnabled("IW")) {
      infoStream.message("IW","now abort running merge " + segString(merge.segments));
    }
    merge.rateLimiter.setAbort();
  }
  while (runningMerges.size() != 0) {
    if (infoStream.isEnabled("IW")) {
      infoStream.message("IW","now wait for " + runningMerges.size() + " running merge/s to abort");
    }
    doWait();
  }
  notifyAll();
  assert 0 == mergingSegments.size();
  if (infoStream.isEnabled("IW")) {
    infoStream.message("IW","all running merges have aborted");
  }
}

private synchronized void abortMerges ( ) { stopMerges = true ; for ( final MergePolicy . OneMerge merge : pendingMerges ) { if ( infoStream . isEnabled ( "IW" ) ) { infoStream . message ( "IW" , "now abort pending merge " + segString ( merge . segments ) ) ; } merge . rateLimiter . setAbort ( ) ; mergeFinish ( merge ) ; } pendingMerges . clear ( ) ; for ( final MergePolicy . OneMerge merge : runningMerges ) { if ( infoStream . isEnabled ( "IW" ) ) { infoStream . message ( "IW" , "now abort running merge " + segString ( merge . segments ) ) ; } merge . rateLimiter . setAbort ( ) ; } while ( runningMerges . size ( ) != 0 ) { if ( infoStream . isEnabled ( "IW" ) ) { infoStream . message ( "IW" , "now wait for " + runningMerges . size ( ) + " running merge/s to abort" ) ; } doWait ( ) ; } notifyAll ( ) ; assert 0 == mergingSegments . size ( ) ; if ( infoStream . isEnabled ( "IW" ) ) { infoStream . message ( "IW" , "all running merges have aborted" ) ; } }
aborts running merges . be careful when using this method : when you abort a long - running merge , you lose a lot of work that must later be redone .
