Thread instances.
Provides various bean properties: thread name prefix, thread priority, etc.
Serves as base class for thread factories such as
org..
org.springframework.scheduling.concurrent.CustomizableThreadFactory
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final AtomicInteger | |
| private ThreadGroup | |
| private String | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CustomizableThreadCreator(String
the prefix to use for the names of newly created threads threadNamePrefix)Create a new CustomizableThreadCreator with the given thread name prefix. |
| Modifier and Type | Method and Description |
|---|---|
| public Thread | createThread(Runnable
the Runnable to execute runnable)Template method for the creation of a new |
| protected String | Returns: the default thread name prefix (nevernull)Build the default thread name prefix for this factory. |
| public ThreadGroup | getThreadGroup()
Return the thread group that threads should be created in
(or |
| public String | |
| public int | |
| public boolean | |
| protected String | |
| public void | setDaemon(boolean daemon)
Set whether this factory is supposed to create daemon threads, just executing as long as the application itself is running. |
| public void | |
| public void | setThreadGroupName(String name)
Specify the name of the thread group that threads should be created in. |
| public void | setThreadNamePrefix(String threadNamePrefix)
Specify the prefix to use for the names of newly created threads. |
| public void |
| daemon | back to summary |
|---|---|
| private boolean daemon | |
| threadCount | back to summary |
|---|---|
| private final AtomicInteger threadCount | |
| threadGroup | back to summary |
|---|---|
| private ThreadGroup threadGroup
| |
| threadNamePrefix | back to summary |
|---|---|
| private String threadNamePrefix | |
| threadPriority | back to summary |
|---|---|
| private int threadPriority | |
| CustomizableThreadCreator | back to summary |
|---|---|
| public CustomizableThreadCreator() Create a new CustomizableThreadCreator with default thread name prefix. | |
| CustomizableThreadCreator | back to summary |
|---|---|
| public CustomizableThreadCreator(String threadNamePrefix) Create a new CustomizableThreadCreator with the given thread name prefix.
| |
| createThread | back to summary |
|---|---|
| public Thread createThread(Runnable runnable) Template method for the creation of a new The default implementation creates a new Thread for the given
| |
| getDefaultThreadNamePrefix | back to summary |
|---|---|
| protected String getDefaultThreadNamePrefix() Build the default thread name prefix for this factory.
| |
| getThreadGroup | back to summary |
|---|---|
| public ThreadGroup getThreadGroup() Return the thread group that threads should be created in
(or
| |
| getThreadNamePrefix | back to summary |
|---|---|
| public String getThreadNamePrefix() Return the thread name prefix to use for the names of newly created threads. | |
| getThreadPriority | back to summary |
|---|---|
| public int getThreadPriority() Return the priority of the threads that this factory creates. | |
| isDaemon | back to summary |
|---|---|
| public boolean isDaemon() Return whether this factory should create daemon threads. | |
| nextThreadName | back to summary |
|---|---|
| protected String nextThreadName() Return the thread name to use for a newly created The default implementation returns the specified thread name prefix with an increasing thread count appended: e.g. "SimpleAsyncTaskExecutor-0".
| |
| setDaemon | back to summary |
|---|---|
| public void setDaemon(boolean daemon) Set whether this factory is supposed to create daemon threads, just executing as long as the application itself is running. Default is "false": Concrete factories usually support explicit cancelling. Hence, if the application shuts down, Runnables will by default finish their execution. Specify "true" for eager shutdown of threads which still actively execute
a
| |
| setThreadGroup | back to summary |
|---|---|
| public void setThreadGroup(ThreadGroup threadGroup) Specify the thread group that threads should be created in.
| |
| setThreadGroupName | back to summary |
|---|---|
| public void setThreadGroupName(String name) Specify the name of the thread group that threads should be created in.
| |
| setThreadNamePrefix | back to summary |
|---|---|
| public void setThreadNamePrefix(String threadNamePrefix) Specify the prefix to use for the names of newly created threads. Default is "SimpleAsyncTaskExecutor-". | |
| setThreadPriority | back to summary |
|---|---|
| public void setThreadPriority(int threadPriority) Set the priority of the threads that this factory creates. Default is 5.
| |