Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,7 @@ private synchronized RemotingCommand updateAndCreateStaticTopic(ChannelHandlerCo
return response;
}
}
boolean force = false;
if (requestHeader.getForce() != null && requestHeader.getForce()) {
force = true;
}
boolean force = requestHeader.getForce() != null && requestHeader.getForce();

TopicConfig topicConfig = new TopicConfig(topic);
topicConfig.setReadQueueNums(requestHeader.getReadQueueNums());
Expand Down Expand Up @@ -880,7 +877,7 @@ private RemotingCommand getAllTopicConfig(ChannelHandlerContext ctx, RemotingCom
topicConfigAndMappingSerializeWrapper.setTopicQueueMappingDetailMap(this.brokerController.getTopicQueueMappingManager().getTopicQueueMappingTable());

String content = topicConfigAndMappingSerializeWrapper.toJson();
if (content != null && content.length() > 0) {
if (content != null && !content.isEmpty()) {
try {
response.setBody(content.getBytes(MixAll.DEFAULT_CHARSET));
} catch (UnsupportedEncodingException e) {
Expand Down Expand Up @@ -945,13 +942,13 @@ private synchronized RemotingCommand updateColdDataFlowCtrGroupConfig(ChannelHan
Properties properties = MixAll.string2Properties(bodyStr);
if (properties != null) {
LOGGER.info("updateColdDataFlowCtrGroupConfig new config: {}, client: {}", properties, ctx.channel().remoteAddress());
properties.entrySet().stream().forEach(i -> {
properties.forEach((key, value) -> {
try {
String consumerGroup = String.valueOf(i.getKey());
Long threshold = Long.valueOf(String.valueOf(i.getValue()));
String consumerGroup = String.valueOf(key);
Long threshold = Long.valueOf(String.valueOf(value));
this.brokerController.getColdDataCgCtrService().addOrUpdateGroupConfig(consumerGroup, threshold);
} catch (Exception e) {
LOGGER.error("updateColdDataFlowCtrGroupConfig properties on entry error, key: {}, val: {}", i.getKey(), i.getValue(), e);
LOGGER.error("updateColdDataFlowCtrGroupConfig properties on entry error, key: {}, val: {}", key, value, e);
}
});
} else {
Expand Down Expand Up @@ -1111,7 +1108,7 @@ private RemotingCommand getBrokerConfig(ChannelHandlerContext ctx, RemotingComma
final GetBrokerConfigResponseHeader responseHeader = (GetBrokerConfigResponseHeader) response.readCustomHeader();

String content = this.brokerController.getConfiguration().getAllConfigsFormatString();
if (content != null && content.length() > 0) {
if (content != null && !content.isEmpty()) {
try {
response.setBody(content.getBytes(MixAll.DEFAULT_CHARSET));
} catch (UnsupportedEncodingException e) {
Expand Down Expand Up @@ -1596,7 +1593,7 @@ private RemotingCommand getAllSubscriptionGroup(ChannelHandlerContext ctx,
RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
String content = this.brokerController.getSubscriptionGroupManager().encode();
if (content != null && content.length() > 0) {
if (content != null && !content.isEmpty()) {
try {
response.setBody(content.getBytes(MixAll.DEFAULT_CHARSET));
} catch (UnsupportedEncodingException e) {
Expand Down Expand Up @@ -1886,7 +1883,7 @@ private RemotingCommand getAllConsumerOffset(ChannelHandlerContext ctx, Remoting
final RemotingCommand response = RemotingCommand.createResponseCommand(null);

String content = this.brokerController.getConsumerOffsetManager().encode();
if (content != null && content.length() > 0) {
if (content != null && !content.isEmpty()) {
try {
response.setBody(content.getBytes(MixAll.DEFAULT_CHARSET));
} catch (UnsupportedEncodingException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package org.apache.rocketmq.broker.slave;

import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;

import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -85,12 +83,7 @@ private void syncTopicConfig() {
ConcurrentMap<String, TopicConfig> newTopicConfigTable = topicWrapper.getTopicConfigTable();
//delete
ConcurrentMap<String, TopicConfig> topicConfigTable = this.brokerController.getTopicConfigManager().getTopicConfigTable();
for (Iterator<Map.Entry<String, TopicConfig>> it = topicConfigTable.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<String, TopicConfig> item = it.next();
if (!newTopicConfigTable.containsKey(item.getKey())) {
it.remove();
}
}
topicConfigTable.entrySet().removeIf(item -> !newTopicConfigTable.containsKey(item.getKey()));
//update
topicConfigTable.putAll(newTopicConfigTable);

Expand All @@ -104,12 +97,7 @@ private void syncTopicConfig() {
ConcurrentMap<String, TopicConfig> newTopicConfigTable = topicWrapper.getTopicConfigTable();
//delete
ConcurrentMap<String, TopicConfig> topicConfigTable = this.brokerController.getTopicConfigManager().getTopicConfigTable();
for (Iterator<Map.Entry<String, TopicConfig>> it = topicConfigTable.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<String, TopicConfig> item = it.next();
if (!newTopicConfigTable.containsKey(item.getKey())) {
it.remove();
}
}
topicConfigTable.entrySet().removeIf(item -> !newTopicConfigTable.containsKey(item.getKey()));
//update
topicConfigTable.putAll(newTopicConfigTable);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void getAllAclFiles(String path) {
return;
}
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
for (int i = 0; files != null && i < files.length; i++) {
String fileName = files[i].getAbsolutePath();
File f = new File(fileName);
if (fileName.equals(aclPath + File.separator + "tools.yml")) {
Expand Down