Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
Details
Activity
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
liyuan
byit-myth-job
Commits
0634a7a8
Commit
0634a7a8
authored
Apr 03, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Netty服务端 线程池创建器编码
parent
0de98b40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
ThreadPoolUtil.java
...c-common/src/main/java/com/byit/utils/ThreadPoolUtil.java
+33
-0
No files found.
byit-plugin-core/byit-plugin-rpc-common/src/main/java/com/byit/utils/ThreadPoolUtil.java
0 → 100644
View file @
0634a7a8
package
com
.
byit
.
utils
;
import
com.byit.rpc.util.RpcException
;
import
java.util.concurrent.*
;
/**
* 线程池创建工具
* @author huangfu
*/
public
class
ThreadPoolUtil
{
/**
* 线程池创建
* @param serverType 服务名称
* @return 返回一个线程池
*/
public
static
ThreadPoolExecutor
makeServerThreadPool
(
final
String
serverType
,
int
corePoolSize
,
int
maxPoolSize
){
return
new
ThreadPoolExecutor
(
corePoolSize
,
maxPoolSize
,
60L
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(
1000
),
r
->
new
Thread
(
r
,
"myth-plugin-rpc, "
+
serverType
+
"-serverHandlerPool-"
+
r
.
hashCode
()),
(
r
,
executor
)
->
{
throw
new
RpcException
(
"myth-plugin-rpc "
+
serverType
+
" Thread pool is EXHAUSTED!"
);
});
}
}
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