Class ManagedThreadPool.ExecutionConfig

  • Enclosing class:
    ManagedThreadPool

    public static class ManagedThreadPool.ExecutionConfig
    extends Object
    Class that permits to specify the execution configuration.
    • Method Detail

      • maxThreadPoolSizeOf

        public static ManagedThreadPool.ExecutionConfig maxThreadPoolSizeOf​(int maxThreadPoolSize)
        Gets an instance of an execution configuration with a specified maximum pool of thread.
        This is only useful when invoking Callable instances.
        Parameters:
        maxThreadPoolSize - the maximum size of the treads pool.
        Returns:
        an instance of an execution configuration with a specified maximum pool of thread.
      • timeoutOf

        public static ManagedThreadPool.ExecutionConfig timeoutOf​(long timeout)
        Gets an instance of an execution configuration with a specified timeout in milliseconds.
        Parameters:
        timeout - the timeout
        Returns:
        an instance of an execution configuration with a specified timeout in milliseconds.
      • defaultConfig

        public static ManagedThreadPool.ExecutionConfig defaultConfig()
        Gets an instance of a default execution configuration.
        Returns:
        an instance of a default execution configuration.
      • withTimeoutOf

        public ManagedThreadPool.ExecutionConfig withTimeoutOf​(long timeout,
                                                               TimeUnit timeUnit)
        Sets a timeout after that the invocation process will give back hand.
        Parameters:
        timeout - the timeout after which the hand must be get back to the caller.
        timeUnit - the time unit of the given timeout (default is milliseconds).
        Returns:
        the instance of ManagedThreadPool.ExecutionConfig.