Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
嗝屁小孩纸
guide-rpc-framework
提交
cc2e6b30
G
guide-rpc-framework
项目概览
嗝屁小孩纸
/
guide-rpc-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
guide-rpc-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cc2e6b30
编写于
5月 26, 2020
作者:
S
shuang.kou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[v2.0]refractor create a threadpool util
上级
df21fdea
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
120 addition
and
20 deletion
+120
-20
.idea/compiler.xml
.idea/compiler.xml
+1
-1
.idea/sonarlint/issuestore/5/e/5eb67949aee12c29202ad46a9a5acdd558cc76b9
...t/issuestore/5/e/5eb67949aee12c29202ad46a9a5acdd558cc76b9
+5
-1
.idea/sonarlint/issuestore/7/0/705e8b4dff28a291cae5396865e0f0fa96cda002
...t/issuestore/7/0/705e8b4dff28a291cae5396865e0f0fa96cda002
+1
-1
.idea/sonarlint/issuestore/b/d/bddd79bdb61bde8988615c5e657068492162e9e3
...t/issuestore/b/d/bddd79bdb61bde8988615c5e657068492162e9e3
+1
-1
.idea/sonarlint/issuestore/index.pb
.idea/sonarlint/issuestore/index.pb
+35
-11
example-client/src/main/java/github/javaguide/NettyClientMain.java
...lient/src/main/java/github/javaguide/NettyClientMain.java
+1
-2
example-client/src/main/java/github/javaguide/RpcFrameworkSimpleClientMain.java
...n/java/github/javaguide/RpcFrameworkSimpleClientMain.java
+1
-1
example-client/target/classes/github/javaguide/NettyClientMain.class
...ent/target/classes/github/javaguide/NettyClientMain.class
+0
-0
example-client/target/classes/github/javaguide/RpcFrameworkSimpleClientMain.class
...asses/github/javaguide/RpcFrameworkSimpleClientMain.class
+0
-0
example-server/src/main/java/github/javaguide/NettyServerMain.java
...erver/src/main/java/github/javaguide/NettyServerMain.java
+1
-2
example-server/target/classes/github/javaguide/NettyServerMain.class
...ver/target/classes/github/javaguide/NettyServerMain.class
+0
-0
pom.xml
pom.xml
+3
-0
rpc-framework-common/pom.xml
rpc-framework-common/pom.xml
+8
-0
rpc-framework-common/src/main/java/github/javaguide/utils/concurrent/ThreadPoolFactory.java
.../github/javaguide/utils/concurrent/ThreadPoolFactory.java
+63
-0
rpc-framework-common/target/classes/github/javaguide/utils/concurrent/ThreadPoolFactory.class
...github/javaguide/utils/concurrent/ThreadPoolFactory.class
+0
-0
未找到文件。
.idea/compiler.xml
浏览文件 @
cc2e6b30
...
...
@@ -8,10 +8,10 @@
<sourceTestOutputDir
name=
"target/generated-test-sources/test-annotations"
/>
<outputRelativeToContentRoot
value=
"true"
/>
<module
name=
"rpc-framework-core"
/>
<module
name=
"hello-service-api"
/>
<module
name=
"example-server"
/>
<module
name=
"rpc-framework-simple"
/>
<module
name=
"example-client"
/>
<module
name=
"hello-service-api"
/>
<module
name=
"rpc-framework-common"
/>
</profile>
</annotationProcessing>
...
...
.idea/sonarlint/issuestore/5/e/5eb67949aee12c29202ad46a9a5acdd558cc76b9
浏览文件 @
cc2e6b30
U java:S106"9Replace this use of System.out or System.err by a logger.(߫ź8.
\ No newline at end of file
U java:S106"9Replace this use of System.out or System.err by a logger.(߫ź8.
[
java:S1854">Remove this useless assignment to local variable "rpcClient2".(8իؤ.
L
java:S1481"/Remove this unused "rpcClient2" local variable.(8ؤ.
\ No newline at end of file
.idea/sonarlint/issuestore/7/0/705e8b4dff28a291cae5396865e0f0fa96cda002
浏览文件 @
cc2e6b30
G
java:S1948",Make "parameters" transient or serializable.(
\ No newline at end of file
java:S1948",Make "parameters" transient or serializable.(
\ No newline at end of file
.idea/sonarlint/issuestore/b/d/bddd79bdb61bde8988615c5e657068492162e9e3
浏览文件 @
cc2e6b30
C
java:S1948"&Make "data" transient or serializable.(ݵ8ε .
\ No newline at end of file
java:S1948%"&Make "data" transient or serializable.(ݵ8ε .
\ No newline at end of file
.idea/sonarlint/issuestore/index.pb
浏览文件 @
cc2e6b30
...
...
@@ -43,18 +43,42 @@ Xrpc-framework-common/src/main/java/github/javaguide/enumeration/RpcErrorMessage
README.md,8/e/8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d
Qrpc-framework-simple/src/main/java/github/javaguide/registry/ServiceRegistry.java,4/e/4eee7bde8d258a3ad13d5aad4b1fd0f47f159c22
brpc-framework-simple/src/main/java/github/javaguide/remoting/socket/RpcRequestHandlerRunnable.java,3/8/38c46e918cbf2fd183a4d20b5269ff145a5da008
Xrpc-framework-simple/src/main/java/github/javaguide/registry/DefaultServiceRegistry.java,8/a/8a8f0ad1908e89647431f04ae22e059fd159d0c1
Rrpc-framework-simple/src/main/java/github/javaguide/remoting/socket/RpcClient.java,8/c/8c93c859db3a1cebbda725b6225a89337732c108
Wrpc-framework-simple/src/main/java/github/javaguide/remoting/socket/RpcClientProxy.java,3/5/350655342260f50b6ee7ce69dcb361bad3956984
Rrpc-framework-simple/src/main/java/github/javaguide/remoting/socket/RpcServer.java,c/f/cf4f29284214a49bc9f1eeb91eff2d0fbb46e184
Srpc-framework-simple/src/main/java/github/javaguide/remoting/RpcRequestHandler.java,e/b/eb77dbc7968406e86bad5a749c9941052f4f3ccc
:
.gitignore,a/5/a5cc2925ca8258af241be7e5b0381edf30266302
\ No newline at end of file
.gitignore,a/5/a5cc2925ca8258af241be7e5b0381edf30266302
Yrpc-framework-simple/src/main/java/github/javaguide/transport/socket/SocketRpcServer.java,4/f/4f3eda1b64c4d4f1b976343bec03d82d70d85cb1
Yrpc-framework-simple/src/main/java/github/javaguide/transport/netty/NettyKryoDecoder.java,7/9/79a691ec739a58083ef0ac1389203a2fbd71f456
}
Mrpc-framework-simple/src/main/java/github/javaguide/serialize/Serializer.java,a/2/a281e49e82a8ec2f7ba12a8bcb5f2186f46d0c77
Urpc-framework-common/src/main/java/github/javaguide/exception/SerializeException.java,1/e/1e9d139dec5a90552b914b239037df398d72bfb1
Vrpc-framework-simple/src/main/java/github/javaguide/serialize/kyro/KryoSerializer.java,7/7/77bd9277dc37adef29330c1e78ac2f2485032917
Qrpc-framework-simple/src/main/java/github/javaguide/transport/RpcClientProxy.java,2/8/28a849b18f6cfe08ef45a480dff1b8324e54e765
|
Lrpc-framework-simple/src/main/java/github/javaguide/transport/RpcClient.java,a/2/a2293a8598601b418206102ff4a42e86ac5c116d
Yrpc-framework-simple/src/main/java/github/javaguide/transport/socket/SocketRpcClient.java,5/0/50091113d4118fd9d05b7a80930d905591dadd6c
Yrpc-framework-simple/src/main/java/github/javaguide/transport/netty/NettyKryoEncoder.java,e/5/e5d48526802e06de10a1802186f9d33d10ff47aa
r
Bexample-server/src/main/java/github/javaguide/NettyServerMain.java,1/7/171870430a59c0c44d9340650aff70ba39acaea8
r
Bexample-client/src/main/java/github/javaguide/NettyClientMain.java,9/e/9ec852e88ae42cd2b9eceb76fd0df53f26fa5b76
Wrpc-framework-simple/src/main/java/github/javaguide/transport/netty/NettyRpcClient.java,a/2/a2710f8ba941b11e1d834a0c57a10db363ee4baf
Wrpc-framework-simple/src/main/java/github/javaguide/transport/netty/NettyRpcServer.java,b/a/ba3e575560636fde885135fa5277f533bf61af1c
[rpc-framework-simple/src/main/java/github/javaguide/transport/netty/NettyClientHandler.java,c/d/cd2bc58a2ed26406a5749d14c0148f8237bb9e14
Trpc-framework-simple/src/main/java/github/javaguide/transport/RpcRequestHandler.java,7/6/76847b5dee1f00ac9229b826500369c60abd7b74
irpc-framework-simple/src/main/java/github/javaguide/transport/socket/SocketRpcRequestHandlerRunnable.java,7/d/7dc3255c598b3c45cab343a0a79f2aab582ce3a0
[rpc-framework-simple/src/main/java/github/javaguide/transport/netty/NettyServerHandler.java,9/a/9a59d8568dc116ae0a68f1173ac9ae7c57ee637e
\ No newline at end of file
example-client/src/main/java/github/javaguide/NettyClientMain.java
浏览文件 @
cc2e6b30
...
...
@@ -2,8 +2,7 @@ package github.javaguide;
import
github.javaguide.transport.RpcClient
;
import
github.javaguide.transport.RpcClientProxy
;
import
github.javaguide.transport.netty.NettyRpcClient
;
import
github.javaguide.transport.socket.SocketRpcClient
;
import
github.javaguide.transport.netty.client.NettyRpcClient
;
/**
* @author shuang.kou
...
...
example-client/src/main/java/github/javaguide/RpcFrameworkSimpleClientMain.java
浏览文件 @
cc2e6b30
...
...
@@ -2,7 +2,7 @@ package github.javaguide;
import
github.javaguide.transport.RpcClient
;
import
github.javaguide.transport.RpcClientProxy
;
import
github.javaguide.transport.netty.NettyRpcClient
;
import
github.javaguide.transport.netty.
client.
NettyRpcClient
;
import
github.javaguide.transport.socket.SocketRpcClient
;
/**
...
...
example-client/target/classes/github/javaguide/NettyClientMain.class
浏览文件 @
cc2e6b30
无法预览此类型文件
example-client/target/classes/github/javaguide/RpcFrameworkSimpleClientMain.class
浏览文件 @
cc2e6b30
无法预览此类型文件
example-server/src/main/java/github/javaguide/NettyServerMain.java
浏览文件 @
cc2e6b30
package
github.javaguide
;
import
github.javaguide.registry.DefaultServiceRegistry
;
import
github.javaguide.transport.netty.NettyRpcServer
;
import
github.javaguide.transport.socket.SocketRpcServer
;
import
github.javaguide.transport.netty.server.NettyRpcServer
;
/**
* @author shuang.kou
...
...
example-server/target/classes/github/javaguide/NettyServerMain.class
浏览文件 @
cc2e6b30
无法预览此类型文件
pom.xml
浏览文件 @
cc2e6b30
...
...
@@ -15,8 +15,11 @@
<!--logging-->
<log4j.version>
2.9.0
</log4j.version>
<slf4j.version>
1.7.25
</slf4j.version>
<!--Netty-->
<netty.version>
4.1.42.Final
</netty.version>
<kryo.version>
4.0.2
</kryo.version>
<!--tools-->
<guava.version>
29.0-jre
</guava.version>
</properties>
<modules>
<module>
rpc-framework-core
</module>
...
...
rpc-framework-common/pom.xml
浏览文件 @
cc2e6b30
...
...
@@ -11,5 +11,13 @@
<artifactId>
rpc-framework-common
</artifactId>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
${guava.version}
</version>
</dependency>
</dependencies>
</project>
rpc-framework-common/src/main/java/github/javaguide/utils/concurrent/ThreadPoolFactory.java
0 → 100644
浏览文件 @
cc2e6b30
package
github.javaguide.utils.concurrent
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ThreadFactory
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
/**
* 创建 ThreadPool(线程池) 的工具类.
*
* @author shuang.kou
* @createTime 2020年05月26日 16:00:00
*/
public
class
ThreadPoolFactory
{
/**
* 线程池参数
*/
private
static
final
int
CORE_POOL_SIZE
=
10
;
private
static
final
int
MAXIMUM_POOL_SIZE_SIZE
=
100
;
private
static
final
int
KEEP_ALIVE_TIME
=
1
;
private
static
final
int
BLOCKING_QUEUE_CAPACITY
=
100
;
private
ThreadPoolFactory
()
{
}
public
static
ExecutorService
createDefaultThreadPool
(
String
threadNamePrefix
)
{
return
createDefaultThreadPool
(
threadNamePrefix
,
false
);
}
public
static
ExecutorService
createDefaultThreadPool
(
String
threadNamePrefix
,
Boolean
daemon
)
{
// 使用有界队列
BlockingQueue
<
Runnable
>
workQueue
=
new
ArrayBlockingQueue
<>(
BLOCKING_QUEUE_CAPACITY
);
ThreadFactory
threadFactory
=
createThreadFactory
(
threadNamePrefix
,
daemon
);
return
new
ThreadPoolExecutor
(
CORE_POOL_SIZE
,
MAXIMUM_POOL_SIZE_SIZE
,
KEEP_ALIVE_TIME
,
TimeUnit
.
MINUTES
,
workQueue
,
threadFactory
);
}
/**
* 创建 ThreadFactory 。如果threadNamePrefix不为空则使用自建ThreadFactory,否则使用defaultThreadFactory
*
* @param threadNamePrefix 作为创建的线程名字的前缀
* @param daemon 指定是否为 Daemon Thread(守护线程)
* @return ThreadFactory
*/
private
static
ThreadFactory
createThreadFactory
(
String
threadNamePrefix
,
Boolean
daemon
)
{
if
(
threadNamePrefix
!=
null
)
{
if
(
daemon
!=
null
)
{
return
new
ThreadFactoryBuilder
().
setNameFormat
(
threadNamePrefix
+
"-%d"
).
setDaemon
(
daemon
).
build
();
}
else
{
return
new
ThreadFactoryBuilder
().
setNameFormat
(
threadNamePrefix
+
"-%d"
).
build
();
}
}
return
Executors
.
defaultThreadFactory
();
}
}
rpc-framework-common/target/classes/github/javaguide/utils/concurrent/ThreadPoolFactory.class
0 → 100644
浏览文件 @
cc2e6b30
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录