Class ThreadsDefinition

    • Constructor Detail

      • ThreadsDefinition

        public ThreadsDefinition()
    • Method Detail

      • getShortName

        public String getShortName()
        Specified by:
        getShortName in interface org.apache.camel.NamedNode
      • poolSize

        public ThreadsDefinition poolSize​(int poolSize)
        Sets the core pool size
        Parameters:
        poolSize - the core pool size to keep minimum in the pool
        Returns:
        the builder
      • poolSize

        public ThreadsDefinition poolSize​(String poolSize)
        Sets the core pool size
        Parameters:
        poolSize - the core pool size to keep minimum in the pool
        Returns:
        the builder
      • maxPoolSize

        public ThreadsDefinition maxPoolSize​(int maxPoolSize)
        Sets the maximum pool size
        Parameters:
        maxPoolSize - the maximum pool size
        Returns:
        the builder
      • maxPoolSize

        public ThreadsDefinition maxPoolSize​(String maxPoolSize)
        Sets the maximum pool size
        Parameters:
        maxPoolSize - the maximum pool size
        Returns:
        the builder
      • keepAliveTime

        public ThreadsDefinition keepAliveTime​(long keepAliveTime)
        Sets the keep alive time for idle threads
        Parameters:
        keepAliveTime - keep alive time
        Returns:
        the builder
      • keepAliveTime

        public ThreadsDefinition keepAliveTime​(String keepAliveTime)
        Sets the keep alive time for idle threads
        Parameters:
        keepAliveTime - keep alive time
        Returns:
        the builder
      • timeUnit

        public ThreadsDefinition timeUnit​(TimeUnit keepAliveTimeUnits)
        Sets the keep alive time unit. By default SECONDS is used.
        Parameters:
        keepAliveTimeUnits - time unit
        Returns:
        the builder
      • timeUnit

        public ThreadsDefinition timeUnit​(String keepAliveTimeUnits)
        Sets the keep alive time unit. By default SECONDS is used.
        Parameters:
        keepAliveTimeUnits - time unit
        Returns:
        the builder
      • maxQueueSize

        public ThreadsDefinition maxQueueSize​(int maxQueueSize)
        Sets the maximum number of tasks in the work queue.

        Use -1 or Integer.MAX_VALUE for an unbounded queue

        Parameters:
        maxQueueSize - the max queue size
        Returns:
        the builder
      • maxQueueSize

        public ThreadsDefinition maxQueueSize​(String maxQueueSize)
        Sets the maximum number of tasks in the work queue.

        Use -1 or Integer.MAX_VALUE for an unbounded queue

        Parameters:
        maxQueueSize - the max queue size
        Returns:
        the builder
      • rejectedPolicy

        public ThreadsDefinition rejectedPolicy​(org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy rejectedPolicy)
        Sets the handler for tasks which cannot be executed by the thread pool.
        Parameters:
        rejectedPolicy - the policy for the handler
        Returns:
        the builder
      • rejectedPolicy

        public ThreadsDefinition rejectedPolicy​(String rejectedPolicy)
        Sets the handler for tasks which cannot be executed by the thread pool.
        Parameters:
        rejectedPolicy - the policy for the handler
        Returns:
        the builder
      • threadName

        public ThreadsDefinition threadName​(String threadName)
        Sets the thread name to use.
        Parameters:
        threadName - the thread name
        Returns:
        the builder
      • callerRunsWhenRejected

        public ThreadsDefinition callerRunsWhenRejected​(boolean callerRunsWhenRejected)
        Whether or not to use as caller runs as fallback when a task is rejected being added to the thread pool (when its full). This is only used as fallback if no rejectedPolicy has been configured, or the thread pool has no configured rejection handler.

        Is by default true

        Parameters:
        callerRunsWhenRejected - whether or not the caller should run
        Returns:
        the builder
      • callerRunsWhenRejected

        public ThreadsDefinition callerRunsWhenRejected​(String callerRunsWhenRejected)
        Whether or not to use as caller runs as fallback when a task is rejected being added to the thread pool (when its full). This is only used as fallback if no rejectedPolicy has been configured, or the thread pool has no configured rejection handler.

        Is by default true

        Parameters:
        callerRunsWhenRejected - whether or not the caller should run
        Returns:
        the builder
      • allowCoreThreadTimeOut

        public ThreadsDefinition allowCoreThreadTimeOut​(boolean allowCoreThreadTimeOut)
        Whether idle core threads are allowed to timeout and therefore can shrink the pool size below the core pool size

        Is by default false

        Parameters:
        allowCoreThreadTimeOut - true to allow timeout
        Returns:
        the builder
      • allowCoreThreadTimeOut

        public ThreadsDefinition allowCoreThreadTimeOut​(String allowCoreThreadTimeOut)
        Whether idle core threads is allowed to timeout and therefore can shrink the pool size below the core pool size

        Is by default false

        Parameters:
        allowCoreThreadTimeOut - true to allow timeout
        Returns:
        the builder
      • getExecutorService

        public ExecutorService getExecutorService()
        Specified by:
        getExecutorService in interface org.apache.camel.ExecutorServiceAware
      • setExecutorService

        public void setExecutorService​(ExecutorService executorService)
        Specified by:
        setExecutorService in interface org.apache.camel.ExecutorServiceAware
      • getExecutorServiceRef

        public String getExecutorServiceRef()
        Specified by:
        getExecutorServiceRef in interface org.apache.camel.ExecutorServiceAware
      • setExecutorServiceRef

        public void setExecutorServiceRef​(String executorServiceRef)
        Specified by:
        setExecutorServiceRef in interface org.apache.camel.ExecutorServiceAware
      • getPoolSize

        public String getPoolSize()
      • setPoolSize

        public void setPoolSize​(String poolSize)
      • getMaxPoolSize

        public String getMaxPoolSize()
      • setMaxPoolSize

        public void setMaxPoolSize​(String maxPoolSize)
      • getKeepAliveTime

        public String getKeepAliveTime()
      • setKeepAliveTime

        public void setKeepAliveTime​(String keepAliveTime)
      • getTimeUnit

        public String getTimeUnit()
      • setTimeUnit

        public void setTimeUnit​(String timeUnit)
      • getMaxQueueSize

        public String getMaxQueueSize()
      • setMaxQueueSize

        public void setMaxQueueSize​(String maxQueueSize)
      • getThreadName

        public String getThreadName()
      • setThreadName

        public void setThreadName​(String threadName)
      • getRejectedPolicy

        public String getRejectedPolicy()
      • setRejectedPolicy

        public void setRejectedPolicy​(String rejectedPolicy)
      • getCallerRunsWhenRejected

        public String getCallerRunsWhenRejected()
      • setCallerRunsWhenRejected

        public void setCallerRunsWhenRejected​(String callerRunsWhenRejected)
      • getAllowCoreThreadTimeOut

        public String getAllowCoreThreadTimeOut()
      • setAllowCoreThreadTimeOut

        public void setAllowCoreThreadTimeOut​(String allowCoreThreadTimeOut)