public void discardJobs(String jobFamily){
  if (VERBOSE)   Util.verbose("DISCARD   background job family - " + jobFamily);
  try {
    org.eclipse.jdt.internal.core.search.processing.IJob currentJob;
synchronized (this) {
      currentJob=currentJob();
      disable();
    }
    if (currentJob != null && (jobFamily == null || currentJob.belongsTo(jobFamily))) {
      currentJob.cancel();
      while (this.processingThread != null && this.executing) {
        try {
          if (VERBOSE)           Util.verbose("-> waiting end of current background job - " + currentJob);
          Thread.sleep(50);
        }
 catch (        InterruptedException e) {
        }
      }
    }
    int loc=-1;
synchronized (this) {
      for (int i=this.jobStart; i <= this.jobEnd; i++) {
        currentJob=this.awaitingJobs[i];
        if (currentJob != null) {
          this.awaitingJobs[i]=null;
          if (!(jobFamily == null || currentJob.belongsTo(jobFamily))) {
            this.awaitingJobs[++loc]=currentJob;
          }
 else {
            if (VERBOSE)             Util.verbose("-> discarding background job  - " + currentJob);
            currentJob.cancel();
          }
        }
      }
      this.jobStart=0;
      this.jobEnd=loc;
    }
  }
  finally {
    enable();
  }
  if (VERBOSE)   Util.verbose("DISCARD   DONE with background job family - " + jobFamily);
}

public void discardJobs ( String jobFamily ) { if ( VERBOSE ) Util . verbose ( "DISCARD   background job family - " + jobFamily ) ; try { org . eclipse . jdt . internal . core . search . processing . IJob currentJob ; synchronized ( this ) { currentJob = currentJob ( ) ; disable ( ) ; } if ( currentJob != null && ( jobFamily == null || currentJob . belongsTo ( jobFamily ) ) ) { currentJob . cancel ( ) ; while ( this . processingThread != null && this . executing ) { try { if ( VERBOSE ) Util . verbose ( "-> waiting end of current background job - " + currentJob ) ; Thread . sleep ( 50 ) ; } catch ( InterruptedException e ) { } } } int loc = - 1 ; synchronized ( this ) { for ( int i = this . jobStart ; i <= this . jobEnd ; i ++ ) { currentJob = this . awaitingJobs [ i ] ; if ( currentJob != null ) { this . awaitingJobs [ i ] = null ; if ( ! ( jobFamily == null || currentJob . belongsTo ( jobFamily ) ) ) { this . awaitingJobs [ ++ loc ] = currentJob ; } else { if ( VERBOSE ) Util . verbose ( "-> discarding background job  - " + currentJob ) ; currentJob . cancel ( ) ; } } } this . jobStart = 0 ; this . jobEnd = loc ; } } finally { enable ( ) ; } if ( VERBOSE ) Util . verbose ( "DISCARD   DONE with background job family - " + jobFamily ) ; }
remove the index from cache for a given project . passing null as a job family discards them all .
