Program: 161776
Project: 161776
Buggy source:
/** 
 * Constructs a new thread pool, though no threads will be started  till it accepts it's first request.  This provides the extra parameters to tune what tasks submitted without a priority will be  scheduled as.  As well as the maximum wait for low priority tasks. The longer low priority tasks wait for a worker, the less chance they will have to make a thread.  But it also makes low priority tasks execution time less predictable.
 * @param corePoolSize pool size that should be maintained
 * @param maxPoolSize maximum allowed thread count
 * @param keepAliveTimeInMs time to wait for a given thread to be idle before killing
 * @param defaultPriority priority to give tasks which do not specify it
 * @param maxWaitForLowPriorityInMs time low priority tasks wait for a worker
 */
public PriorityScheduledExecutor(int corePoolSize,int maxPoolSize,long keepAliveTimeInMs,TaskPriority defaultPriority,long maxWaitForLowPriorityInMs){
  if (corePoolSize < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (maxPoolSize < corePoolSize) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (keepAliveTimeInMs < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (maxWaitForLowPriorityInMs < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (defaultPriority == null) {
    defaultPriority=GLOBAL_DEFAULT_PRIORITY;
  }
  this.defaultPriority=defaultPriority;
  highPriorityLock=makeLock();
  lowPriorityLock=makeLock();
  workersLock=makeLock();
  highPriorityQueue=new DynamicDelayQueue<TaskWrapper>(highPriorityLock);
  lowPriorityQueue=new DynamicDelayQueue<TaskWrapper>(lowPriorityLock);
  availableWorkers=new ArrayDeque<Worker>(maxPoolSize);
  threadFactory=new ThreadFactory(){
    private final ThreadFactory defaultFactory=Executors.defaultThreadFactory();
    @Override public Thread newThread(    Runnable runnable){
      Thread thread=defaultFactory.newThread(runnable);
      thread.setDaemon(USE_DAEMON_THREADS);
      return thread;
    }
  }
;
  highPriorityConsumer=new TaskConsumer(highPriorityQueue,highPriorityLock,new TaskAcceptor(){
    @Override public void acceptTask(    TaskWrapper task) throws InterruptedException {
      runHighPriorityTask(task);
    }
  }
);
  lowPriorityConsumer=new TaskConsumer(lowPriorityQueue,lowPriorityLock,new TaskAcceptor(){
    @Override public void acceptTask(    TaskWrapper task) throws InterruptedException {
      runLowPriorityTask(task);
    }
  }
);
  running=true;
  this.corePoolSize=corePoolSize;
  this.maxPoolSize=maxPoolSize;
  this.keepAliveTimeInMs=keepAliveTimeInMs;
  this.maxWaitForLowPriorityInMs=maxWaitForLowPriorityInMs;
  this.allowCorePoolTimeout=false;
  currentPoolSize=0;
}

Fixed version (ground truth):
/** 
 * Constructs a new thread pool, though no threads will be started  till it accepts it's first request.  This provides the extra parameters to tune what tasks submitted without a priority will be  scheduled as.  As well as the maximum wait for low priority tasks. The longer low priority tasks wait for a worker, the less chance they will have to make a thread.  But it also makes low priority tasks execution time less predictable.
 * @param corePoolSize pool size that should be maintained
 * @param maxPoolSize maximum allowed thread count
 * @param keepAliveTimeInMs time to wait for a given thread to be idle before killing
 * @param defaultPriority priority to give tasks which do not specify it
 * @param maxWaitForLowPriorityInMs time low priority tasks wait for a worker
 * @param threadFactory thread factory for producing new threads within executor
 */
public PriorityScheduledExecutor(int corePoolSize,int maxPoolSize,long keepAliveTimeInMs,TaskPriority defaultPriority,long maxWaitForLowPriorityInMs,ThreadFactory threadFactory){
  if (corePoolSize < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (maxPoolSize < corePoolSize) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (keepAliveTimeInMs < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (maxWaitForLowPriorityInMs < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (defaultPriority == null) {
    defaultPriority=DEFAULT_PRIORITY;
  }
  if (threadFactory == null) {
    threadFactory=Executors.defaultThreadFactory();
  }
  this.defaultPriority=defaultPriority;
  highPriorityLock=makeLock();
  lowPriorityLock=makeLock();
  workersLock=makeLock();
  highPriorityQueue=new DynamicDelayQueue<TaskWrapper>(highPriorityLock);
  lowPriorityQueue=new DynamicDelayQueue<TaskWrapper>(lowPriorityLock);
  availableWorkers=new ArrayDeque<Worker>(maxPoolSize);
  this.threadFactory=threadFactory;
  highPriorityConsumer=new TaskConsumer(highPriorityQueue,highPriorityLock,new TaskAcceptor(){
    @Override public void acceptTask(    TaskWrapper task) throws InterruptedException {
      runHighPriorityTask(task);
    }
  }
);
  lowPriorityConsumer=new TaskConsumer(lowPriorityQueue,lowPriorityLock,new TaskAcceptor(){
    @Override public void acceptTask(    TaskWrapper task) throws InterruptedException {
      runLowPriorityTask(task);
    }
  }
);
  running=true;
  this.corePoolSize=corePoolSize;
  this.maxPoolSize=maxPoolSize;
  this.keepAliveTimeInMs=keepAliveTimeInMs;
  this.maxWaitForLowPriorityInMs=maxWaitForLowPriorityInMs;
  this.allowCorePoolTimeout=false;
  currentPoolSize=0;
}