提交 c8ee3289 编写于 作者: Y yukon

ROCKETMQ-18 Remove bad practices in client.

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