Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
_Walt
Rocketmq
提交
9165667a
R
Rocketmq
项目概览
_Walt
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9165667a
编写于
12月 27, 2016
作者:
Y
yukon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ROCKETMQ-18 Remove bad practices in broker.
上级
f56e0383
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
36 addition
and
42 deletion
+36
-42
broker/src/main/java/org/apache/rocketmq/broker/client/net/Broker2Client.java
.../org/apache/rocketmq/broker/client/net/Broker2Client.java
+2
-2
broker/src/main/java/org/apache/rocketmq/broker/filtersrv/FilterServerUtil.java
...rg/apache/rocketmq/broker/filtersrv/FilterServerUtil.java
+1
-2
broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java
...org/apache/rocketmq/broker/latency/BrokerFastFailure.java
+1
-1
broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java
.../apache/rocketmq/broker/offset/ConsumerOffsetManager.java
+4
-8
broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
...n/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
+5
-6
broker/src/main/java/org/apache/rocketmq/broker/plugin/MessageStoreFactory.java
...rg/apache/rocketmq/broker/plugin/MessageStoreFactory.java
+1
-2
broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
...cketmq/broker/processor/AbstractSendMessageProcessor.java
+6
-4
broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
...pache/rocketmq/broker/processor/AdminBrokerProcessor.java
+4
-6
broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java
...pache/rocketmq/broker/processor/PullMessageProcessor.java
+1
-1
broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java
...ache/rocketmq/broker/processor/QueryMessageProcessor.java
+2
-2
broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java
...pache/rocketmq/broker/processor/SendMessageProcessor.java
+1
-0
broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionStore.java
.../apache/rocketmq/broker/transaction/TransactionStore.java
+8
-8
未找到文件。
broker/src/main/java/org/apache/rocketmq/broker/client/net/Broker2Client.java
浏览文件 @
9165667a
...
...
@@ -202,7 +202,7 @@ public class Broker2Client {
try
{
this
.
brokerController
.
getRemotingServer
().
invokeOneway
(
entry
.
getKey
(),
request
,
5000
);
log
.
info
(
"[reset-offset] reset offset success. topic={}, group={}, clientId={}"
,
new
Object
[]{
topic
,
group
,
entry
.
getValue
().
getClientId
()}
);
topic
,
group
,
entry
.
getValue
().
getClientId
()
);
}
catch
(
Exception
e
)
{
log
.
error
(
"[reset-offset] reset offset exception. topic={}, group={}"
,
new
Object
[]{
topic
,
group
},
e
);
...
...
@@ -290,7 +290,7 @@ public class Broker2Client {
consumerStatusTable
.
put
(
clientId
,
body
.
getMessageQueueTable
());
log
.
info
(
"[get-consumer-status] get consumer status success. topic={}, group={}, channelRemoteAddr={}"
,
new
Object
[]{
topic
,
group
,
clientId
}
);
topic
,
group
,
clientId
);
}
}
default
:
...
...
broker/src/main/java/org/apache/rocketmq/broker/filtersrv/FilterServerUtil.java
浏览文件 @
9165667a
...
...
@@ -37,7 +37,6 @@ public class FilterServerUtil {
}
private
static
String
[]
splitShellString
(
final
String
shellString
)
{
String
[]
split
=
shellString
.
split
(
" "
);
return
split
;
return
shellString
.
split
(
" "
);
}
}
broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java
浏览文件 @
9165667a
...
...
@@ -77,7 +77,7 @@ public class BrokerFastFailure {
break
;
}
final
RequestTask
rt
=
castRunnable
(
runnable
);
if
(
rt
.
isStopRun
())
{
if
(
rt
==
null
||
rt
.
isStopRun
())
{
break
;
}
...
...
broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java
浏览文件 @
9165667a
...
...
@@ -58,7 +58,7 @@ public class ConsumerOffsetManager extends ConfigManager {
Entry
<
String
,
ConcurrentHashMap
<
Integer
,
Long
>>
next
=
it
.
next
();
String
topicAtGroup
=
next
.
getKey
();
String
[]
arrays
=
topicAtGroup
.
split
(
TOPIC_GROUP_SEPARATOR
);
if
(
arrays
!=
null
&&
arrays
.
length
==
2
)
{
if
(
arrays
.
length
==
2
)
{
String
topic
=
arrays
[
0
];
String
group
=
arrays
[
1
];
...
...
@@ -80,11 +80,7 @@ public class ConsumerOffsetManager extends ConfigManager {
Entry
<
Integer
,
Long
>
next
=
it
.
next
();
long
minOffsetInStore
=
this
.
brokerController
.
getMessageStore
().
getMinOffsetInQuque
(
topic
,
next
.
getKey
());
long
offsetInPersist
=
next
.
getValue
();
if
(
offsetInPersist
>
minOffsetInStore
)
{
result
=
false
;
}
else
{
result
=
true
;
}
result
=
offsetInPersist
<=
minOffsetInStore
;
}
return
result
;
...
...
@@ -99,7 +95,7 @@ public class ConsumerOffsetManager extends ConfigManager {
Entry
<
String
,
ConcurrentHashMap
<
Integer
,
Long
>>
next
=
it
.
next
();
String
topicAtGroup
=
next
.
getKey
();
String
[]
arrays
=
topicAtGroup
.
split
(
TOPIC_GROUP_SEPARATOR
);
if
(
arrays
!=
null
&&
arrays
.
length
==
2
)
{
if
(
arrays
.
length
==
2
)
{
if
(
group
.
equals
(
arrays
[
1
]))
{
topics
.
add
(
arrays
[
0
]);
}
...
...
@@ -118,7 +114,7 @@ public class ConsumerOffsetManager extends ConfigManager {
Entry
<
String
,
ConcurrentHashMap
<
Integer
,
Long
>>
next
=
it
.
next
();
String
topicAtGroup
=
next
.
getKey
();
String
[]
arrays
=
topicAtGroup
.
split
(
TOPIC_GROUP_SEPARATOR
);
if
(
arrays
!=
null
&&
arrays
.
length
==
2
)
{
if
(
arrays
.
length
==
2
)
{
if
(
topic
.
equals
(
arrays
[
0
]))
{
groups
.
add
(
arrays
[
1
]);
}
...
...
broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
浏览文件 @
9165667a
...
...
@@ -88,14 +88,12 @@ public class BrokerOuterAPI {
public
void
updateNameServerAddressList
(
final
String
addrs
)
{
List
<
String
>
lst
=
new
ArrayList
<
String
>();
String
[]
addrArray
=
addrs
.
split
(
";"
);
if
(
addrArray
!=
null
)
{
for
(
String
addr
:
addrArray
)
{
lst
.
add
(
addr
);
}
this
.
remotingClient
.
updateNameServerAddressList
(
lst
);
}
}
public
RegisterBrokerResult
registerBrokerAll
(
final
String
clusterName
,
...
...
@@ -159,6 +157,7 @@ public class BrokerOuterAPI {
try
{
this
.
remotingClient
.
invokeOneway
(
namesrvAddr
,
request
,
timeoutMills
);
}
catch
(
RemotingTooMuchRequestException
e
)
{
// Ignore
}
return
null
;
}
...
...
broker/src/main/java/org/apache/rocketmq/broker/plugin/MessageStoreFactory.java
浏览文件 @
9165667a
...
...
@@ -37,8 +37,7 @@ public final class MessageStoreFactory {
@SuppressWarnings
(
"unchecked"
)
Class
<
AbstractPluginMessageStore
>
clazz
=
(
Class
<
AbstractPluginMessageStore
>)
Class
.
forName
(
pluginClass
);
Constructor
<
AbstractPluginMessageStore
>
construct
=
clazz
.
getConstructor
(
MessageStorePluginContext
.
class
,
MessageStore
.
class
);
AbstractPluginMessageStore
pluginMessageStore
=
(
AbstractPluginMessageStore
)
construct
.
newInstance
(
context
,
messageStore
);
messageStore
=
pluginMessageStore
;
messageStore
=
construct
.
newInstance
(
context
,
messageStore
);
}
catch
(
Throwable
e
)
{
throw
new
RuntimeException
(
String
.
format
(
"Initialize plugin's class %s not found!"
,
pluginClass
),
e
);
...
...
broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
浏览文件 @
9165667a
...
...
@@ -176,8 +176,7 @@ public abstract class AbstractSendMessageProcessor implements NettyRequestProces
return
response
;
}
if
(!
this
.
brokerController
.
getTopicConfigManager
().
isTopicCanSendMessage
(
requestHeader
.
getTopic
()))
{
String
errorMsg
=
"the topic["
+
requestHeader
.
getTopic
()
+
"] is conflict with system reserved words."
;
String
errorMsg
=
"the topic["
+
requestHeader
.
getTopic
()
+
"] is conflict with system reserved words."
;
log
.
warn
(
errorMsg
);
response
.
setCode
(
ResponseCode
.
SYSTEM_ERROR
);
response
.
setRemark
(
errorMsg
);
...
...
@@ -273,8 +272,11 @@ public abstract class AbstractSendMessageProcessor implements NettyRequestProces
}
hook
.
sendMessageBefore
(
context
);
if
(
requestHeader
!=
null
)
{
requestHeader
.
setProperties
(
context
.
getMsgProps
());
}
}
catch
(
Throwable
e
)
{
// Ignore
}
}
}
...
...
@@ -319,7 +321,7 @@ public abstract class AbstractSendMessageProcessor implements NettyRequestProces
}
hook
.
sendMessageAfter
(
context
);
}
catch
(
Throwable
e
)
{
// Ignore
}
}
}
...
...
broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
浏览文件 @
9165667a
...
...
@@ -722,8 +722,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
final
ResetOffsetRequestHeader
requestHeader
=
(
ResetOffsetRequestHeader
)
request
.
decodeCommandCustomHeader
(
ResetOffsetRequestHeader
.
class
);
log
.
info
(
"[reset-offset] reset offset started by {}. topic={}, group={}, timestamp={}, isForce={}"
,
new
Object
[]{
RemotingHelper
.
parseChannelRemoteAddr
(
ctx
.
channel
()),
requestHeader
.
getTopic
(),
requestHeader
.
getGroup
(),
requestHeader
.
getTimestamp
(),
requestHeader
.
isForce
()}
);
RemotingHelper
.
parseChannelRemoteAddr
(
ctx
.
channel
()),
requestHeader
.
getTopic
(),
requestHeader
.
getGroup
(),
requestHeader
.
getTimestamp
(),
requestHeader
.
isForce
()
);
boolean
isC
=
false
;
LanguageCode
language
=
request
.
getLanguage
();
switch
(
language
)
{
...
...
@@ -740,7 +740,7 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
(
GetConsumerStatusRequestHeader
)
request
.
decodeCommandCustomHeader
(
GetConsumerStatusRequestHeader
.
class
);
log
.
info
(
"[get-consumer-status] get consumer status by {}. topic={}, group={}"
,
new
Object
[]{
RemotingHelper
.
parseChannelRemoteAddr
(
ctx
.
channel
()),
requestHeader
.
getTopic
(),
requestHeader
.
getGroup
()}
);
RemotingHelper
.
parseChannelRemoteAddr
(
ctx
.
channel
()),
requestHeader
.
getTopic
(),
requestHeader
.
getGroup
()
);
return
this
.
brokerController
.
getBroker2Client
().
getConsumeStatus
(
requestHeader
.
getTopic
(),
requestHeader
.
getGroup
(),
requestHeader
.
getClientAddr
());
...
...
@@ -1193,9 +1193,7 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
newRequest
.
setExtFields
(
request
.
getExtFields
());
newRequest
.
setBody
(
request
.
getBody
());
RemotingCommand
consumerResponse
=
this
.
brokerController
.
getBroker2Client
().
callClient
(
clientChannelInfo
.
getChannel
(),
newRequest
);
return
consumerResponse
;
return
this
.
brokerController
.
getBroker2Client
().
callClient
(
clientChannelInfo
.
getChannel
(),
newRequest
);
}
catch
(
RemotingTimeoutException
e
)
{
response
.
setCode
(
ResponseCode
.
CONSUME_MSG_TIMEOUT
);
response
...
...
broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java
浏览文件 @
9165667a
...
...
@@ -528,7 +528,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
}
}
}
catch
(
RemotingCommandException
e1
)
{
LOG
.
error
(
"excuteRequestWhenWakeup run"
,
e1
);
LOG
.
error
(
"ex
e
cuteRequestWhenWakeup run"
,
e1
);
}
}
};
...
...
broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java
浏览文件 @
9165667a
...
...
@@ -116,7 +116,7 @@ public class QueryMessageProcessor implements NettyRequestProcessor {
public
void
operationComplete
(
ChannelFuture
future
)
throws
Exception
{
queryMessageResult
.
release
();
if
(!
future
.
isSuccess
())
{
log
.
error
(
"transfer query message by pagecache failed, "
,
future
.
cause
());
log
.
error
(
"transfer query message by page
cache failed, "
,
future
.
cause
());
}
}
});
...
...
@@ -158,7 +158,7 @@ public class QueryMessageProcessor implements NettyRequestProcessor {
public
void
operationComplete
(
ChannelFuture
future
)
throws
Exception
{
selectMappedBufferResult
.
release
();
if
(!
future
.
isSuccess
())
{
log
.
error
(
"transfer one message by pagecache failed, "
,
future
.
cause
());
log
.
error
(
"transfer one message by page
cache failed, "
,
future
.
cause
());
}
}
});
...
...
broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java
浏览文件 @
9165667a
...
...
@@ -467,6 +467,7 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
try
{
hook
.
consumeMessageAfter
(
context
);
}
catch
(
Throwable
e
)
{
// Ignore
}
}
}
...
...
broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionStore.java
浏览文件 @
9165667a
...
...
@@ -21,26 +21,26 @@ import java.util.List;
public
interface
TransactionStore
{
public
boolean
open
();
boolean
open
();
public
void
close
();
void
close
();
public
boolean
put
(
final
List
<
TransactionRecord
>
trs
);
boolean
put
(
final
List
<
TransactionRecord
>
trs
);
public
void
remove
(
final
List
<
Long
>
pks
);
void
remove
(
final
List
<
Long
>
pks
);
public
List
<
TransactionRecord
>
traverse
(
final
long
pk
,
final
int
nums
);
List
<
TransactionRecord
>
traverse
(
final
long
pk
,
final
int
nums
);
public
long
totalRecords
();
long
totalRecords
();
public
long
minPK
();
long
minPK
();
public
long
maxPK
();
long
maxPK
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录