Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove MappedFile spi #8039

Closed
wants to merge 9 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.broker.BrokerController;
import org.apache.rocketmq.broker.out.BrokerOuterAPI;
Expand Down Expand Up @@ -803,7 +803,10 @@ private void scanAvailableControllerAddresses() {

private void updateControllerAddr() {
if (brokerConfig.isFetchControllerAddrByDnsLookup()) {
this.controllerAddresses = brokerOuterAPI.dnsLookupAddressByDomain(this.brokerConfig.getControllerAddr());
List<String> addrs = brokerOuterAPI.dnsLookupAddressByDomain(this.brokerConfig.getControllerAddr());
if (CollectionUtils.isNotEmpty(addrs)) {
this.controllerAddresses = addrs;
}
} else {
final String controllerPaths = this.brokerConfig.getControllerAddr();
final String[] controllers = controllerPaths.split(";");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.rocketmq.common.stats;

import java.util.Collections;
import java.util.LinkedList;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
Expand Down
2 changes: 1 addition & 1 deletion distribution/bin/os.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ sysctl vm.max_map_count
sysctl vm.dirty_background_ratio
sysctl vm.dirty_ratio
sysctl vm.dirty_writeback_centisecs
sysctl vm.page-cluster
sysctl vm.page-clusterH
sysctl vm.swappiness

su - admin -c 'ulimit -n'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static void main(String[] args) throws MQClientException, InterruptedExce
DefaultMQProducer producer = new DefaultMQProducer(PRODUCER_GROUP);

// Uncomment the following line while debugging, namesrvAddr should be set to your local address
//producer.setNamesrvAddr(DEFAULT_NAMESRVADDR);
producer.setNamesrvAddr(DEFAULT_NAMESRVADDR);

producer.start();
for (int i = 0; i < 128; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,7 @@ private boolean mmapOperation() {

MappedFile mappedFile;
if (messageStore.isTransientStorePoolEnable()) {
try {
mappedFile = ServiceLoader.load(MappedFile.class).iterator().next();
mappedFile.init(req.getFilePath(), req.getFileSize(), messageStore.getTransientStorePool());
} catch (RuntimeException e) {
log.warn("Use default implementation.");
mappedFile = new DefaultMappedFile(req.getFilePath(), req.getFileSize(), messageStore.getTransientStorePool());
}
mappedFile = new DefaultMappedFile(req.getFilePath(), req.getFileSize(), messageStore.getTransientStorePool());
} else {
mappedFile = new DefaultMappedFile(req.getFilePath(), req.getFileSize());
}
Expand Down Expand Up @@ -318,4 +312,13 @@ public boolean equals(Object obj) {
return true;
}
}

public static void main(String[] args) {
try {
MappedFile mappedFile = ServiceLoader.load(MappedFile.class).iterator().next();
} catch (Exception e) {
throw new RuntimeException(e);
}
System.out.printf("aa");
}
}
Loading