提交 c8ee3289 编写于 作者: Y yukon

ROCKETMQ-18 Remove bad practices in client.

上级 9165667a
......@@ -335,6 +335,7 @@ public class DefaultMQPullConsumer extends ClientConfig implements MQPullConsume
MessageDecoder.decodeMessageId(uniqKey);
return this.viewMessage(uniqKey);
} catch (Exception e) {
// Ignore
}
return this.defaultMQPullConsumerImpl.queryMessageByUniqKey(topic, uniqKey);
}
......
......@@ -210,6 +210,7 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
MessageDecoder.decodeMessageId(msgId);
return this.viewMessage(msgId);
} catch (Exception e) {
// Ignore
}
return this.defaultMQPushConsumerImpl.queryMessageByUniqKey(topic, msgId);
}
......
......@@ -22,7 +22,7 @@ package org.apache.rocketmq.client.consumer;
* @author vintagewang@apache.org
*/
public interface PullCallback {
public void onSuccess(final PullResult pullResult);
void onSuccess(final PullResult pullResult);
public void onException(final Throwable e);
void onException(final Throwable e);
}
......@@ -20,5 +20,5 @@ import org.apache.rocketmq.common.message.MessageQueue;
public interface PullTaskCallback {
public void doPullTask(final MessageQueue mq, final PullTaskContext context);
void doPullTask(final MessageQueue mq, final PullTaskContext context);
}
......@@ -17,9 +17,6 @@
package org.apache.rocketmq.client.consumer.listener;
/**
* Created by alvin on 16-11-30.
*/
public enum ConsumeReturnType {
/**
* consume return success
......
......@@ -45,12 +45,12 @@ public class AllocateMessageQueueByMachineRoom implements AllocateMessageQueueSt
premqAll.add(mq);
}
}
// Todo cid
int mod = premqAll.size() / cidAll.size();
int rem = premqAll.size() % cidAll.size();
int startindex = mod * currentIndex;
int endindex = startindex + mod;
for (int i = startindex; i < endindex; i++) {
int startIndex = mod * currentIndex;
int endIndex = startIndex + mod;
for (int i = startIndex; i < endIndex; i++) {
result.add(mqAll.get(i));
}
if (rem > currentIndex) {
......
......@@ -125,7 +125,7 @@ public class RemoteBrokerOffsetStore implements OffsetStore {
return;
final HashSet<MessageQueue> unusedMQ = new HashSet<MessageQueue>();
if (mqs != null && !mqs.isEmpty()) {
if (!mqs.isEmpty()) {
for (Map.Entry<MessageQueue, AtomicLong> entry : this.offsetTable.entrySet()) {
MessageQueue mq = entry.getKey();
AtomicLong offset = entry.getValue();
......
......@@ -24,8 +24,8 @@ import org.apache.rocketmq.client.exception.MQClientException;
* @author manhong.yqd
*/
public interface CheckForbiddenHook {
public String hookName();
String hookName();
public void checkForbidden(final CheckForbiddenContext context) throws MQClientException;
void checkForbidden(final CheckForbiddenContext context) throws MQClientException;
}
......@@ -20,8 +20,8 @@ package org.apache.rocketmq.client.hook;
* @author manhong.yqd
*/
public interface FilterMessageHook {
public String hookName();
String hookName();
public void filterMessage(final FilterMessageContext context);
void filterMessage(final FilterMessageContext context);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册