Class CountableThreadPool

  • public class CountableThreadPool
    extends java.lang.Object
    Thread pool for workers.

    Use ExecutorService as inner implement.

    New feature:

    1. Block when thread pool is full to avoid poll many urls without process.

    2. Count of thread alive for monitor.
    • Constructor Detail

      • CountableThreadPool

        public CountableThreadPool​(int threadNum)
      • CountableThreadPool

        public CountableThreadPool​(int threadNum,
                                   java.util.concurrent.ExecutorService executorService)
    • Method Detail

      • setExecutorService

        public void setExecutorService​(java.util.concurrent.ExecutorService executorService)
      • getThreadAlive

        public int getThreadAlive()
      • getThreadNum

        public int getThreadNum()
      • execute

        public void execute​(java.lang.Runnable runnable)
      • isShutdown

        public boolean isShutdown()
      • shutdown

        public void shutdown()