@Override
 public int blockForAvailableThreads() {
   try {
     threadPoolExecutor.getSemaphore().acquire();
     try {
       return threadPoolExecutor.getSemaphore().availablePermits() + 1;
     } finally {
       threadPoolExecutor.getSemaphore().release();
     }
   } catch (InterruptedException e) {
     throw Throwables.propagate(e);
   }
 }
 @Override
 public int getPoolSize() {
   return threadPoolExecutor.getPoolSize();
 }