Top Description Fields Constructors Methods
org.springframework.messaging.simp.config

public Class TaskExecutorRegistration

extends Object
Class Inheritance
Imports
org.springframework.lang.Nullable, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor, org.springframework.util.Assert

A registration class for customizing the properties of ThreadPoolTaskExecutor.
Authors
Rossen Stoyanchev, Juergen Hoeller
Since
4.0

Field Summary

Modifier and TypeField and Description
private Integer
private Integer
private Integer
private Integer
private final ThreadPoolTaskExecutor
taskExecutor

Deprecated as a consequence of ThreadPoolTaskExecutor being deprecated.

Constructor Summary

AccessConstructor and Description
public
TaskExecutorRegistration()

Create a new TaskExecutorRegistration for a default ThreadPoolTaskExecutor.

public
TaskExecutorRegistration(ThreadPoolTaskExecutor
the executor to use
taskExecutor
)

Deprecated as a consequence of ThreadPoolTaskExecutor being deprecated.
Create a new TaskExecutorRegistration for a given ThreadPoolTaskExecutor.

Method Summary

Modifier and TypeMethod and Description
public TaskExecutorRegistration
corePoolSize(int corePoolSize)

Set the core pool size of the ThreadPoolExecutor.

protected ThreadPoolTaskExecutor
getTaskExecutor()

Deprecated as a consequence of ThreadPoolTaskExecutor being deprecated.
public TaskExecutorRegistration
keepAliveSeconds(int keepAliveSeconds)

Set the time limit for which threads may remain idle before being terminated.

public TaskExecutorRegistration
maxPoolSize(int maxPoolSize)

Set the max pool size of the ThreadPoolExecutor.

public TaskExecutorRegistration
queueCapacity(int queueCapacity)

Set the queue capacity for the ThreadPoolExecutor.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

corePoolSizeback to summary
private Integer corePoolSize
Annotations
@Nullable
keepAliveSecondsback to summary
private Integer keepAliveSeconds
Annotations
@Nullable
maxPoolSizeback to summary
private Integer maxPoolSize
Annotations
@Nullable
queueCapacityback to summary
private Integer queueCapacity
Annotations
@Nullable
taskExecutorback to summary
private final ThreadPoolTaskExecutor taskExecutor

Deprecated

as a consequence of ThreadPoolTaskExecutor being deprecated. See corresponding docs for further information.

Constructor Detail

TaskExecutorRegistrationback to summary
public TaskExecutorRegistration()

Create a new TaskExecutorRegistration for a default ThreadPoolTaskExecutor.

TaskExecutorRegistrationback to summary
public TaskExecutorRegistration(ThreadPoolTaskExecutor taskExecutor)

Deprecated

as a consequence of ThreadPoolTaskExecutor being deprecated. See corresponding docs for further information.

Create a new TaskExecutorRegistration for a given ThreadPoolTaskExecutor.

Parameters
taskExecutor:ThreadPoolTaskExecutor

the executor to use

Method Detail

corePoolSizeback to summary
public TaskExecutorRegistration corePoolSize(int corePoolSize)

Set the core pool size of the ThreadPoolExecutor.

Note

The core pool size is effectively the max pool size when an unbounded queueCapacity is configured (the default). This is essentially the "Unbounded queues" strategy as explained in ThreadPoolExecutor. When this strategy is used, the maxPoolSize is ignored.

By default this is set to twice the value of Runtime#availableProcessors(). In an application where tasks do not block frequently, the number should be closer to or equal to the number of available CPUs/cores.

getTaskExecutorback to summary
protected ThreadPoolTaskExecutor getTaskExecutor()

Deprecated

as a consequence of ThreadPoolTaskExecutor being deprecated. See corresponding docs for further information.

keepAliveSecondsback to summary
public TaskExecutorRegistration keepAliveSeconds(int keepAliveSeconds)

Set the time limit for which threads may remain idle before being terminated. If there are more than the core number of threads currently in the pool, after waiting this amount of time without processing a task, excess threads will be terminated. This overrides any value set in the constructor.

By default this is set to 60.

maxPoolSizeback to summary
public TaskExecutorRegistration maxPoolSize(int maxPoolSize)

Set the max pool size of the ThreadPoolExecutor.

Note

When an unbounded queueCapacity is configured (the default), the max pool size is effectively ignored. See the "Unbounded queues" strategy in ThreadPoolExecutor for more details.

By default this is set to Integer.MAX_VALUE.

queueCapacityback to summary
public TaskExecutorRegistration queueCapacity(int queueCapacity)

Set the queue capacity for the ThreadPoolExecutor.

Note

when an unbounded queueCapacity is configured (the default), the core pool size is effectively the max pool size. This is essentially the "Unbounded queues" strategy as explained in ThreadPoolExecutor. When this strategy is used, the maxPoolSize is ignored.

By default this is set to Integer.MAX_VALUE.