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

[ISSUE #6525]Make ConsumeQueueInterface extends from FileQueueLifeCycle #6534

Merged
merged 7 commits into from
Apr 15, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.apache.rocketmq.store.config.BrokerRole;
import org.apache.rocketmq.store.logfile.MappedFile;

public class BatchConsumeQueue implements ConsumeQueueInterface, FileQueueLifeCycle {
public class BatchConsumeQueue implements ConsumeQueueInterface {
protected static final Logger log = LoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.rocketmq.store.DispatchRequest;
import org.apache.rocketmq.store.MessageFilter;

public interface ConsumeQueueInterface {
public interface ConsumeQueueInterface extends FileQueueLifeCycle {
/**
* Get the topic name
* @return the topic this cq belongs to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void setTopicConfigTable(ConcurrentMap<String, TopicConfig> topicConfigTa
}

private FileQueueLifeCycle getLifeCycle(String topic, int queueId) {
return (FileQueueLifeCycle) findOrCreateConsumeQueue(topic, queueId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another force convert in recoverConcurrently method of this class.

return findOrCreateConsumeQueue(topic, queueId);
}

public long rollNextFile(ConsumeQueueInterface consumeQueue, final long offset) {
Expand Down Expand Up @@ -220,7 +220,7 @@ public boolean recoverConcurrently() {
FutureTask<Boolean> futureTask = new FutureTask<>(() -> {
boolean ret = true;
try {
((FileQueueLifeCycle) logic).recover();
logic.recover();
} catch (Throwable e) {
ret = false;
log.error("Exception occurs while recover consume queue concurrently, " +
Expand Down