/** Submit exec into pool and throw exceptions */
  public void execute() {
    String p = project.getProperty("number.of.threads");
    if (p != null) {
      ((ThreadPoolExecutor) threadPool).setCorePoolSize(Integer.parseInt(p));
      ((ThreadPoolExecutor) threadPool).setMaximumPoolSize(Integer.parseInt(p));
    }
    TaskRunnable tr = new TaskRunnable();
    threadPool.submit(tr);
    try {
      synchronized (semaphore) {
        while (!tr.isFinished()) semaphore.wait();
      }
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

    Throwable t = tr.getException();
    if (t != null) {
      if (t instanceof BuildException) throw (BuildException) t;
      else t.printStackTrace();
    }
  }
 public void setMaxThreads(int size) {
   pool.setMaximumPoolSize(size);
 }