code: public int getIdleThreads()
     {
        if (executor instanceof ThreadPoolExecutor)
        {
           final ThreadPoolExecutor tpe = (ThreadPoolExecutor)executor;
           return tpe.getPoolSize() - tpe.getActiveCount();
        }
        return -1;
     }
docs: Get the number of idle threads
  @return The number; -1 if not supported