Program: 134986
Project: 134986
Buggy source:
/** 
 * Starts to periodically monitor the resource that <code>checker</code> contains. The monitor delay length is given by   {@link #delaySeconds}. <p>  In order to randomize check times even if many resources get signed up for monitoring one after the other,  the initial delay before the first check is run is taken randomly between 1 second and the period time. 
 * @param checker
 * @param delaySeconds determines the delay between ending a check call and starting the next one. If &lt;1, then the default is used.
 * @throws IllegalStateException if {@link #destroy(long,TimeUnit)} has been called.
 * @throws IllegalArgumentException if any of the arguments are <code>null</code><code>, or if checker.getResource()</code> or <code>checker.getResourceName()</code> returns <code>null</code>.
 */
<T>void monitorResource(ResourceChecker<T> checker,ResourceErrorHandler<T> err,int delaySeconds){
  if (isShuttingDown) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (checker == null || checker.getResource() == null || checker.getResourceName() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (err == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (delaySeconds < 1) {
    delaySeconds=defaultDelaySeconds;
  }
synchronized (resourceRunners) {
    for (    ResourceCheckRunner otherRunner : resourceRunners) {
      ResourceChecker otherChecker=otherRunner.getResourceChecker();
      Object otherResource=otherChecker.getResource();
      String otherResourceName=otherChecker.getResourceName();
      if (otherResource == checker.getResource()) {
        String msg="String_Node_Str" + checker.getResourceName() + "String_Node_Str";
        if (!otherResourceName.equals(checker.getResourceName())) {
          msg+="String_Node_Str" + otherResourceName + "String_Node_Str";
        }
        msg+="String_Node_Str";
        logger.info(msg);
        Future future=otherRunner.getScheduleFuture();
        future.cancel(true);
        resourceRunners.remove(otherChecker);
        break;
      }
    }
    SubsysResourceMonitor.ResourceCheckRunner<T> checkRunner=new SubsysResourceMonitor.ResourceCheckRunner<T>(checker,err,logger,monitorCallThreadPool);
    int initialDelaySeconds=random.nextInt(delaySeconds);
    Future future=scheduler.scheduleWithFixedDelay(checkRunner,initialDelaySeconds,delaySeconds,TimeUnit.SECONDS);
    checkRunner.setScheduleFuture(future);
    resourceRunners.add(checkRunner);
  }
}

Fixed version (ground truth):
/** 
 * Starts to periodically monitor the resource that <code>checker</code> contains. The monitor delay length is given by   {@link #delaySeconds}. <p>  In order to randomize check times even if many resources get signed up for monitoring one after the other,  the initial delay before the first check is run is taken randomly between 1 second and the period time. 
 * @param checker
 * @param delaySeconds determines the delay between ending a check call and starting the next one. If &lt;1, then the default is used.
 * @throws IllegalStateException if {@link #destroy(long,TimeUnit)} has been called.
 * @throws IllegalArgumentException if any of the arguments are <code>null</code><code>, or if checker.getResource()</code> or <code>checker.getResourceName()</code> returns <code>null</code>.
 */
<T>void monitorResource(ResourceChecker<T> checker,ResourceErrorHandler<T> err,int delaySeconds){
  if (isShuttingDown) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (checker == null || checker.getResource() == null || checker.getResourceName() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (err == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (delaySeconds < 1) {
    delaySeconds=defaultDelaySeconds;
  }
synchronized (resourceRunners) {
    for (    ResourceCheckRunner otherRunner : resourceRunners) {
      ResourceChecker otherChecker=otherRunner.getResourceChecker();
      Object otherResource=otherChecker.getResource();
      String otherResourceName=otherChecker.getResourceName();
      if (otherResource == checker.getResource()) {
        String msg="String_Node_Str" + checker.getResourceName() + "String_Node_Str";
        if (!otherResourceName.equals(checker.getResourceName())) {
          msg+="String_Node_Str" + otherResourceName + "String_Node_Str";
        }
        msg+="String_Node_Str";
        logger.info(msg);
        Future future=otherRunner.getScheduleFuture();
        future.cancel(true);
        resourceRunners.remove(otherRunner);
        break;
      }
    }
    SubsysResourceMonitor.ResourceCheckRunner<T> checkRunner=new SubsysResourceMonitor.ResourceCheckRunner<T>(checker,err,logger,monitorCallThreadPool);
    int initialDelaySeconds=random.nextInt(delaySeconds);
    Future future=scheduler.scheduleWithFixedDelay(checkRunner,initialDelaySeconds,delaySeconds,TimeUnit.SECONDS);
    checkRunner.setScheduleFuture(future);
    resourceRunners.add(checkRunner);
  }
}