Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengtianlai3
ioc_sixiang_license
Commits
c6980c81
Commit
c6980c81
authored
Nov 08, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
格式
parent
f55efe5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
ThreadPoolConfig.java
...ain/java/iot/sixiang/license/config/ThreadPoolConfig.java
+6
-4
No files found.
license/src/main/java/iot/sixiang/license/config/ThreadPoolConfig.java
View file @
c6980c81
...
@@ -2,11 +2,12 @@ package iot.sixiang.license.config;
...
@@ -2,11 +2,12 @@ package iot.sixiang.license.config;
/**
/**
* Title: ThreadPoolConfig
* Title: ThreadPoolConfig
* Description:
TODO
* Description:
*
*
* @author tianlai3
* @author tianlai3
* @date 2022-07-16 20:05:38
* @date 2022-07-16 20:05:38
*/
*/
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -15,22 +16,23 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
...
@@ -15,22 +16,23 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.ThreadPoolExecutor
;
@Data
@Data
@Configuration
@Configuration
@EnableAsync
@EnableAsync
public
class
ThreadPoolConfig
{
public
class
ThreadPoolConfig
{
private
static
final
int
corePoolSize
=
1
;
// 核心线程数(默认线程数)
private
static
final
int
corePoolSize
=
1
;
// 核心线程数(默认线程数)
private
static
final
int
maxPoolSize
=
2
;
// 最大线程数
private
static
final
int
maxPoolSize
=
2
;
// 最大线程数
private
static
final
int
keepAliveTime
=
10
;
// 允许线程空闲时间(单位:默认为秒)
private
static
final
int
keepAliveTime
=
10
;
// 允许线程空闲时间(单位:默认为秒)
private
static
final
int
queueCapacity
=
2
;
// 缓冲队列数
private
static
final
int
queueCapacity
=
2
;
// 缓冲队列数
/**
/**
* 默认异步线程池
* 默认异步线程池
*
* @return
* @return
*/
*/
@Bean
(
"taskExecutor"
)
@Bean
(
"taskExecutor"
)
public
Executor
taskExecutor
(){
public
Executor
taskExecutor
()
{
ThreadPoolTaskExecutor
pool
=
new
ThreadPoolTaskExecutor
();
ThreadPoolTaskExecutor
pool
=
new
ThreadPoolTaskExecutor
();
pool
.
setThreadNamePrefix
(
"threadPoll-"
);
pool
.
setThreadNamePrefix
(
"threadPoll-"
);
pool
.
setCorePoolSize
(
corePoolSize
);
pool
.
setCorePoolSize
(
corePoolSize
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment