Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
Rocketmq
提交
489b1d8b
R
Rocketmq
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
Rocketmq
与 Fork 源项目一致
Fork自
Apache RocketMQ / Rocketmq
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rocketmq
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
489b1d8b
编写于
9月 20, 2017
作者:
Y
yukon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use LinkedBlockingQueue for better performance
上级
114b6ae0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
21 deletion
+39
-21
remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstract.java
...e/rocketmq/remoting/impl/netty/NettyRemotingAbstract.java
+1
-2
remoting-core/rpc-impl/src/main/java/org/apache/rocketmq/rpc/impl/client/SimpleClientImpl.java
...org/apache/rocketmq/rpc/impl/client/SimpleClientImpl.java
+8
-4
remoting-core/rpc-impl/src/main/java/org/apache/rocketmq/rpc/impl/server/SimpleServerImpl.java
...org/apache/rocketmq/rpc/impl/server/SimpleServerImpl.java
+7
-4
remoting-core/rpc-impl/src/main/java/org/apache/rocketmq/rpc/impl/service/RpcInstanceAbstract.java
...apache/rocketmq/rpc/impl/service/RpcInstanceAbstract.java
+8
-4
remoting-core/rpc-impl/src/main/java/org/apache/rocketmq/rpc/impl/service/RpcProxyCommon.java
.../org/apache/rocketmq/rpc/impl/service/RpcProxyCommon.java
+15
-7
未找到文件。
remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstract.java
浏览文件 @
489b1d8b
...
...
@@ -25,7 +25,6 @@ import io.netty.channel.SimpleChannelInboundHandler;
import
java.net.InetSocketAddress
;
import
java.net.SocketAddress
;
import
java.util.Map
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.LinkedBlockingQueue
;
...
...
@@ -98,7 +97,7 @@ public abstract class NettyRemotingAbstract implements RemotingService {
clientConfig
.
getClientAsyncCallbackExecutorThreads
(),
60
,
TimeUnit
.
SECONDS
,
new
Array
BlockingQueue
<
Runnable
>(
10000
),
new
Linked
BlockingQueue
<
Runnable
>(
10000
),
"PublicExecutor"
,
true
);
this
.
remotingCommandFactory
=
new
RemotingCommandFactoryImpl
(
remotingCommandFactoryMeta
);
}
...
...
remoting-core/rpc-impl/src/main/java/org/apache/rocketmq/rpc/impl/client/SimpleClientImpl.java
浏览文件 @
489b1d8b
...
...
@@ -18,8 +18,8 @@
package
org.apache.rocketmq.rpc.impl.client
;
import
java.util.Properties
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.TimeUnit
;
import
org.apache.rocketmq.remoting.api.RemotingClient
;
import
org.apache.rocketmq.remoting.api.RemotingService
;
...
...
@@ -48,9 +48,13 @@ public class SimpleClientImpl extends RpcInstanceAbstract implements SimpleClien
super
(
rpcCommonConfig
);
this
.
remotingClient
=
remotingClient
;
this
.
rpcCommonConfig
=
rpcCommonConfig
;
this
.
callServiceThreadPool
=
ThreadUtils
.
newThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getServiceThreadKeepAliveTime
(),
TimeUnit
.
MILLISECONDS
,
new
ArrayBlockingQueue
<
Runnable
>(
rpcCommonConfig
.
getServiceThreadBlockQueueSize
()),
"clientCallServiceThread"
,
true
);
this
.
callServiceThreadPool
=
ThreadUtils
.
newThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getServiceThreadKeepAliveTime
(),
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(
rpcCommonConfig
.
getServiceThreadBlockQueueSize
()),
"clientCallServiceThread"
,
true
);
}
public
void
initialize
()
{
...
...
remoting-core/rpc-impl/src/main/java/org/apache/rocketmq/rpc/impl/server/SimpleServerImpl.java
浏览文件 @
489b1d8b
...
...
@@ -18,8 +18,8 @@
package
org.apache.rocketmq.rpc.impl.server
;
import
java.util.Properties
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.TimeUnit
;
import
org.apache.rocketmq.remoting.api.RemotingServer
;
import
org.apache.rocketmq.remoting.api.RemotingService
;
...
...
@@ -40,9 +40,12 @@ public class SimpleServerImpl extends RpcInstanceAbstract implements SimpleServe
public
SimpleServerImpl
(
final
RpcCommonConfig
remotingConfig
)
{
this
(
remotingConfig
,
RemotingBootstrapFactory
.
createRemotingServer
(
remotingConfig
));
this
.
rpcCommonConfig
=
remotingConfig
;
this
.
callServiceThreadPool
=
ThreadUtils
.
newThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getServiceThreadKeepAliveTime
(),
TimeUnit
.
MILLISECONDS
,
new
ArrayBlockingQueue
<
Runnable
>(
remotingConfig
.
getServiceThreadBlockQueueSize
()),
this
.
callServiceThreadPool
=
ThreadUtils
.
newThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getServiceThreadKeepAliveTime
(),
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(
remotingConfig
.
getServiceThreadBlockQueueSize
()),
"serverCallServiceThread"
,
true
);
}
...
...
remoting-core/rpc-impl/src/main/java/org/apache/rocketmq/rpc/impl/service/RpcInstanceAbstract.java
浏览文件 @
489b1d8b
...
...
@@ -17,8 +17,8 @@
package
org.apache.rocketmq.rpc.impl.service
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
import
org.apache.rocketmq.remoting.external.ThreadUtils
;
...
...
@@ -45,9 +45,13 @@ public abstract class RpcInstanceAbstract extends RpcProxyCommon {
this
.
rpcCommonConfig
=
rpcCommonConfig
;
this
.
rpcRequestProcessor
=
new
RpcRequestProcessor
(
this
.
threadLocalProviderContext
,
this
,
serviceStats
);
this
.
invokeServiceThreadPool
=
new
ThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
60
,
TimeUnit
.
SECONDS
,
new
ArrayBlockingQueue
<
Runnable
>(
rpcCommonConfig
.
getServiceThreadBlockQueueSize
()),
newThreadFactory
(
"rpcInvokeServiceThread"
,
true
));
this
.
invokeServiceThreadPool
=
new
ThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
60
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(
rpcCommonConfig
.
getServiceThreadBlockQueueSize
()),
newThreadFactory
(
"rpcInvokeServiceThread"
,
true
));
}
...
...
remoting-core/rpc-impl/src/main/java/org/apache/rocketmq/rpc/impl/service/RpcProxyCommon.java
浏览文件 @
489b1d8b
...
...
@@ -21,11 +21,11 @@ import java.lang.reflect.Method;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
import
java.nio.ByteBuffer
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.TimeUnit
;
import
org.apache.rocketmq.remoting.api.AsyncHandler
;
import
org.apache.rocketmq.remoting.api.RemotingService
;
...
...
@@ -68,12 +68,20 @@ public abstract class RpcProxyCommon {
public
RpcProxyCommon
(
RpcCommonConfig
rpcCommonConfig
)
{
this
.
rpcCommonConfig
=
rpcCommonConfig
;
this
.
serviceStats
=
new
ServiceStats
();
this
.
promiseExecutorService
=
ThreadUtils
.
newThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getServiceThreadKeepAliveTime
(),
TimeUnit
.
MILLISECONDS
,
new
ArrayBlockingQueue
<
Runnable
>(
rpcCommonConfig
.
getServiceThreadBlockQueueSize
()),
"promiseExecutorService"
,
true
);
this
.
callServiceThreadPool
=
ThreadUtils
.
newThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getServiceThreadKeepAliveTime
(),
TimeUnit
.
MILLISECONDS
,
new
ArrayBlockingQueue
<
Runnable
>(
rpcCommonConfig
.
getServiceThreadBlockQueueSize
()),
"callServiceThread"
,
true
);
this
.
promiseExecutorService
=
ThreadUtils
.
newThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getServiceThreadKeepAliveTime
(),
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(
rpcCommonConfig
.
getServiceThreadBlockQueueSize
()),
"promiseExecutorService"
,
true
);
this
.
callServiceThreadPool
=
ThreadUtils
.
newThreadPoolExecutor
(
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getClientAsyncCallbackExecutorThreads
(),
rpcCommonConfig
.
getServiceThreadKeepAliveTime
(),
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(
rpcCommonConfig
.
getServiceThreadBlockQueueSize
()),
"callServiceThread"
,
true
);
}
private
RemotingCommand
createRemoteRequest
(
RemoteService
serviceExport
,
Method
method
,
Object
[]
args
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录