Class ThreadPool

    • Constructor Detail

      • ThreadPool

        public ThreadPool()
        Default constructor. Set CorePoolSize size to 32 Set Maximum pool size to 256 Set Keep Alive Time to 60 seconds
      • ThreadPool

        public ThreadPool​(int queueSize)
        Default constructor. Set CorePoolSize size to 32 Set Maximum pool size to 256 Set Keep Alive Time to 60 seconds
      • ThreadPool

        public ThreadPool​(int corePoolSize,
                          int maximumPoolSize,
                          long keepAliveTime,
                          TimeUnit unit)
        Size constructor.
      • ThreadPool

        public ThreadPool​(int corePoolSize,
                          int maximumPoolSize,
                          long keepAliveTime,
                          TimeUnit unit,
                          BlockingQueue<Runnable> workQueue)
        Size constructor.
    • Method Detail

      • setProgressVisitor

        public void setProgressVisitor​(org.h2gis.api.ProgressVisitor progressVisitor)
      • hasAvaibleQueueSlot

        public boolean hasAvaibleQueueSlot()
        Returns:
        True if poolSize is inferior of maximum pool size
      • getRemainingTasks

        public int getRemainingTasks()
        Returns:
        Remaining threads Running and queued
      • executeBlocking

        public void executeBlocking​(Runnable command)
        Wait for free queue slot if poolSize is superior or equal of maximum pool size then executes the given task sometime in the future. The task may execute in a new thread or in an existing pooled thread. If the task cannot be submitted for execution, either because this executor has been shutdown or because its capacity has been reached, the task is handled by the current RejectedExecutionHandler.
        Parameters:
        command -
      • submitBlocking

        public <T> Future<T> submitBlocking​(Callable<T> task)
        Wait for free queue slot if poolSize is superior or equal of maximum pool size then executes the given task sometime in the future. The task may execute in a new thread or in an existing pooled thread. If the task cannot be submitted for execution, either because this executor has been shutdown or because its capacity has been reached, the task is handled by the current RejectedExecutionHandler.
        Throws:
        RejectedExecutionException
        NullPointerException