diff --git a/.travis.yml b/.travis.yml
index 2bc2296681c75e9513c6873b56dd9cfdc01429c8..daa88a2caf42d6dc56fe629b688ecbad315aa184 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,10 +14,6 @@ matrix:
# On Linux, run with specific JDKs only.
- os: linux
env: CUSTOM_JDK="oraclejdk8"
- - os: linux
- env: CUSTOM_JDK="oraclejdk7"
- - os: linux
- env: CUSTOM_JDK="openjdk7"
before_install:
- echo 'MAVEN_OPTS="$MAVEN_OPTS -Xmx1024m -XX:MaxPermSize=512m -XX:+BytecodeVerificationLocal"' >> ~/.mavenrc
@@ -25,15 +21,6 @@ before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export JAVA_HOME=$(/usr/libexec/java_home); fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then jdk_switcher use "$CUSTOM_JDK"; fi
-#os:
-# - linux
-# - osx
-#jdk:
-# - oraclejdk8
-# - oraclejdk7
-# - openjdk7
-
-
script:
- travis_retry mvn -B clean apache-rat:check
- travis_retry mvn -B package jacoco:report coveralls:report
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java b/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
index c8624c4f55b284994138ddbea85eb024473d0c62..cd68552bd27bae4ff69632ffb0306006bcebc0df 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
@@ -135,11 +135,11 @@ public class BrokerController {
private BrokerFastFailure brokerFastFailure;
private Configuration configuration;
- public BrokerController(//
- final BrokerConfig brokerConfig, //
- final NettyServerConfig nettyServerConfig, //
- final NettyClientConfig nettyClientConfig, //
- final MessageStoreConfig messageStoreConfig //
+ public BrokerController(
+ final BrokerConfig brokerConfig,
+ final NettyServerConfig nettyServerConfig,
+ final NettyClientConfig nettyClientConfig,
+ final MessageStoreConfig messageStoreConfig
) {
this.brokerConfig = brokerConfig;
this.nettyServerConfig = nettyServerConfig;
@@ -255,7 +255,6 @@ public class BrokerController {
this.registerProcessor();
- // TODO remove in future
final long initialDelay = UtilAll.computNextMorningTimeMillis() - System.currentTimeMillis();
final long period = 1000 * 60 * 60 * 24;
this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/BrokerPathConfigHelper.java b/broker/src/main/java/org/apache/rocketmq/broker/BrokerPathConfigHelper.java
index 0a323ee80c84b4b88f3b8276f1275044330db15b..42c8da9f3fba7ab563a898b6191dc0b4246b9df2 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/BrokerPathConfigHelper.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/BrokerPathConfigHelper.java
@@ -19,7 +19,6 @@ package org.apache.rocketmq.broker;
import java.io.File;
-
public class BrokerPathConfigHelper {
private static String brokerConfigPath = System.getProperty("user.home") + File.separator + "store"
+ File.separator + "config" + File.separator + "broker.properties";
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java b/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java
index 85d2e3af514ba1c1a106882042bff7c408c018f1..e0a3b69923053cb2ef651fccf3ad92b73cc890f0 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java
@@ -190,10 +190,10 @@ public class BrokerStartup {
MixAll.printObjectProperties(log, nettyClientConfig);
MixAll.printObjectProperties(log, messageStoreConfig);
- final BrokerController controller = new BrokerController(//
- brokerConfig, //
- nettyServerConfig, //
- nettyClientConfig, //
+ final BrokerController controller = new BrokerController(
+ brokerConfig,
+ nettyServerConfig,
+ nettyClientConfig,
messageStoreConfig);
// remember all configs to prevent discard
controller.getConfiguration().registerConfig(properties);
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java b/broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java
index 4a262e52286eb401521c8e2e83c55d8df736d290..32632fc5149e3cb25a3e24042588e748009acdf4 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java
@@ -122,7 +122,8 @@ public class ConsumerManager {
return r1 || r2;
}
- public void unregisterConsumer(final String group, final ClientChannelInfo clientChannelInfo, boolean isNotifyConsumerIdsChangedEnable) {
+ public void unregisterConsumer(final String group, final ClientChannelInfo clientChannelInfo,
+ boolean isNotifyConsumerIdsChangedEnable) {
ConsumerGroupInfo consumerGroupInfo = this.consumerTable.get(group);
if (null != consumerGroupInfo) {
consumerGroupInfo.unregisterChannel(clientChannelInfo);
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java b/broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java
index ed5a87582946b355ebbeda9757b5f8410ff112fd..519745e09192f0547a45ee155a76be808503cbea 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java
@@ -52,9 +52,9 @@ public class RebalanceLockManager {
lockEntry = new LockEntry();
lockEntry.setClientId(clientId);
groupValue.put(mq, lockEntry);
- log.info("tryLock, message queue not locked, I got it. Group: {} NewClientId: {} {}", //
- group, //
- clientId, //
+ log.info("tryLock, message queue not locked, I got it. Group: {} NewClientId: {} {}",
+ group,
+ clientId,
mq);
}
@@ -69,19 +69,19 @@ public class RebalanceLockManager {
lockEntry.setClientId(clientId);
lockEntry.setLastUpdateTimestamp(System.currentTimeMillis());
log.warn(
- "tryLock, message queue lock expired, I got it. Group: {} OldClientId: {} NewClientId: {} {}", //
- group, //
- oldClientId, //
- clientId, //
+ "tryLock, message queue lock expired, I got it. Group: {} OldClientId: {} NewClientId: {} {}",
+ group,
+ oldClientId,
+ clientId,
mq);
return true;
}
log.warn(
- "tryLock, message queue locked by other client. Group: {} OtherClientId: {} NewClientId: {} {}", //
- group, //
- oldClientId, //
- clientId, //
+ "tryLock, message queue locked by other client. Group: {} OtherClientId: {} NewClientId: {} {}",
+ group,
+ oldClientId,
+ clientId,
mq);
return false;
} finally {
@@ -144,9 +144,9 @@ public class RebalanceLockManager {
lockEntry.setClientId(clientId);
groupValue.put(mq, lockEntry);
log.info(
- "tryLockBatch, message queue not locked, I got it. Group: {} NewClientId: {} {}", //
- group, //
- clientId, //
+ "tryLockBatch, message queue not locked, I got it. Group: {} NewClientId: {} {}",
+ group,
+ clientId,
mq);
}
@@ -162,20 +162,20 @@ public class RebalanceLockManager {
lockEntry.setClientId(clientId);
lockEntry.setLastUpdateTimestamp(System.currentTimeMillis());
log.warn(
- "tryLockBatch, message queue lock expired, I got it. Group: {} OldClientId: {} NewClientId: {} {}", //
- group, //
- oldClientId, //
- clientId, //
+ "tryLockBatch, message queue lock expired, I got it. Group: {} OldClientId: {} NewClientId: {} {}",
+ group,
+ oldClientId,
+ clientId,
mq);
lockedMqs.add(mq);
continue;
}
log.warn(
- "tryLockBatch, message queue locked by other client. Group: {} OtherClientId: {} NewClientId: {} {}", //
- group, //
- oldClientId, //
- clientId, //
+ "tryLockBatch, message queue locked by other client. Group: {} OtherClientId: {} NewClientId: {} {}",
+ group,
+ oldClientId,
+ clientId,
mq);
}
} finally {
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterData.java b/broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterData.java
index 4db02e26f8cf9720c5e015a95d97b447477d7c91..ee16a61ecea71062bfdfd5aec2b602804891fd62 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterData.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterData.java
@@ -54,9 +54,6 @@ public class ConsumerFilterData {
/**
* Check this filter data has been used to calculate bit map when msg was stored in server.
- *
- * @param msgStoreTime
- * @return
*/
public boolean isMsgInLive(long msgStoreTime) {
return msgStoreTime > getBornTime();
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java b/broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java
index f50db86308c8cdeed6a8dceacaf199c6535545c4..482893f7cee9e2186228b208dd940951f95ae870 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java
@@ -72,16 +72,11 @@ public class ConsumerFilterManager extends ConfigManager {
/**
* Build consumer filter data.Be care, bloom filter data is not included.
*
- * @param topic
- * @param consumerGroup
- * @param expression
- * @param type
- * @param clientVersion
* @return maybe null
*/
public static ConsumerFilterData build(final String topic, final String consumerGroup,
- final String expression, final String type,
- final long clientVersion) {
+ final String expression, final String type,
+ final long clientVersion) {
if (ExpressionType.isTagType(type)) {
return null;
}
@@ -140,7 +135,7 @@ public class ConsumerFilterManager extends ConfigManager {
}
public boolean register(final String topic, final String consumerGroup, final String expression,
- final String type, final long clientVersion) {
+ final String type, final long clientVersion) {
if (ExpressionType.isTagType(type)) {
return false;
}
@@ -357,7 +352,8 @@ public class ConsumerFilterManager extends ConfigManager {
data.setDeadTime(now);
}
- public boolean register(String consumerGroup, String expression, String type, BloomFilterData bloomFilterData, long clientVersion) {
+ public boolean register(String consumerGroup, String expression, String type, BloomFilterData bloomFilterData,
+ long clientVersion) {
ConsumerFilterData old = this.groupFilterData.get(consumerGroup);
if (old == null) {
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java b/broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java
index 95181789517c2565aa72a30eeea28d0cc7c4f680..7f7da05dd02bd6b60b8fd8e4ac6be9f6fe4e64a9 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java
@@ -17,7 +17,6 @@
package org.apache.rocketmq.broker.filter;
-
import org.apache.rocketmq.common.MixAll;
import org.apache.rocketmq.common.filter.ExpressionType;
import org.apache.rocketmq.common.message.MessageConst;
@@ -32,7 +31,8 @@ import java.util.Map;
* It will decode properties first in order to get real topic.
*/
public class ExpressionForRetryMessageFilter extends ExpressionMessageFilter {
- public ExpressionForRetryMessageFilter(SubscriptionData subscriptionData, ConsumerFilterData consumerFilterData, ConsumerFilterManager consumerFilterManager) {
+ public ExpressionForRetryMessageFilter(SubscriptionData subscriptionData, ConsumerFilterData consumerFilterData,
+ ConsumerFilterManager consumerFilterManager) {
super(subscriptionData, consumerFilterData, consumerFilterManager);
}
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java b/broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java
index 893df0d7c6b94d0892b6d358facfcbef887d28b7..2f94de20c34213d426a91f913ce6abb7fed6f690 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java
@@ -41,7 +41,7 @@ public class ExpressionMessageFilter implements MessageFilter {
protected final boolean bloomDataValid;
public ExpressionMessageFilter(SubscriptionData subscriptionData, ConsumerFilterData consumerFilterData,
- ConsumerFilterManager consumerFilterManager) {
+ ConsumerFilterManager consumerFilterManager) {
this.subscriptionData = subscriptionData;
this.consumerFilterData = consumerFilterData;
this.consumerFilterManager = consumerFilterManager;
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/filtersrv/FilterServerManager.java b/broker/src/main/java/org/apache/rocketmq/broker/filtersrv/FilterServerManager.java
index 52cb9199931a03fe251c459dd5f3ed92d9bf00b9..f8f9943e82669309a84155e5a41fe5c97d7b26ed 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/filtersrv/FilterServerManager.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/filtersrv/FilterServerManager.java
@@ -111,9 +111,6 @@ public class FilterServerManager {
}
}
- /**
-
- */
public void scanNotActiveChannel() {
Iterator> it = this.filterServerTable.entrySet().iterator();
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java b/broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java
index a2a1aa095f727593494aef799a20b165a69187db..2d4bedcb96e76ba1f723287d2c110f80470722ff 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java
@@ -103,6 +103,7 @@ public class BrokerFastFailure {
}
}
}
+
public void shutdown() {
this.scheduledExecutorService.shutdown();
}
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFixedThreadPoolExecutor.java b/broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFixedThreadPoolExecutor.java
index 238fe1c62f9e99eb740379e745371246f3e71048..8060fd00c79756fe648053e4266bd313360c967e 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFixedThreadPoolExecutor.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFixedThreadPoolExecutor.java
@@ -25,23 +25,28 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class BrokerFixedThreadPoolExecutor extends ThreadPoolExecutor {
- public BrokerFixedThreadPoolExecutor(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime, final TimeUnit unit,
+ public BrokerFixedThreadPoolExecutor(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime,
+ final TimeUnit unit,
final BlockingQueue workQueue) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
}
- public BrokerFixedThreadPoolExecutor(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime, final TimeUnit unit,
+ public BrokerFixedThreadPoolExecutor(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime,
+ final TimeUnit unit,
final BlockingQueue workQueue, final ThreadFactory threadFactory) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
}
- public BrokerFixedThreadPoolExecutor(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime, final TimeUnit unit,
+ public BrokerFixedThreadPoolExecutor(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime,
+ final TimeUnit unit,
final BlockingQueue workQueue, final RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
}
- public BrokerFixedThreadPoolExecutor(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime, final TimeUnit unit,
- final BlockingQueue workQueue, final ThreadFactory threadFactory, final RejectedExecutionHandler handler) {
+ public BrokerFixedThreadPoolExecutor(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime,
+ final TimeUnit unit,
+ final BlockingQueue workQueue, final ThreadFactory threadFactory,
+ final RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
}
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/longpolling/NotifyMessageArrivingListener.java b/broker/src/main/java/org/apache/rocketmq/broker/longpolling/NotifyMessageArrivingListener.java
index fd38c4fb7660d358cc7ffe87544f267e32a3aced..ff0901126f2771b58136208d6012722a9b20f037 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/longpolling/NotifyMessageArrivingListener.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/longpolling/NotifyMessageArrivingListener.java
@@ -30,7 +30,7 @@ public class NotifyMessageArrivingListener implements MessageArrivingListener {
@Override
public void arriving(String topic, int queueId, long logicOffset, long tagsCode,
- long msgStoreTime, byte[] filterBitMap, Map properties) {
+ long msgStoreTime, byte[] filterBitMap, Map properties) {
this.pullRequestHoldService.notifyMessageArriving(topic, queueId, logicOffset, tagsCode,
msgStoreTime, filterBitMap, properties);
}
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java b/broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java
index b1bd86f5a783c5552bae20001e13fec6df07beeb..d0668cb45b0852ad55f3cc3c317bb31442a1cd5a 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java
@@ -114,7 +114,7 @@ public class PullRequestHoldService extends ServiceThread {
}
public void notifyMessageArriving(final String topic, final int queueId, final long maxOffset, final Long tagsCode,
- long msgStoreTime, byte[] filterBitMap, Map properties) {
+ long msgStoreTime, byte[] filterBitMap, Map properties) {
String key = this.buildKey(topic, queueId);
ManyPullRequest mpr = this.pullRequestTable.get(key);
if (mpr != null) {
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java b/broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java
index 57565a6401edfe0d3ce58bd3e56ad56d6a3136bf..0257f94b73755e54d10f3e29d13383ebac5d3d3c 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java
@@ -118,7 +118,8 @@ public class ConsumerOffsetManager extends ConfigManager {
return groups;
}
- public void commitOffset(final String clientHost, final String group, final String topic, final int queueId, final long offset) {
+ public void commitOffset(final String clientHost, final String group, final String topic, final int queueId,
+ final long offset) {
// topic@group
String key = topic + TOPIC_GROUP_SEPARATOR + group;
this.commitOffset(clientHost, key, queueId, offset);
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java b/broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
index 6c2a987d29eea590f7d485499262592c44b69feb..cba70a0ee8a6a3f69d28dd2a98e91c6ca284f326 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
@@ -231,7 +231,8 @@ public class BrokerOuterAPI {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public TopicConfigSerializeWrapper getAllTopicConfig(final String addr) throws RemotingConnectException, RemotingSendRequestException,
+ public TopicConfigSerializeWrapper getAllTopicConfig(
+ final String addr) throws RemotingConnectException, RemotingSendRequestException,
RemotingTimeoutException, InterruptedException, MQBrokerException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, null);
@@ -248,7 +249,8 @@ public class BrokerOuterAPI {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public ConsumerOffsetSerializeWrapper getAllConsumerOffset(final String addr) throws InterruptedException, RemotingTimeoutException,
+ public ConsumerOffsetSerializeWrapper getAllConsumerOffset(
+ final String addr) throws InterruptedException, RemotingTimeoutException,
RemotingSendRequestException, RemotingConnectException, MQBrokerException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_CONSUMER_OFFSET, null);
RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
@@ -264,7 +266,8 @@ public class BrokerOuterAPI {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public String getAllDelayOffset(final String addr) throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException,
+ public String getAllDelayOffset(
+ final String addr) throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException,
RemotingConnectException, MQBrokerException, UnsupportedEncodingException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_DELAY_OFFSET, null);
RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
@@ -280,7 +283,8 @@ public class BrokerOuterAPI {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public SubscriptionGroupWrapper getAllSubscriptionGroupConfig(final String addr) throws InterruptedException, RemotingTimeoutException,
+ public SubscriptionGroupWrapper getAllSubscriptionGroupConfig(
+ final String addr) throws InterruptedException, RemotingTimeoutException,
RemotingSendRequestException, RemotingConnectException, MQBrokerException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_SUBSCRIPTIONGROUP_CONFIG, null);
RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransfer.java b/broker/src/main/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransfer.java
index 5b9df3e2ab77c83f04f494bfc13f3bc96f4a68cb..968bcfb564f9fe67e48d84371a47089a4572783a 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransfer.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransfer.java
@@ -28,7 +28,9 @@ public class ManyMessageTransfer extends AbstractReferenceCounted implements Fil
private final ByteBuffer byteBufferHeader;
private final GetMessageResult getMessageResult;
- /** Bytes which were transferred already. */
+ /**
+ * Bytes which were transferred already.
+ */
private long transferred;
public ManyMessageTransfer(ByteBuffer byteBufferHeader, GetMessageResult getMessageResult) {
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/pagecache/OneMessageTransfer.java b/broker/src/main/java/org/apache/rocketmq/broker/pagecache/OneMessageTransfer.java
index 254c2ab81aafe6085b02abc8f88b3afe08668db7..b795d2d253bd3ade2d7a102ecdbbe596321d8d15 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/pagecache/OneMessageTransfer.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/pagecache/OneMessageTransfer.java
@@ -27,7 +27,9 @@ public class OneMessageTransfer extends AbstractReferenceCounted implements File
private final ByteBuffer byteBufferHeader;
private final SelectMappedBufferResult selectMappedBufferResult;
- /** Bytes which were transferred already. */
+ /**
+ * Bytes which were transferred already.
+ */
private long transferred;
public OneMessageTransfer(ByteBuffer byteBufferHeader, SelectMappedBufferResult selectMappedBufferResult) {
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/pagecache/QueryMessageTransfer.java b/broker/src/main/java/org/apache/rocketmq/broker/pagecache/QueryMessageTransfer.java
index aaa1304d06f3936f5410c2650d24014b5812da08..e8f30996677a72cd2159baec3375ad42ad9a6c1a 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/pagecache/QueryMessageTransfer.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/pagecache/QueryMessageTransfer.java
@@ -28,7 +28,9 @@ public class QueryMessageTransfer extends AbstractReferenceCounted implements Fi
private final ByteBuffer byteBufferHeader;
private final QueryMessageResult queryMessageResult;
- /** Bytes which were transferred already. */
+ /**
+ * Bytes which were transferred already.
+ */
private long transferred;
public QueryMessageTransfer(ByteBuffer byteBufferHeader, QueryMessageResult queryMessageResult) {
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/plugin/AbstractPluginMessageStore.java b/broker/src/main/java/org/apache/rocketmq/broker/plugin/AbstractPluginMessageStore.java
index 690f70bfc88d4333252390c99976d186376075cb..f6f8a80afb6d48e178f6d27ead85bac5464e820a 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/plugin/AbstractPluginMessageStore.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/plugin/AbstractPluginMessageStore.java
@@ -87,7 +87,7 @@ public abstract class AbstractPluginMessageStore implements MessageStore {
@Override
public GetMessageResult getMessage(String group, String topic, int queueId, long offset,
- int maxMsgNums, final MessageFilter messageFilter) {
+ int maxMsgNums, final MessageFilter messageFilter) {
return next.getMessage(group, topic, queueId, offset, maxMsgNums, messageFilter);
}
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java b/broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
index 3faa7ae3b270fc5c5f2831ce93b9c7d209f3401d..410192f3b05b66c4f4f39a9186d2a81d6eeef998 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java
@@ -189,10 +189,10 @@ public abstract class AbstractSendMessageProcessor implements NettyRequestProces
}
log.warn("the topic {} not exist, producer: {}", requestHeader.getTopic(), ctx.channel().remoteAddress());
- topicConfig = this.brokerController.getTopicConfigManager().createTopicInSendMessageMethod(//
- requestHeader.getTopic(), //
- requestHeader.getDefaultTopic(), //
- RemotingHelper.parseChannelRemoteAddr(ctx.channel()), //
+ topicConfig = this.brokerController.getTopicConfigManager().createTopicInSendMessageMethod(
+ requestHeader.getTopic(),
+ requestHeader.getDefaultTopic(),
+ RemotingHelper.parseChannelRemoteAddr(ctx.channel()),
requestHeader.getDefaultTopicQueueNums(), topicSysFlag);
if (null == topicConfig) {
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java b/broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
index 71fdda931ff29fbec56b9f28ddbfbc84c3d07a52..abea4ec9e0dbbe351e0535384e68596853d28d1d 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
@@ -125,7 +125,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
}
@Override
- public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand processRequest(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
switch (request.getCode()) {
case RequestCode.UPDATE_AND_CREATE_TOPIC:
return this.updateAndCreateTopic(ctx, request);
@@ -211,7 +212,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return false;
}
- private RemotingCommand updateAndCreateTopic(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand updateAndCreateTopic(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
final CreateTopicRequestHeader requestHeader =
(CreateTopicRequestHeader) request.decodeCommandCustomHeader(CreateTopicRequestHeader.class);
@@ -248,7 +250,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return null;
}
- private RemotingCommand deleteTopic(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand deleteTopic(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
DeleteTopicRequestHeader requestHeader =
(DeleteTopicRequestHeader) request.decodeCommandCustomHeader(DeleteTopicRequestHeader.class);
@@ -354,7 +357,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand searchOffsetByTimestamp(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand searchOffsetByTimestamp(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(SearchOffsetResponseHeader.class);
final SearchOffsetResponseHeader responseHeader = (SearchOffsetResponseHeader) response.readCustomHeader();
final SearchOffsetRequestHeader requestHeader =
@@ -370,7 +374,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand getMaxOffset(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand getMaxOffset(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(GetMaxOffsetResponseHeader.class);
final GetMaxOffsetResponseHeader responseHeader = (GetMaxOffsetResponseHeader) response.readCustomHeader();
final GetMaxOffsetRequestHeader requestHeader =
@@ -385,7 +390,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand getMinOffset(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand getMinOffset(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(GetMinOffsetResponseHeader.class);
final GetMinOffsetResponseHeader responseHeader = (GetMinOffsetResponseHeader) response.readCustomHeader();
final GetMinOffsetRequestHeader requestHeader =
@@ -399,7 +405,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand getEarliestMsgStoretime(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand getEarliestMsgStoretime(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(GetEarliestMsgStoretimeResponseHeader.class);
final GetEarliestMsgStoretimeResponseHeader responseHeader = (GetEarliestMsgStoretimeResponseHeader) response.readCustomHeader();
final GetEarliestMsgStoretimeRequestHeader requestHeader =
@@ -428,13 +435,14 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand lockBatchMQ(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand lockBatchMQ(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
LockBatchRequestBody requestBody = LockBatchRequestBody.decode(request.getBody(), LockBatchRequestBody.class);
- Set lockOKMQSet = this.brokerController.getRebalanceLockManager().tryLockBatch(//
- requestBody.getConsumerGroup(), //
- requestBody.getMqSet(), //
+ Set lockOKMQSet = this.brokerController.getRebalanceLockManager().tryLockBatch(
+ requestBody.getConsumerGroup(),
+ requestBody.getMqSet(),
requestBody.getClientId());
LockBatchResponseBody responseBody = new LockBatchResponseBody();
@@ -446,13 +454,14 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand unlockBatchMQ(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand unlockBatchMQ(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
UnlockBatchRequestBody requestBody = UnlockBatchRequestBody.decode(request.getBody(), UnlockBatchRequestBody.class);
- this.brokerController.getRebalanceLockManager().unlockBatch(//
- requestBody.getConsumerGroup(), //
- requestBody.getMqSet(), //
+ this.brokerController.getRebalanceLockManager().unlockBatch(
+ requestBody.getConsumerGroup(),
+ requestBody.getMqSet(),
requestBody.getClientId());
response.setCode(ResponseCode.SUCCESS);
@@ -476,7 +485,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand getAllSubscriptionGroup(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ 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) {
@@ -502,7 +512,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand deleteSubscriptionGroup(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand deleteSubscriptionGroup(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
DeleteSubscriptionGroupRequestHeader requestHeader =
(DeleteSubscriptionGroupRequestHeader) request.decodeCommandCustomHeader(DeleteSubscriptionGroupRequestHeader.class);
@@ -516,7 +527,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand getTopicStatsInfo(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand getTopicStatsInfo(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
final GetTopicStatsInfoRequestHeader requestHeader =
(GetTopicStatsInfoRequestHeader) request.decodeCommandCustomHeader(GetTopicStatsInfoRequestHeader.class);
@@ -564,7 +576,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand getConsumerConnectionList(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand getConsumerConnectionList(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
final GetConsumerConnectionListRequestHeader requestHeader =
(GetConsumerConnectionListRequestHeader) request.decodeCommandCustomHeader(GetConsumerConnectionListRequestHeader.class);
@@ -603,7 +616,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand getProducerConnectionList(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand getProducerConnectionList(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
final GetProducerConnectionListRequestHeader requestHeader =
(GetProducerConnectionListRequestHeader) request.decodeCommandCustomHeader(GetProducerConnectionListRequestHeader.class);
@@ -636,7 +650,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand getConsumeStats(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand getConsumeStats(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
final GetConsumeStatsRequestHeader requestHeader =
(GetConsumeStatsRequestHeader) request.decodeCommandCustomHeader(GetConsumeStatsRequestHeader.class);
@@ -657,14 +672,11 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
continue;
}
- /**
-
- */
{
SubscriptionData findSubscriptionData =
this.brokerController.getConsumerManager().findSubscriptionData(requestHeader.getConsumerGroup(), topic);
- if (null == findSubscriptionData //
+ if (null == findSubscriptionData
&& this.brokerController.getConsumerManager().findSubscriptionDataCount(requestHeader.getConsumerGroup()) > 0) {
log.warn("consumeStats, the consumer group[{}], topic[{}] not exist", requestHeader.getConsumerGroup(), topic);
continue;
@@ -683,9 +695,9 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
if (brokerOffset < 0)
brokerOffset = 0;
- long consumerOffset = this.brokerController.getConsumerOffsetManager().queryOffset(//
- requestHeader.getConsumerGroup(), //
- topic, //
+ long consumerOffset = this.brokerController.getConsumerOffsetManager().queryOffset(
+ requestHeader.getConsumerGroup(),
+ topic,
i);
if (consumerOffset < 0)
consumerOffset = 0;
@@ -771,7 +783,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- public RemotingCommand resetOffset(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand resetOffset(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final ResetOffsetRequestHeader requestHeader =
(ResetOffsetRequestHeader) request.decodeCommandCustomHeader(ResetOffsetRequestHeader.class);
log.info("[reset-offset] reset offset started by {}. topic={}, group={}, timestamp={}, isForce={}",
@@ -788,7 +801,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
requestHeader.getTimestamp(), requestHeader.isForce(), isC);
}
- public RemotingCommand getConsumerStatus(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand getConsumerStatus(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final GetConsumerStatusRequestHeader requestHeader =
(GetConsumerStatusRequestHeader) request.decodeCommandCustomHeader(GetConsumerStatusRequestHeader.class);
@@ -799,7 +813,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
requestHeader.getClientAddr());
}
- private RemotingCommand queryTopicConsumeByWho(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand queryTopicConsumeByWho(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
QueryTopicConsumeByWhoRequestHeader requestHeader =
(QueryTopicConsumeByWhoRequestHeader) request.decodeCommandCustomHeader(QueryTopicConsumeByWhoRequestHeader.class);
@@ -821,7 +836,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand registerFilterServer(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand registerFilterServer(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(RegisterFilterServerResponseHeader.class);
final RegisterFilterServerResponseHeader responseHeader = (RegisterFilterServerResponseHeader) response.readCustomHeader();
final RegisterFilterServerRequestHeader requestHeader =
@@ -837,7 +853,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand queryConsumeTimeSpan(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand queryConsumeTimeSpan(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
QueryConsumeTimeSpanRequestHeader requestHeader =
(QueryConsumeTimeSpanRequestHeader) request.decodeCommandCustomHeader(QueryConsumeTimeSpanRequestHeader.class);
@@ -925,10 +942,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- /**
-
- */
- private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final GetConsumerRunningInfoRequestHeader requestHeader =
(GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);
@@ -936,7 +951,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
requestHeader.getClientId());
}
- private RemotingCommand queryCorrectionOffset(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand queryCorrectionOffset(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
QueryCorrectionOffsetHeader requestHeader =
(QueryCorrectionOffsetHeader) request.decodeCommandCustomHeader(QueryCorrectionOffsetHeader.class);
@@ -963,7 +979,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand consumeMessageDirectly(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand consumeMessageDirectly(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final ConsumeMessageDirectlyResultRequestHeader requestHeader = (ConsumeMessageDirectlyResultRequestHeader) request
.decodeCommandCustomHeader(ConsumeMessageDirectlyResultRequestHeader.class);
@@ -987,7 +1004,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
requestHeader.getClientId());
}
- private RemotingCommand cloneGroupOffset(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand cloneGroupOffset(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
CloneGroupOffsetRequestHeader requestHeader =
(CloneGroupOffsetRequestHeader) request.decodeCommandCustomHeader(CloneGroupOffsetRequestHeader.class);
@@ -1007,9 +1025,6 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
continue;
}
- /**
-
- */
if (!requestHeader.isOffline()) {
SubscriptionData findSubscriptionData =
@@ -1030,7 +1045,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand ViewBrokerStatsData(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand ViewBrokerStatsData(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final ViewBrokerStatsDataRequestHeader requestHeader =
(ViewBrokerStatsDataRequestHeader) request.decodeCommandCustomHeader(ViewBrokerStatsDataRequestHeader.class);
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
@@ -1107,13 +1123,11 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
if (isOrder && !topicConfig.isOrder()) {
continue;
}
- /**
- */
{
SubscriptionData findSubscriptionData = this.brokerController.getConsumerManager().findSubscriptionData(group, topic);
- if (null == findSubscriptionData //
+ if (null == findSubscriptionData
&& this.brokerController.getConsumerManager().findSubscriptionDataCount(group) > 0) {
log.warn("consumeStats, the consumer group[{}], topic[{}] not exist", group, topic);
continue;
@@ -1129,9 +1143,9 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
long brokerOffset = this.brokerController.getMessageStore().getMaxOffsetInQueue(topic, i);
if (brokerOffset < 0)
brokerOffset = 0;
- long consumerOffset = this.brokerController.getConsumerOffsetManager().queryOffset(//
- group, //
- topic, //
+ long consumerOffset = this.brokerController.getConsumerOffsetManager().queryOffset(
+ group,
+ topic,
i);
if (consumerOffset < 0)
consumerOffset = 0;
@@ -1215,10 +1229,10 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
return runtimeInfo;
}
- private RemotingCommand callConsumer(//
- final int requestCode, //
- final RemotingCommand request, //
- final String consumerGroup, //
+ private RemotingCommand callConsumer(
+ final int requestCode,
+ final RemotingCommand request,
+ final String consumerGroup,
final String clientId) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
ClientChannelInfo clientChannelInfo = this.brokerController.getConsumerManager().findChannel(consumerGroup, clientId);
@@ -1231,8 +1245,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
if (clientChannelInfo.getVersion() < MQVersion.Version.V3_1_8_SNAPSHOT.ordinal()) {
response.setCode(ResponseCode.SYSTEM_ERROR);
- response.setRemark(String.format("The Consumer <%s> Version <%s> too low to finish, please upgrade it to V3_1_8_SNAPSHOT", //
- clientId, //
+ response.setRemark(String.format("The Consumer <%s> Version <%s> too low to finish, please upgrade it to V3_1_8_SNAPSHOT",
+ clientId,
MQVersion.getVersionDesc(clientChannelInfo.getVersion())));
return response;
}
@@ -1256,7 +1270,8 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
}
}
- private RemotingCommand queryConsumeQueue(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand queryConsumeQueue(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
QueryConsumeQueueRequestHeader requestHeader =
(QueryConsumeQueueRequestHeader) request.decodeCommandCustomHeader(QueryConsumeQueueRequestHeader.class);
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java b/broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java
index 68e416768b23b341278517c85f86cfd96eb32c57..fee1420a9e713caef1e21b6d4bf744009ddf82aa 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java
@@ -46,7 +46,8 @@ public class EndTransactionProcessor implements NettyRequestProcessor {
}
@Override
- public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand processRequest(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
final EndTransactionRequestHeader requestHeader =
(EndTransactionRequestHeader) request.decodeCommandCustomHeader(EndTransactionRequestHeader.class);
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java b/broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java
index fb7ea2030a979726202a96a910162600d2b1ddca..a46cbff2ebebfb8ac89998248600011acd7646e9 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java
@@ -76,7 +76,8 @@ public class PullMessageProcessor implements NettyRequestProcessor {
}
@Override
- public RemotingCommand processRequest(final ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand processRequest(final ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
return this.processRequest(ctx.channel(), request, true);
}
@@ -138,7 +139,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
if (requestHeader.getQueueId() < 0 || requestHeader.getQueueId() >= topicConfig.getReadQueueNums()) {
String errorInfo = String.format("queueId[%d] is illegal, topic:[%s] topicConfig.readQueueNums:[%d] consumer:[%s]",
- requestHeader.getQueueId(), requestHeader.getTopic(), topicConfig.getReadQueueNums(), channel.remoteAddress());
+ requestHeader.getQueueId(), requestHeader.getTopic(), topicConfig.getReadQueueNums(), channel.remoteAddress());
log.warn(errorInfo);
response.setCode(ResponseCode.SYSTEM_ERROR);
response.setRemark(errorInfo);
@@ -160,7 +161,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
assert consumerFilterData != null;
}
} catch (Exception e) {
- log.warn("Parse the consumer's subscription[{}] failed, group: {}", requestHeader.getSubscription(), //
+ log.warn("Parse the consumer's subscription[{}] failed, group: {}", requestHeader.getSubscription(),
requestHeader.getConsumerGroup());
response.setCode(ResponseCode.SUBSCRIPTION_PARSE_FAILED);
response.setRemark("parse the consumer's subscription failed");
@@ -176,7 +177,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
return response;
}
- if (!subscriptionGroupConfig.isConsumeBroadcastEnable() //
+ if (!subscriptionGroupConfig.isConsumeBroadcastEnable()
&& consumerGroupInfo.getMessageModel() == MessageModel.BROADCASTING) {
response.setCode(ResponseCode.NO_PERMISSION);
response.setRemark("the consumer group[" + requestHeader.getConsumerGroup() + "] can not consume by broadcast way");
@@ -285,12 +286,12 @@ public class PullMessageProcessor implements NettyRequestProcessor {
response.setCode(ResponseCode.PULL_OFFSET_MOVED);
// XXX: warn and notify me
- log.info("the broker store no queue data, fix the request offset {} to {}, Topic: {} QueueId: {} Consumer Group: {}", //
- requestHeader.getQueueOffset(), //
- getMessageResult.getNextBeginOffset(), //
- requestHeader.getTopic(), //
- requestHeader.getQueueId(), //
- requestHeader.getConsumerGroup()//
+ log.info("the broker store no queue data, fix the request offset {} to {}, Topic: {} QueueId: {} Consumer Group: {}",
+ requestHeader.getQueueOffset(),
+ getMessageResult.getNextBeginOffset(),
+ requestHeader.getTopic(),
+ requestHeader.getQueueId(),
+ requestHeader.getConsumerGroup()
);
} else {
response.setCode(ResponseCode.PULL_NOT_FOUND);
@@ -314,8 +315,8 @@ public class PullMessageProcessor implements NettyRequestProcessor {
case OFFSET_TOO_SMALL:
response.setCode(ResponseCode.PULL_OFFSET_MOVED);
log.info("the request offset too small. group={}, topic={}, requestOffset={}, brokerMinOffset={}, clientIp={}",
- requestHeader.getConsumerGroup(), requestHeader.getTopic(), requestHeader.getQueueOffset(),
- getMessageResult.getMinOffset(), channel.remoteAddress());
+ requestHeader.getConsumerGroup(), requestHeader.getTopic(), requestHeader.getQueueOffset(),
+ getMessageResult.getMinOffset(), channel.remoteAddress());
break;
default:
assert false;
@@ -437,15 +438,15 @@ public class PullMessageProcessor implements NettyRequestProcessor {
event.setOffsetNew(getMessageResult.getNextBeginOffset());
this.generateOffsetMovedEvent(event);
log.warn(
- "PULL_OFFSET_MOVED:correction offset. topic={}, groupId={}, requestOffset={}, newOffset={}, suggestBrokerId={}",
- requestHeader.getTopic(), requestHeader.getConsumerGroup(), event.getOffsetRequest(), event.getOffsetNew(),
- responseHeader.getSuggestWhichBrokerId());
+ "PULL_OFFSET_MOVED:correction offset. topic={}, groupId={}, requestOffset={}, newOffset={}, suggestBrokerId={}",
+ requestHeader.getTopic(), requestHeader.getConsumerGroup(), event.getOffsetRequest(), event.getOffsetNew(),
+ responseHeader.getSuggestWhichBrokerId());
} else {
responseHeader.setSuggestWhichBrokerId(subscriptionGroupConfig.getBrokerId());
response.setCode(ResponseCode.PULL_RETRY_IMMEDIATELY);
log.warn("PULL_OFFSET_MOVED:none correction. topic={}, groupId={}, requestOffset={}, suggestBrokerId={}",
- requestHeader.getTopic(), requestHeader.getConsumerGroup(), requestHeader.getQueueOffset(),
- responseHeader.getSuggestWhichBrokerId());
+ requestHeader.getTopic(), requestHeader.getConsumerGroup(), requestHeader.getQueueOffset(),
+ responseHeader.getSuggestWhichBrokerId());
}
break;
@@ -483,7 +484,8 @@ public class PullMessageProcessor implements NettyRequestProcessor {
}
}
- private byte[] readGetMessageResult(final GetMessageResult getMessageResult, final String group, final String topic, final int queueId) {
+ private byte[] readGetMessageResult(final GetMessageResult getMessageResult, final String group, final String topic,
+ final int queueId) {
final ByteBuffer byteBuffer = ByteBuffer.allocate(getMessageResult.getBufferTotalSize());
long storeTimestamp = 0;
@@ -528,7 +530,8 @@ public class PullMessageProcessor implements NettyRequestProcessor {
}
}
- public void executeRequestWhenWakeup(final Channel channel, final RemotingCommand request) throws RemotingCommandException {
+ public void executeRequestWhenWakeup(final Channel channel,
+ final RemotingCommand request) throws RemotingCommandException {
Runnable run = new Runnable() {
@Override
public void run() {
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java b/broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java
index 5c716cc865bb098579f73038d43c275f5f132dfe..227a23e6b495a1506ab3c22695c0960da26028dc 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java
@@ -60,7 +60,8 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
}
@Override
- public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand processRequest(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
SendMessageContext mqtraceContext;
switch (request.getCode()) {
case RequestCode.CONSUMER_SEND_MSG_BACK:
@@ -139,9 +140,9 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
topicSysFlag = TopicSysFlag.buildSysFlag(false, true);
}
- TopicConfig topicConfig = this.brokerController.getTopicConfigManager().createTopicInSendMessageBackMethod(//
- newTopic, //
- subscriptionGroupConfig.getRetryQueueNums(), //
+ TopicConfig topicConfig = this.brokerController.getTopicConfigManager().createTopicInSendMessageBackMethod(
+ newTopic,
+ subscriptionGroupConfig.getRetryQueueNums(),
PermName.PERM_WRITE | PermName.PERM_READ, topicSysFlag);
if (null == topicConfig) {
response.setCode(ResponseCode.SYSTEM_ERROR);
@@ -175,13 +176,13 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
maxReconsumeTimes = requestHeader.getMaxReconsumeTimes();
}
- if (msgExt.getReconsumeTimes() >= maxReconsumeTimes//
+ if (msgExt.getReconsumeTimes() >= maxReconsumeTimes
|| delayLevel < 0) {
newTopic = MixAll.getDLQTopic(requestHeader.getGroup());
queueIdInt = Math.abs(this.random.nextInt() % 99999999) % DLQ_NUMS_PER_GROUP;
- topicConfig = this.brokerController.getTopicConfigManager().createTopicInSendMessageBackMethod(newTopic, //
- DLQ_NUMS_PER_GROUP, //
+ topicConfig = this.brokerController.getTopicConfigManager().createTopicInSendMessageBackMethod(newTopic,
+ DLQ_NUMS_PER_GROUP,
PermName.PERM_WRITE, 0
);
if (null == topicConfig) {
@@ -245,8 +246,8 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
return response;
}
-
- private boolean handleRetryAndDLQ(SendMessageRequestHeader requestHeader, RemotingCommand response, RemotingCommand request,
+ private boolean handleRetryAndDLQ(SendMessageRequestHeader requestHeader, RemotingCommand response,
+ RemotingCommand request,
MessageExt msg, TopicConfig topicConfig) {
String newTopic = requestHeader.getTopic();
if (null != newTopic && newTopic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)) {
@@ -268,8 +269,8 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
if (reconsumeTimes >= maxReconsumeTimes) {
newTopic = MixAll.getDLQTopic(groupName);
int queueIdInt = Math.abs(this.random.nextInt() % 99999999) % DLQ_NUMS_PER_GROUP;
- topicConfig = this.brokerController.getTopicConfigManager().createTopicInSendMessageBackMethod(newTopic, //
- DLQ_NUMS_PER_GROUP, //
+ topicConfig = this.brokerController.getTopicConfigManager().createTopicInSendMessageBackMethod(newTopic,
+ DLQ_NUMS_PER_GROUP,
PermName.PERM_WRITE, 0
);
msg.setTopic(newTopic);
@@ -289,9 +290,9 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
return true;
}
- private RemotingCommand sendMessage(final ChannelHandlerContext ctx, //
- final RemotingCommand request, //
- final SendMessageContext sendMessageContext, //
+ private RemotingCommand sendMessage(final ChannelHandlerContext ctx,
+ final RemotingCommand request,
+ final SendMessageContext sendMessageContext,
final SendMessageRequestHeader requestHeader) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(SendMessageResponseHeader.class);
@@ -319,8 +320,6 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
final byte[] body = request.getBody();
-
-
int queueIdInt = requestHeader.getQueueId();
TopicConfig topicConfig = this.brokerController.getTopicConfigManager().selectTopicConfig(requestHeader.getTopic());
@@ -361,13 +360,14 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
}
-
- private RemotingCommand handlePutMessageResult(PutMessageResult putMessageResult, RemotingCommand response, RemotingCommand request, MessageExt msg,
- SendMessageResponseHeader responseHeader, SendMessageContext sendMessageContext, ChannelHandlerContext ctx, int queueIdInt) {
+ private RemotingCommand handlePutMessageResult(PutMessageResult putMessageResult, RemotingCommand response,
+ RemotingCommand request, MessageExt msg,
+ SendMessageResponseHeader responseHeader, SendMessageContext sendMessageContext, ChannelHandlerContext ctx,
+ int queueIdInt) {
if (putMessageResult == null) {
response.setCode(ResponseCode.SYSTEM_ERROR);
response.setRemark("store putMessage return null");
- return response;
+ return response;
}
boolean sendOK = false;
@@ -462,17 +462,17 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
sendMessageContext.setCommercialOwner(owner);
}
}
- return response;
+ return response;
}
- private RemotingCommand sendBatchMessage(final ChannelHandlerContext ctx, //
- final RemotingCommand request, //
- final SendMessageContext sendMessageContext, //
- final SendMessageRequestHeader requestHeader) throws RemotingCommandException {
+
+ private RemotingCommand sendBatchMessage(final ChannelHandlerContext ctx,
+ final RemotingCommand request,
+ final SendMessageContext sendMessageContext,
+ final SendMessageRequestHeader requestHeader) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(SendMessageResponseHeader.class);
final SendMessageResponseHeader responseHeader = (SendMessageResponseHeader) response.readCustomHeader();
-
response.setOpaque(request.getOpaque());
response.addExtField(MessageConst.PROPERTY_MSG_REGION, this.brokerController.getBrokerConfig().getRegionId());
@@ -493,7 +493,6 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
return response;
}
-
int queueIdInt = requestHeader.getQueueId();
TopicConfig topicConfig = this.brokerController.getTopicConfigManager().selectTopicConfig(requestHeader.getTopic());
@@ -509,7 +508,7 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
if (requestHeader.getTopic() != null && requestHeader.getTopic().startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)) {
response.setCode(ResponseCode.MESSAGE_ILLEGAL);
- response.setRemark("batch request does not support retry group " + requestHeader.getTopic());
+ response.setRemark("batch request does not support retry group " + requestHeader.getTopic());
return response;
}
MessageExtBatch messageExtBatch = new MessageExtBatch();
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java b/broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java
index bd4a26ed7dd65ff7252d09987f7cc3b3c4b1c76a..0cbb76172ca4fb39f9d964df0b852c028740c022 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java
@@ -143,7 +143,7 @@ public class SubscriptionGroupManager extends ConfigManager {
@Override
public String configFilePath() {
return BrokerPathConfigHelper.getSubscriptionGroupPath(this.brokerController.getMessageStoreConfig()
- .getStorePathRootDir());
+ .getStorePathRootDir());
}
@Override
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java b/broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java
index 0d10a16239e5e8e5ca79ad266619701537f14652..cd30a089b7a7feafa9964838aea2cea77f22bd99 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java
@@ -272,7 +272,7 @@ public class TopicConfigManager extends ConfigManager {
}
log.info("update topic sys flag. oldTopicSysFlag={}, newTopicSysFlag", oldTopicSysFlag,
- topicConfig.getTopicSysFlag());
+ topicConfig.getTopicSysFlag());
this.topicConfigTable.put(topic, topicConfig);
@@ -292,7 +292,7 @@ public class TopicConfigManager extends ConfigManager {
}
log.info("update topic sys flag. oldTopicSysFlag={}, newTopicSysFlag", oldTopicSysFlag,
- topicConfig.getTopicSysFlag());
+ topicConfig.getTopicSysFlag());
this.topicConfigTable.put(topic, topicConfig);
@@ -384,7 +384,7 @@ public class TopicConfigManager extends ConfigManager {
@Override
public String configFilePath() {
return BrokerPathConfigHelper.getTopicConfigPath(this.brokerController.getMessageStoreConfig()
- .getStorePathRootDir());
+ .getStorePathRootDir());
}
@Override
diff --git a/broker/src/test/java/org/apache/rocketmq/broker/BrokerControllerTest.java b/broker/src/test/java/org/apache/rocketmq/broker/BrokerControllerTest.java
index 86b9c4ed02091d996a2b63d664cdbb915e67ab56..797e0d882a2600d436a38a2f6c5ba9c40e3fc31b 100644
--- a/broker/src/test/java/org/apache/rocketmq/broker/BrokerControllerTest.java
+++ b/broker/src/test/java/org/apache/rocketmq/broker/BrokerControllerTest.java
@@ -18,11 +18,15 @@
package org.apache.rocketmq.broker;
import org.apache.rocketmq.common.BrokerConfig;
+import org.apache.rocketmq.common.UtilAll;
import org.apache.rocketmq.remoting.netty.NettyClientConfig;
import org.apache.rocketmq.remoting.netty.NettyServerConfig;
import org.apache.rocketmq.store.config.MessageStoreConfig;
+import org.junit.After;
import org.junit.Test;
+import java.io.File;
+
import static org.assertj.core.api.Assertions.assertThat;
public class BrokerControllerTest {
@@ -33,15 +37,18 @@ public class BrokerControllerTest {
*/
@Test
public void testBrokerRestart() throws Exception {
- for (int i = 0; i < 2; i++) {
- BrokerController brokerController = new BrokerController(//
- new BrokerConfig(), //
- new NettyServerConfig(), //
- new NettyClientConfig(), //
- new MessageStoreConfig());
- assertThat(brokerController.initialize());
- brokerController.start();
- brokerController.shutdown();
- }
+ BrokerController brokerController = new BrokerController(
+ new BrokerConfig(),
+ new NettyServerConfig(),
+ new NettyClientConfig(),
+ new MessageStoreConfig());
+ assertThat(brokerController.initialize());
+ brokerController.start();
+ brokerController.shutdown();
+ }
+
+ @After
+ public void destory() {
+ UtilAll.deleteFile(new File(new MessageStoreConfig().getStorePathRootDir()));
}
}
diff --git a/broker/src/test/java/org/apache/rocketmq/broker/filter/CommitLogDispatcherCalcBitMapTest.java b/broker/src/test/java/org/apache/rocketmq/broker/filter/CommitLogDispatcherCalcBitMapTest.java
index 87f625616cf52987e93931e6ff82f8cec67ee4ea..8f28832c0c76b99214c851333afe76bcbfac4691 100644
--- a/broker/src/test/java/org/apache/rocketmq/broker/filter/CommitLogDispatcherCalcBitMapTest.java
+++ b/broker/src/test/java/org/apache/rocketmq/broker/filter/CommitLogDispatcherCalcBitMapTest.java
@@ -51,7 +51,6 @@ public class CommitLogDispatcherCalcBitMapTest {
ConsumerFilterData nullBloomData = filterManager.get("topic0", "CID_1");
nullBloomData.setBloomFilterData(null);
-
CommitLogDispatcherCalcBitMap calcBitMap = new CommitLogDispatcherCalcBitMap(brokerConfig,
filterManager);
diff --git a/broker/src/test/java/org/apache/rocketmq/broker/filter/ConsumerFilterManagerTest.java b/broker/src/test/java/org/apache/rocketmq/broker/filter/ConsumerFilterManagerTest.java
index c8412a8bff8911f9a0ff6b4940dbebfdb248e65b..68d60092d8be7a3f16e8c9f175f0f40a132205c3 100644
--- a/broker/src/test/java/org/apache/rocketmq/broker/filter/ConsumerFilterManagerTest.java
+++ b/broker/src/test/java/org/apache/rocketmq/broker/filter/ConsumerFilterManagerTest.java
@@ -17,6 +17,7 @@
package org.apache.rocketmq.broker.filter;
+import org.apache.rocketmq.common.UtilAll;
import org.apache.rocketmq.common.filter.ExpressionType;
import org.apache.rocketmq.common.filter.FilterAPI;
import org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData;
@@ -232,7 +233,7 @@ public class ConsumerFilterManagerTest {
assertThat(filterData.isDead()).isTrue();
assertThat(filterData.getCompiledExpression()).isNotNull();
} finally {
- deleteDirectory("./unit_test");
+ UtilAll.deleteFile(new File("./unit_test"));
}
}
@@ -269,23 +270,8 @@ public class ConsumerFilterManagerTest {
assertThat(topicData).isNullOrEmpty();
} finally {
- deleteDirectory("./unit_test");
+ UtilAll.deleteFile(new File("./unit_test"));
}
}
- protected void deleteDirectory(String rootPath) {
- File file = new File(rootPath);
- deleteFile(file);
- }
-
- protected void deleteFile(File file) {
- File[] subFiles = file.listFiles();
- if (subFiles != null) {
- for (File sub : subFiles) {
- deleteFile(sub);
- }
- }
-
- file.delete();
- }
}
diff --git a/broker/src/test/java/org/apache/rocketmq/broker/filter/MessageStoreWithFilterTest.java b/broker/src/test/java/org/apache/rocketmq/broker/filter/MessageStoreWithFilterTest.java
index 53e563edc2fcc40a2160be1d8b1d7739ca91dab5..7978942e5bbdd5f9cbd32176153d0819da221518 100644
--- a/broker/src/test/java/org/apache/rocketmq/broker/filter/MessageStoreWithFilterTest.java
+++ b/broker/src/test/java/org/apache/rocketmq/broker/filter/MessageStoreWithFilterTest.java
@@ -18,6 +18,7 @@
package org.apache.rocketmq.broker.filter;
import org.apache.rocketmq.common.BrokerConfig;
+import org.apache.rocketmq.common.UtilAll;
import org.apache.rocketmq.common.filter.ExpressionType;
import org.apache.rocketmq.common.message.MessageDecoder;
import org.apache.rocketmq.common.message.MessageExt;
@@ -32,6 +33,8 @@ import org.apache.rocketmq.store.MessageExtBrokerInner;
import org.apache.rocketmq.store.PutMessageResult;
import org.apache.rocketmq.store.config.MessageStoreConfig;
import org.apache.rocketmq.store.stats.BrokerStatsManager;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import java.io.File;
@@ -62,6 +65,14 @@ public class MessageStoreWithFilterTest {
private static SocketAddress StoreHost;
+ private DefaultMessageStore master;
+
+ private ConsumerFilterManager filterManager;
+
+ private int topicCount = 3;
+
+ private int msgPerTopic = 30;
+
static {
try {
StoreHost = new InetSocketAddress(InetAddress.getLocalHost(), 8123);
@@ -75,6 +86,24 @@ public class MessageStoreWithFilterTest {
}
}
+ @Before
+ public void init() {
+ filterManager = ConsumerFilterManagerTest.gen(topicCount, msgPerTopic);
+ try {
+ master = gen(filterManager);
+ } catch (Exception e) {
+ e.printStackTrace();
+ assertThat(true).isFalse();
+ }
+ }
+
+ @After
+ public void destroy() {
+ master.shutdown();
+ master.destroy();
+ UtilAll.deleteFile(new File(storePath));
+ }
+
public MessageExtBrokerInner buildMessage() {
MessageExtBrokerInner msg = new MessageExtBrokerInner();
msg.setTopic(topic);
@@ -96,7 +125,7 @@ public class MessageStoreWithFilterTest {
}
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
- boolean enableCqExt, int cqExtFileSize) {
+ boolean enableCqExt, int cqExtFileSize) {
MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
@@ -126,7 +155,7 @@ public class MessageStoreWithFilterTest {
new MessageArrivingListener() {
@Override
public void arriving(String topic, int queueId, long logicOffset, long tagsCode,
- long msgStoreTime, byte[] filterBitMap, Map properties) {
+ long msgStoreTime, byte[] filterBitMap, Map properties) {
// System.out.println(String.format("Msg coming: %s, %d, %d, %d",
// topic, queueId, logicOffset, tagsCode));
}
@@ -153,7 +182,8 @@ public class MessageStoreWithFilterTest {
return master;
}
- protected List putMsg(DefaultMessageStore master, int topicCount, int msgCountPerTopic) throws Exception {
+ protected List putMsg(DefaultMessageStore master, int topicCount,
+ int msgCountPerTopic) throws Exception {
List msgs = new ArrayList();
for (int i = 0; i < topicCount; i++) {
String realTopic = topic + i;
@@ -174,22 +204,6 @@ public class MessageStoreWithFilterTest {
return msgs;
}
- protected void deleteDirectory(String rootPath) {
- File file = new File(rootPath);
- deleteFile(file);
- }
-
- protected void deleteFile(File file) {
- File[] subFiles = file.listFiles();
- if (subFiles != null) {
- for (File sub : subFiles) {
- deleteFile(sub);
- }
- }
-
- file.delete();
- }
-
protected List filtered(List msgs, ConsumerFilterData filterData) {
List filteredMsgs = new ArrayList();
@@ -216,177 +230,143 @@ public class MessageStoreWithFilterTest {
@Test
public void testGetMessage_withFilterBitMapAndConsumerChanged() {
- int topicCount = 10, msgPerTopic = 10;
- ConsumerFilterManager filterManager = ConsumerFilterManagerTest.gen(topicCount, msgPerTopic);
-
- DefaultMessageStore master = null;
+ List msgs = null;
try {
- master = gen(filterManager);
+ msgs = putMsg(master, topicCount, msgPerTopic);
} catch (Exception e) {
e.printStackTrace();
assertThat(true).isFalse();
}
+ // sleep to wait for consume queue has been constructed.
try {
- List msgs = null;
- try {
- msgs = putMsg(master, topicCount, msgPerTopic);
- } catch (Exception e) {
- e.printStackTrace();
- assertThat(true).isFalse();
- }
-
- // sleep to wait for consume queue has been constructed.
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- assertThat(true).isFalse();
- }
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ assertThat(true).isFalse();
+ }
- // reset consumer;
- String topic = "topic" + 0;
- String resetGroup = "CID_" + 2;
- String normalGroup = "CID_" + 3;
+ // reset consumer;
+ String topic = "topic" + 0;
+ String resetGroup = "CID_" + 2;
+ String normalGroup = "CID_" + 3;
- {
- // reset CID_2@topic0 to get all messages.
- SubscriptionData resetSubData = new SubscriptionData();
- resetSubData.setExpressionType(ExpressionType.SQL92);
- resetSubData.setTopic(topic);
- resetSubData.setClassFilterMode(false);
- resetSubData.setSubString("a is not null OR a is null");
+ {
+ // reset CID_2@topic0 to get all messages.
+ SubscriptionData resetSubData = new SubscriptionData();
+ resetSubData.setExpressionType(ExpressionType.SQL92);
+ resetSubData.setTopic(topic);
+ resetSubData.setClassFilterMode(false);
+ resetSubData.setSubString("a is not null OR a is null");
- ConsumerFilterData resetFilterData = ConsumerFilterManager.build(topic,
- resetGroup, resetSubData.getSubString(), resetSubData.getExpressionType(),
- System.currentTimeMillis());
+ ConsumerFilterData resetFilterData = ConsumerFilterManager.build(topic,
+ resetGroup, resetSubData.getSubString(), resetSubData.getExpressionType(),
+ System.currentTimeMillis());
- GetMessageResult resetGetResult = master.getMessage(resetGroup, topic, queueId, 0, 1000,
- new ExpressionMessageFilter(resetSubData, resetFilterData, filterManager));
+ GetMessageResult resetGetResult = master.getMessage(resetGroup, topic, queueId, 0, 1000,
+ new ExpressionMessageFilter(resetSubData, resetFilterData, filterManager));
- try {
- assertThat(resetGetResult).isNotNull();
+ try {
+ assertThat(resetGetResult).isNotNull();
- List filteredMsgs = filtered(msgs, resetFilterData);
+ List filteredMsgs = filtered(msgs, resetFilterData);
- assertThat(resetGetResult.getMessageBufferList().size()).isEqualTo(filteredMsgs.size());
- } finally {
- resetGetResult.release();
- }
+ assertThat(resetGetResult.getMessageBufferList().size()).isEqualTo(filteredMsgs.size());
+ } finally {
+ resetGetResult.release();
}
+ }
- {
- ConsumerFilterData normalFilterData = filterManager.get(topic, normalGroup);
- assertThat(normalFilterData).isNotNull();
- assertThat(normalFilterData.getBornTime()).isLessThan(System.currentTimeMillis());
+ {
+ ConsumerFilterData normalFilterData = filterManager.get(topic, normalGroup);
+ assertThat(normalFilterData).isNotNull();
+ assertThat(normalFilterData.getBornTime()).isLessThan(System.currentTimeMillis());
- SubscriptionData normalSubData = new SubscriptionData();
- normalSubData.setExpressionType(normalFilterData.getExpressionType());
- normalSubData.setTopic(topic);
- normalSubData.setClassFilterMode(false);
- normalSubData.setSubString(normalFilterData.getExpression());
+ SubscriptionData normalSubData = new SubscriptionData();
+ normalSubData.setExpressionType(normalFilterData.getExpressionType());
+ normalSubData.setTopic(topic);
+ normalSubData.setClassFilterMode(false);
+ normalSubData.setSubString(normalFilterData.getExpression());
- List filteredMsgs = filtered(msgs, normalFilterData);
+ List filteredMsgs = filtered(msgs, normalFilterData);
- GetMessageResult normalGetResult = master.getMessage(normalGroup, topic, queueId, 0, 1000,
- new ExpressionMessageFilter(normalSubData, normalFilterData, filterManager));
+ GetMessageResult normalGetResult = master.getMessage(normalGroup, topic, queueId, 0, 1000,
+ new ExpressionMessageFilter(normalSubData, normalFilterData, filterManager));
- try {
- assertThat(normalGetResult).isNotNull();
- assertThat(normalGetResult.getMessageBufferList().size()).isEqualTo(filteredMsgs.size());
- } finally {
- normalGetResult.release();
- }
+ try {
+ assertThat(normalGetResult).isNotNull();
+ assertThat(normalGetResult.getMessageBufferList().size()).isEqualTo(filteredMsgs.size());
+ } finally {
+ normalGetResult.release();
}
- } finally {
- master.shutdown();
- master.destroy();
- deleteDirectory(storePath);
}
}
@Test
public void testGetMessage_withFilterBitMap() {
- int topicCount = 10, msgPerTopic = 500;
- ConsumerFilterManager filterManager = ConsumerFilterManagerTest.gen(topicCount, msgPerTopic);
-
- DefaultMessageStore master = null;
+ List msgs = null;
try {
- master = gen(filterManager);
+ msgs = putMsg(master, topicCount, msgPerTopic);
+ // sleep to wait for consume queue has been constructed.
+ Thread.sleep(200);
} catch (Exception e) {
e.printStackTrace();
assertThat(true).isFalse();
}
- try {
- List msgs = null;
- try {
- msgs = putMsg(master, topicCount, msgPerTopic);
- // sleep to wait for consume queue has been constructed.
- Thread.sleep(1000);
- } catch (Exception e) {
- e.printStackTrace();
- assertThat(true).isFalse();
- }
+ for (int i = 0; i < topicCount; i++) {
+ String realTopic = topic + i;
- for (int i = 0; i < topicCount; i++) {
- String realTopic = topic + i;
-
- for (int j = 0; j < msgPerTopic; j++) {
- String group = "CID_" + j;
-
- ConsumerFilterData filterData = filterManager.get(realTopic, group);
- assertThat(filterData).isNotNull();
-
- List filteredMsgs = filtered(msgs, filterData);
-
- SubscriptionData subscriptionData = new SubscriptionData();
- subscriptionData.setExpressionType(filterData.getExpressionType());
- subscriptionData.setTopic(filterData.getTopic());
- subscriptionData.setClassFilterMode(false);
- subscriptionData.setSubString(filterData.getExpression());
-
- GetMessageResult getMessageResult = master.getMessage(group, realTopic, queueId, 0, 10000,
- new ExpressionMessageFilter(subscriptionData, filterData, filterManager));
- String assertMsg = group + "-" + realTopic;
- try {
- assertThat(getMessageResult).isNotNull();
- assertThat(GetMessageStatus.FOUND).isEqualTo(getMessageResult.getStatus());
- assertThat(getMessageResult.getMessageBufferList()).isNotNull().isNotEmpty();
- assertThat(getMessageResult.getMessageBufferList().size()).isEqualTo(filteredMsgs.size());
-
- for (ByteBuffer buffer : getMessageResult.getMessageBufferList()) {
- MessageExt messageExt = MessageDecoder.decode(buffer.slice(), false);
- assertThat(messageExt).isNotNull();
-
- Object evlRet = null;
- try {
- evlRet = filterData.getCompiledExpression().evaluate(new MessageEvaluationContext(messageExt.getProperties()));
- } catch (Exception e) {
- e.printStackTrace();
- assertThat(true).isFalse();
- }
+ for (int j = 0; j < msgPerTopic; j++) {
+ String group = "CID_" + j;
+
+ ConsumerFilterData filterData = filterManager.get(realTopic, group);
+ assertThat(filterData).isNotNull();
+
+ List filteredMsgs = filtered(msgs, filterData);
+
+ SubscriptionData subscriptionData = new SubscriptionData();
+ subscriptionData.setExpressionType(filterData.getExpressionType());
+ subscriptionData.setTopic(filterData.getTopic());
+ subscriptionData.setClassFilterMode(false);
+ subscriptionData.setSubString(filterData.getExpression());
- assertThat(evlRet).isNotNull().isEqualTo(Boolean.TRUE);
+ GetMessageResult getMessageResult = master.getMessage(group, realTopic, queueId, 0, 10000,
+ new ExpressionMessageFilter(subscriptionData, filterData, filterManager));
+ String assertMsg = group + "-" + realTopic;
+ try {
+ assertThat(getMessageResult).isNotNull();
+ assertThat(GetMessageStatus.FOUND).isEqualTo(getMessageResult.getStatus());
+ assertThat(getMessageResult.getMessageBufferList()).isNotNull().isNotEmpty();
+ assertThat(getMessageResult.getMessageBufferList().size()).isEqualTo(filteredMsgs.size());
+
+ for (ByteBuffer buffer : getMessageResult.getMessageBufferList()) {
+ MessageExt messageExt = MessageDecoder.decode(buffer.slice(), false);
+ assertThat(messageExt).isNotNull();
+
+ Object evlRet = null;
+ try {
+ evlRet = filterData.getCompiledExpression().evaluate(new MessageEvaluationContext(messageExt.getProperties()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ assertThat(true).isFalse();
+ }
- // check
- boolean find = false;
- for (MessageExtBrokerInner messageExtBrokerInner : filteredMsgs) {
- if (messageExtBrokerInner.getMsgId().equals(messageExt.getMsgId())) {
- find = true;
- }
+ assertThat(evlRet).isNotNull().isEqualTo(Boolean.TRUE);
+
+ // check
+ boolean find = false;
+ for (MessageExtBrokerInner messageExtBrokerInner : filteredMsgs) {
+ if (messageExtBrokerInner.getMsgId().equals(messageExt.getMsgId())) {
+ find = true;
}
- assertThat(find).isTrue();
}
- } finally {
- getMessageResult.release();
+ assertThat(find).isTrue();
}
+ } finally {
+ getMessageResult.release();
}
}
- } finally {
- master.shutdown();
- master.destroy();
- deleteDirectory(storePath);
}
}
}
diff --git a/broker/src/test/java/org/apache/rocketmq/broker/processor/PullMessageProcessorTest.java b/broker/src/test/java/org/apache/rocketmq/broker/processor/PullMessageProcessorTest.java
index 941d4a77feaaba6687840db3a4e59612f7409905..c96f708e85463937ada305d8930c37dc4d83de9d 100644
--- a/broker/src/test/java/org/apache/rocketmq/broker/processor/PullMessageProcessorTest.java
+++ b/broker/src/test/java/org/apache/rocketmq/broker/processor/PullMessageProcessorTest.java
@@ -142,15 +142,18 @@ public class PullMessageProcessorTest {
List consumeMessageHookList = new ArrayList<>();
final ConsumeMessageContext[] messageContext = new ConsumeMessageContext[1];
ConsumeMessageHook consumeMessageHook = new ConsumeMessageHook() {
- @Override public String hookName() {
+ @Override
+ public String hookName() {
return "TestHook";
}
- @Override public void consumeMessageBefore(ConsumeMessageContext context) {
+ @Override
+ public void consumeMessageBefore(ConsumeMessageContext context) {
messageContext[0] = context;
}
- @Override public void consumeMessageAfter(ConsumeMessageContext context) {
+ @Override
+ public void consumeMessageAfter(ConsumeMessageContext context) {
}
};
consumeMessageHookList.add(consumeMessageHook);
diff --git a/broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java b/broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
index 02490a07b0fe51182390666489dd6c8ac73a362b..7828e7a91cdfe03b919b29f928e792fc8324b87e 100644
--- a/broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
+++ b/broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
@@ -94,15 +94,18 @@ public class SendMessageProcessorTest {
List sendMessageHookList = new ArrayList<>();
final SendMessageContext[] sendMessageContext = new SendMessageContext[1];
SendMessageHook sendMessageHook = new SendMessageHook() {
- @Override public String hookName() {
+ @Override
+ public String hookName() {
return null;
}
- @Override public void sendMessageBefore(SendMessageContext context) {
+ @Override
+ public void sendMessageBefore(SendMessageContext context) {
sendMessageContext[0] = context;
}
- @Override public void sendMessageAfter(SendMessageContext context) {
+ @Override
+ public void sendMessageAfter(SendMessageContext context) {
}
};
@@ -115,7 +118,6 @@ public class SendMessageProcessorTest {
assertThat(sendMessageContext[0].getProducerGroup()).isEqualTo(group);
}
-
@Test
public void testProcessRequest_FlushTimeOut() throws RemotingCommandException {
when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.FLUSH_DISK_TIMEOUT, new AppendMessageResult(AppendMessageStatus.UNKNOWN_ERROR)));
@@ -210,7 +212,8 @@ public class SendMessageProcessorTest {
final RemotingCommand request = createSendMsgCommand(RequestCode.SEND_MESSAGE);
final RemotingCommand[] response = new RemotingCommand[1];
doAnswer(new Answer() {
- @Override public Object answer(InvocationOnMock invocation) throws Throwable {
+ @Override
+ public Object answer(InvocationOnMock invocation) throws Throwable {
response[0] = invocation.getArgument(0);
return null;
}
diff --git a/broker/src/test/resources/logback-test.xml b/broker/src/test/resources/logback-test.xml
index 908373e86b7817fe17e9dcb13720f6b7efe0b727..1978b73ae07ef26b2a0d8f6d46cd0e7ad13b8404 100644
--- a/broker/src/test/resources/logback-test.xml
+++ b/broker/src/test/resources/logback-test.xml
@@ -19,7 +19,6 @@
- true%d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%nUTF-8
diff --git a/client/src/main/java/org/apache/rocketmq/client/MQAdmin.java b/client/src/main/java/org/apache/rocketmq/client/MQAdmin.java
index a0144a29106310ae5866847ae9bcaa56b4aeca95..019414b9e5c151d29fe6f093a8caf13a6e89efe8 100644
--- a/client/src/main/java/org/apache/rocketmq/client/MQAdmin.java
+++ b/client/src/main/java/org/apache/rocketmq/client/MQAdmin.java
@@ -32,7 +32,6 @@ public interface MQAdmin {
* @param key accesskey
* @param newTopic topic name
* @param queueNum topic's queue number
- * @throws MQClientException
*/
void createTopic(final String key, final String newTopic, final int queueNum)
throws MQClientException;
@@ -44,7 +43,6 @@ public interface MQAdmin {
* @param newTopic topic name
* @param queueNum topic's queue number
* @param topicSysFlag topic system flag
- * @throws MQClientException
*/
void createTopic(String key, String newTopic, int queueNum, int topicSysFlag)
throws MQClientException;
@@ -56,7 +54,6 @@ public interface MQAdmin {
* @param mq Instance of MessageQueue
* @param timestamp from when in milliseconds.
* @return offset
- * @throws MQClientException
*/
long searchOffset(final MessageQueue mq, final long timestamp) throws MQClientException;
@@ -65,7 +62,6 @@ public interface MQAdmin {
*
* @param mq Instance of MessageQueue
* @return the max offset
- * @throws MQClientException
*/
long maxOffset(final MessageQueue mq) throws MQClientException;
@@ -74,7 +70,6 @@ public interface MQAdmin {
*
* @param mq Instance of MessageQueue
* @return the minimum offset
- * @throws MQClientException
*/
long minOffset(final MessageQueue mq) throws MQClientException;
@@ -83,7 +78,6 @@ public interface MQAdmin {
*
* @param mq Instance of MessageQueue
* @return the time in microseconds
- * @throws MQClientException
*/
long earliestMsgStoreTime(final MessageQueue mq) throws MQClientException;
@@ -92,10 +86,6 @@ public interface MQAdmin {
*
* @param offsetMsgId message id
* @return message
- * @throws InterruptedException
- * @throws MQBrokerException
- * @throws RemotingException
- * @throws MQClientException
*/
MessageExt viewMessage(final String offsetMsgId) throws RemotingException, MQBrokerException,
InterruptedException, MQClientException;
@@ -109,21 +99,14 @@ public interface MQAdmin {
* @param begin from when
* @param end to when
* @return Instance of QueryResult
- * @throws MQClientException
- * @throws InterruptedException
*/
QueryResult queryMessage(final String topic, final String key, final int maxNum, final long begin,
final long end) throws MQClientException, InterruptedException;
/**
- * @param topic
- * @param msgId
* @return The {@code MessageExt} of given msgId
- * @throws RemotingException
- * @throws MQBrokerException
- * @throws InterruptedException
- * @throws MQClientException
*/
- MessageExt viewMessage(String topic, String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException;
+ MessageExt viewMessage(String topic,
+ String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException;
}
\ No newline at end of file
diff --git a/client/src/main/java/org/apache/rocketmq/client/MQHelper.java b/client/src/main/java/org/apache/rocketmq/client/MQHelper.java
index b78e1cb35a5bf5459af9bfaf3a2cbbf2c677dd28..7f0cef31b4d4eedfad44f65f4f14660bb5a460cc 100644
--- a/client/src/main/java/org/apache/rocketmq/client/MQHelper.java
+++ b/client/src/main/java/org/apache/rocketmq/client/MQHelper.java
@@ -41,7 +41,6 @@ public class MQHelper {
* @param consumerGroup consumer group
* @param topic topic
* @param timestamp time
- * @throws Exception
*/
public static void resetOffsetByTimestamp(
final MessageModel messageModel,
diff --git a/client/src/main/java/org/apache/rocketmq/client/Validators.java b/client/src/main/java/org/apache/rocketmq/client/Validators.java
index b49537f8c695a97c984ac56661346572ff9224b4..5567e49b558aedba22c2e53241671e3d2d98ed74 100644
--- a/client/src/main/java/org/apache/rocketmq/client/Validators.java
+++ b/client/src/main/java/org/apache/rocketmq/client/Validators.java
@@ -35,8 +35,6 @@ public class Validators {
public static final int CHARACTER_MAX_LENGTH = 255;
/**
- * @param origin
- * @param patternStr
* @return The resulting {@code String}
*/
public static String getGroupWithRegularExpression(String origin, String patternStr) {
@@ -50,9 +48,6 @@ public class Validators {
/**
* Validate group
- *
- * @param group
- * @throws MQClientException
*/
public static void checkGroup(String group) throws MQClientException {
if (UtilAll.isBlank(group)) {
@@ -69,8 +64,6 @@ public class Validators {
}
/**
- * @param origin
- * @param pattern
* @return true if, and only if, the entire origin sequence matches this matcher's pattern
*/
public static boolean regularExpressionMatcher(String origin, Pattern pattern) {
@@ -83,10 +76,6 @@ public class Validators {
/**
* Validate message
- *
- * @param msg
- * @param defaultMQProducer
- * @throws MQClientException
*/
public static void checkMessage(Message msg, DefaultMQProducer defaultMQProducer)
throws MQClientException {
@@ -113,9 +102,6 @@ public class Validators {
/**
* Validate topic
- *
- * @param topic
- * @throws MQClientException
*/
public static void checkTopic(String topic) throws MQClientException {
if (UtilAll.isBlank(topic)) {
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumer.java b/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumer.java
index f5016f82f51c56e9ecd2ea74b5a3a0afaa3908e9..cd70670307846d35208248ca0930d4f1c874fdd3 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumer.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumer.java
@@ -264,7 +264,8 @@ public class DefaultMQPullConsumer extends ClientConfig implements MQPullConsume
}
@Override
- public void pull(MessageQueue mq, String subExpression, long offset, int maxNums, PullCallback pullCallback, long timeout)
+ public void pull(MessageQueue mq, String subExpression, long offset, int maxNums, PullCallback pullCallback,
+ long timeout)
throws MQClientException, RemotingException, InterruptedException {
this.defaultMQPullConsumerImpl.pull(mq, subExpression, offset, maxNums, pullCallback, timeout);
}
@@ -276,7 +277,8 @@ public class DefaultMQPullConsumer extends ClientConfig implements MQPullConsume
}
@Override
- public void pullBlockIfNotFound(MessageQueue mq, String subExpression, long offset, int maxNums, PullCallback pullCallback)
+ public void pullBlockIfNotFound(MessageQueue mq, String subExpression, long offset, int maxNums,
+ PullCallback pullCallback)
throws MQClientException, RemotingException, InterruptedException {
this.defaultMQPullConsumerImpl.pullBlockIfNotFound(mq, subExpression, offset, maxNums, pullCallback);
}
@@ -297,7 +299,8 @@ public class DefaultMQPullConsumer extends ClientConfig implements MQPullConsume
}
@Override
- public MessageExt viewMessage(String topic, String uniqKey) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
+ public MessageExt viewMessage(String topic,
+ String uniqKey) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
try {
MessageDecoder.decodeMessageId(uniqKey);
return this.viewMessage(uniqKey);
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java b/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java
index 9c9b59ef0762b554c90e5cb7e719aabce2937e48..42ce2f9c0c15306a4896930f7399efc940b3ac11 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java
@@ -51,7 +51,7 @@ import org.apache.rocketmq.remoting.exception.RemotingException;
*
*
*
- * Thread Safety: After initialization, the instance can be regarded as thread-safe.
+ * Thread Safety: After initialization, the instance can be regarded as thread-safe.
*
*/
public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsumer {
@@ -90,29 +90,29 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
*
* There are three consuming points:
*
- *
- * CONSUME_FROM_LAST_OFFSET: consumer clients pick up where it stopped previously.
- * If it were a newly booting up consumer client, according aging of the consumer group, there are two
- * cases:
- *
- *
- * if the consumer group is created so recently that the earliest message being subscribed has yet
- * expired, which means the consumer group represents a lately launched business, consuming will
- * start from the very beginning;
- *
- *
- * if the earliest message being subscribed has expired, consuming will start from the latest
- * messages, meaning messages born prior to the booting timestamp would be ignored.
- *
- *
- *
- *
- * CONSUME_FROM_FIRST_OFFSET: Consumer client will start from earliest messages available.
- *
- *
- * CONSUME_FROM_TIMESTAMP: Consumer client will start from specified timestamp, which means
- * messages born prior to {@link #consumeTimestamp} will be ignored
- *
+ *
+ * CONSUME_FROM_LAST_OFFSET: consumer clients pick up where it stopped previously.
+ * If it were a newly booting up consumer client, according aging of the consumer group, there are two
+ * cases:
+ *
+ *
+ * if the consumer group is created so recently that the earliest message being subscribed has yet
+ * expired, which means the consumer group represents a lately launched business, consuming will
+ * start from the very beginning;
+ *
+ *
+ * if the earliest message being subscribed has expired, consuming will start from the latest
+ * messages, meaning messages born prior to the booting timestamp would be ignored.
+ *
+ *
+ *
+ *
+ * CONSUME_FROM_FIRST_OFFSET: Consumer client will start from earliest messages available.
+ *
+ *
+ * CONSUME_FROM_TIMESTAMP: Consumer client will start from specified timestamp, which means
+ * messages born prior to {@link #consumeTimestamp} will be ignored
+ *
*
*/
private ConsumeFromWhere consumeFromWhere = ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET;
@@ -223,11 +223,13 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
/**
* Constructor specifying consumer group, RPC hook and message queue allocating algorithm.
+ *
* @param consumerGroup Consume queue.
* @param rpcHook RPC hook to execute before each remoting command.
* @param allocateMessageQueueStrategy message queue allocating algorithm.
*/
- public DefaultMQPushConsumer(final String consumerGroup, RPCHook rpcHook, AllocateMessageQueueStrategy allocateMessageQueueStrategy) {
+ public DefaultMQPushConsumer(final String consumerGroup, RPCHook rpcHook,
+ AllocateMessageQueueStrategy allocateMessageQueueStrategy) {
this.consumerGroup = consumerGroup;
this.allocateMessageQueueStrategy = allocateMessageQueueStrategy;
defaultMQPushConsumerImpl = new DefaultMQPushConsumerImpl(this, rpcHook);
@@ -235,6 +237,7 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
/**
* Constructor specifying RPC hook.
+ *
* @param rpcHook RPC hook to execute before each remoting command.
*/
public DefaultMQPushConsumer(RPCHook rpcHook) {
@@ -243,6 +246,7 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
/**
* Constructor specifying consumer group.
+ *
* @param consumerGroup Consumer group.
*/
public DefaultMQPushConsumer(final String consumerGroup) {
@@ -280,7 +284,8 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
}
@Override
- public MessageExt viewMessage(String offsetMsgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
+ public MessageExt viewMessage(
+ String offsetMsgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
return this.defaultMQPushConsumerImpl.viewMessage(offsetMsgId);
}
@@ -291,7 +296,8 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
}
@Override
- public MessageExt viewMessage(String topic, String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
+ public MessageExt viewMessage(String topic,
+ String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
try {
MessageDecoder.decodeMessageId(msgId);
return this.viewMessage(msgId);
@@ -411,6 +417,7 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
/**
* Send message back to broker which will be re-delivered in future.
+ *
* @param msg Message to send back.
* @param delayLevel delay level.
* @throws RemotingException if there is any network-tier error.
@@ -449,6 +456,7 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
/**
* This method gets internal infrastructure readily to serve. Instances must call this method after configuration.
+ *
* @throws MQClientException if there is any client error.
*/
@Override
@@ -498,7 +506,7 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
*
* @param topic topic to subscribe.
* @param subExpression subscription expression.it only support or operation such as "tag1 || tag2 || tag3"
- * if null or * expression,meaning subscribe all
+ * if null or * expression,meaning subscribe all
* @throws MQClientException if there is any client error.
*/
@Override
@@ -508,10 +516,10 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
/**
* Subscribe a topic to consuming subscription.
+ *
* @param topic topic to consume.
* @param fullClassName full class name,must extend org.apache.rocketmq.common.filter. MessageFilter
* @param filterClassSource class source code,used UTF-8 file encoding,must be responsible for your code safety
- * @throws MQClientException
*/
@Override
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException {
@@ -521,12 +529,10 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
/**
* Subscribe a topic by message selector.
*
- * @see org.apache.rocketmq.client.consumer.MessageSelector#bySql
- * @see org.apache.rocketmq.client.consumer.MessageSelector#byTag
- *
* @param topic topic to consume.
* @param messageSelector {@link org.apache.rocketmq.client.consumer.MessageSelector}
- * @throws MQClientException
+ * @see org.apache.rocketmq.client.consumer.MessageSelector#bySql
+ * @see org.apache.rocketmq.client.consumer.MessageSelector#byTag
*/
@Override
public void subscribe(final String topic, final MessageSelector messageSelector) throws MQClientException {
@@ -535,6 +541,7 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
/**
* Un-subscribe the specified topic from subscription.
+ *
* @param topic message topic
*/
@Override
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/MQConsumer.java b/client/src/main/java/org/apache/rocketmq/client/consumer/MQConsumer.java
index 03ee4d96654ab4b7631b60710c1703829bd400d3..f4a8eda23a495df3f16e9475b6dbea4357b03fe8 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/MQConsumer.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/MQConsumer.java
@@ -30,13 +30,6 @@ import org.apache.rocketmq.remoting.exception.RemotingException;
public interface MQConsumer extends MQAdmin {
/**
* If consuming failure,message will be send back to the brokers,and delay consuming some time
- *
- * @param msg
- * @param delayLevel
- * @throws InterruptedException
- * @throws MQBrokerException
- * @throws RemotingException
- * @throws MQClientException
*/
@Deprecated
void sendMessageBack(final MessageExt msg, final int delayLevel) throws RemotingException,
@@ -44,14 +37,6 @@ public interface MQConsumer extends MQAdmin {
/**
* If consuming failure,message will be send back to the broker,and delay consuming some time
- *
- * @param msg
- * @param delayLevel
- * @param brokerName
- * @throws RemotingException
- * @throws MQBrokerException
- * @throws InterruptedException
- * @throws MQClientException
*/
void sendMessageBack(final MessageExt msg, final int delayLevel, final String brokerName)
throws RemotingException, MQBrokerException, InterruptedException, MQClientException;
@@ -61,7 +46,6 @@ public interface MQConsumer extends MQAdmin {
*
* @param topic message topic
* @return queue set
- * @throws MQClientException
*/
Set fetchSubscribeMessageQueues(final String topic) throws MQClientException;
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumer.java b/client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumer.java
index da43aa9dd5793d6b84b2db1030a630c9dd6fc4e0..33002c9837176982f9015093a6b945a512b04111 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumer.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumer.java
@@ -29,8 +29,6 @@ import org.apache.rocketmq.remoting.exception.RemotingException;
public interface MQPullConsumer extends MQConsumer {
/**
* Start the consumer
- *
- * @throws MQClientException
*/
void start() throws MQClientException;
@@ -41,9 +39,6 @@ public interface MQPullConsumer extends MQConsumer {
/**
* Register the message queue listener
- *
- * @param topic
- * @param listener
*/
void registerMessageQueueListener(final String topic, final MessageQueueListener listener);
@@ -51,15 +46,12 @@ public interface MQPullConsumer extends MQConsumer {
* Pulling the messages,not blocking
*
* @param mq from which message queue
- * @param subExpression subscription expression.it only support or operation such as "tag1 || tag2 || tag3" if null or * expression,meaning subscribe
+ * @param subExpression subscription expression.it only support or operation such as "tag1 || tag2 || tag3" if
+ * null or * expression,meaning subscribe
* all
* @param offset from where to pull
* @param maxNums max pulling numbers
* @return The resulting {@code PullRequest}
- * @throws MQClientException
- * @throws InterruptedException
- * @throws MQBrokerException
- * @throws RemotingException
*/
PullResult pull(final MessageQueue mq, final String subExpression, final long offset,
final int maxNums) throws MQClientException, RemotingException, MQBrokerException,
@@ -68,16 +60,7 @@ public interface MQPullConsumer extends MQConsumer {
/**
* Pulling the messages in the specified timeout
*
- * @param mq
- * @param subExpression
- * @param offset
- * @param maxNums
- * @param timeout
* @return The resulting {@code PullRequest}
- * @throws MQClientException
- * @throws RemotingException
- * @throws MQBrokerException
- * @throws InterruptedException
*/
PullResult pull(final MessageQueue mq, final String subExpression, final long offset,
final int maxNums, final long timeout) throws MQClientException, RemotingException,
@@ -85,15 +68,6 @@ public interface MQPullConsumer extends MQConsumer {
/**
* Pulling the messages in a async. way
- *
- * @param mq
- * @param subExpression
- * @param offset
- * @param maxNums
- * @param pullCallback
- * @throws MQClientException
- * @throws RemotingException
- * @throws InterruptedException
*/
void pull(final MessageQueue mq, final String subExpression, final long offset, final int maxNums,
final PullCallback pullCallback) throws MQClientException, RemotingException,
@@ -101,16 +75,6 @@ public interface MQPullConsumer extends MQConsumer {
/**
* Pulling the messages in a async. way
- *
- * @param mq
- * @param subExpression
- * @param offset
- * @param maxNums
- * @param pullCallback
- * @param timeout
- * @throws MQClientException
- * @throws RemotingException
- * @throws InterruptedException
*/
void pull(final MessageQueue mq, final String subExpression, final long offset, final int maxNums,
final PullCallback pullCallback, long timeout) throws MQClientException, RemotingException,
@@ -119,15 +83,7 @@ public interface MQPullConsumer extends MQConsumer {
/**
* Pulling the messages,if no message arrival,blocking some time
*
- * @param mq
- * @param subExpression
- * @param offset
- * @param maxNums
* @return The resulting {@code PullRequest}
- * @throws MQClientException
- * @throws RemotingException
- * @throws MQBrokerException
- * @throws InterruptedException
*/
PullResult pullBlockIfNotFound(final MessageQueue mq, final String subExpression,
final long offset, final int maxNums) throws MQClientException, RemotingException,
@@ -135,15 +91,6 @@ public interface MQPullConsumer extends MQConsumer {
/**
* Pulling the messages through callback function,if no message arrival,blocking.
- *
- * @param mq
- * @param subExpression
- * @param offset
- * @param maxNums
- * @param pullCallback
- * @throws MQClientException
- * @throws RemotingException
- * @throws InterruptedException
*/
void pullBlockIfNotFound(final MessageQueue mq, final String subExpression, final long offset,
final int maxNums, final PullCallback pullCallback) throws MQClientException, RemotingException,
@@ -151,20 +98,13 @@ public interface MQPullConsumer extends MQConsumer {
/**
* Update the offset
- *
- * @param mq
- * @param offset
- * @throws MQClientException
*/
void updateConsumeOffset(final MessageQueue mq, final long offset) throws MQClientException;
/**
* Fetch the offset
*
- * @param mq
- * @param fromStore
* @return The fetched offset of given queue
- * @throws MQClientException
*/
long fetchConsumeOffset(final MessageQueue mq, final boolean fromStore) throws MQClientException;
@@ -173,22 +113,12 @@ public interface MQPullConsumer extends MQConsumer {
*
* @param topic message topic
* @return message queue set
- * @throws MQClientException
*/
Set fetchMessageQueuesInBalance(final String topic) throws MQClientException;
/**
* If consuming failure,message will be send back to the broker,and delay consuming in some time later.
* Mind! message can only be consumed in the same group.
- *
- * @param msg
- * @param delayLevel
- * @param brokerName
- * @param consumerGroup
- * @throws RemotingException
- * @throws MQBrokerException
- * @throws InterruptedException
- * @throws MQClientException
*/
void sendMessageBack(MessageExt msg, int delayLevel, String brokerName, String consumerGroup)
throws RemotingException, MQBrokerException, InterruptedException, MQClientException;
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/MQPushConsumer.java b/client/src/main/java/org/apache/rocketmq/client/consumer/MQPushConsumer.java
index 9c6c1f17805ec9b2c1490304d9dffdbdfa3175b0..d56075c6097bddac6216e41796e4fb295b599722 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/MQPushConsumer.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/MQPushConsumer.java
@@ -27,8 +27,6 @@ import org.apache.rocketmq.client.exception.MQClientException;
public interface MQPushConsumer extends MQConsumer {
/**
* Start the consumer
- *
- * @throws MQClientException
*/
void start() throws MQClientException;
@@ -39,8 +37,6 @@ public interface MQPushConsumer extends MQConsumer {
/**
* Register the message listener
- *
- * @param messageListener
*/
@Deprecated
void registerMessageListener(MessageListener messageListener);
@@ -52,22 +48,20 @@ public interface MQPushConsumer extends MQConsumer {
/**
* Subscribe some topic
*
- * @param topic
- * @param subExpression subscription expression.it only support or operation such as "tag1 || tag2 || tag3" if null or * expression,meaning subscribe
+ * @param subExpression subscription expression.it only support or operation such as "tag1 || tag2 || tag3" if
+ * null or * expression,meaning subscribe
* all
- * @throws MQClientException
*/
void subscribe(final String topic, final String subExpression) throws MQClientException;
/**
* Subscribe some topic
*
- * @param topic
* @param fullClassName full class name,must extend org.apache.rocketmq.common.filter. MessageFilter
* @param filterClassSource class source code,used UTF-8 file encoding,must be responsible for your code safety
- * @throws MQClientException
*/
- void subscribe(final String topic, final String fullClassName, final String filterClassSource) throws MQClientException;
+ void subscribe(final String topic, final String fullClassName,
+ final String filterClassSource) throws MQClientException;
/**
* Subscribe some topic with selector.
@@ -84,9 +78,7 @@ public interface MQPushConsumer extends MQConsumer {
* Choose SQL92: {@link MessageSelector#bySql(java.lang.String)}
*
*
- * @param topic
* @param selector message selector({@link MessageSelector}), can be null.
- * @throws MQClientException
*/
void subscribe(final String topic, final MessageSelector selector) throws MQClientException;
@@ -99,8 +91,6 @@ public interface MQPushConsumer extends MQConsumer {
/**
* Update the consumer thread pool size Dynamically
- *
- * @param corePoolSize
*/
void updateCorePoolSize(int corePoolSize);
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/MessageSelector.java b/client/src/main/java/org/apache/rocketmq/client/consumer/MessageSelector.java
index 35a5181fd96de3228ccbe4e82ea8cdfda9b52f06..03983413aa55ebbb490692b92e291b8e6b2ef092 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/MessageSelector.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/MessageSelector.java
@@ -20,14 +20,13 @@ package org.apache.rocketmq.client.consumer;
import org.apache.rocketmq.common.filter.ExpressionType;
/**
- *
* Message selector: select message at server.
*
*
*/
public class MessageSelector {
@@ -51,7 +50,6 @@ public class MessageSelector {
* Use SLQ92 to select message.
*
* @param sql if null or empty, will be treated as select all message.
- * @return
*/
public static MessageSelector bySql(String sql) {
return new MessageSelector(ExpressionType.SQL92, sql);
@@ -61,7 +59,6 @@ public class MessageSelector {
* Use tag to select message.
*
* @param tag if null or empty or "*", will be treated as select all message.
- * @return
*/
public static MessageSelector byTag(String tag) {
return new MessageSelector(ExpressionType.TAG, tag);
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/listener/MessageListenerConcurrently.java b/client/src/main/java/org/apache/rocketmq/client/consumer/listener/MessageListenerConcurrently.java
index 4eef1a8ad9101bd51503b586ed4477853eec3be8..cb39d7e482cd1880026929f5840cc936a8055825 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/listener/MessageListenerConcurrently.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/listener/MessageListenerConcurrently.java
@@ -24,10 +24,10 @@ import org.apache.rocketmq.common.message.MessageExt;
*/
public interface MessageListenerConcurrently extends MessageListener {
/**
- * It is not recommend to throw exception,rather than returning ConsumeConcurrentlyStatus.RECONSUME_LATER if consumption failure
+ * It is not recommend to throw exception,rather than returning ConsumeConcurrentlyStatus.RECONSUME_LATER if
+ * consumption failure
*
* @param msgs msgs.size() >= 1 DefaultMQPushConsumer.consumeMessageBatchMaxSize=1,you can modify here
- * @param context
* @return The consume status
*/
ConsumeConcurrentlyStatus consumeMessage(final List msgs,
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/listener/MessageListenerOrderly.java b/client/src/main/java/org/apache/rocketmq/client/consumer/listener/MessageListenerOrderly.java
index 74dbb45a8de4a6d81e8c2da92972fbb615c0427c..d148df5c674d7eada8caa564139f01823cfeb50a 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/listener/MessageListenerOrderly.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/listener/MessageListenerOrderly.java
@@ -20,14 +20,15 @@ import java.util.List;
import org.apache.rocketmq.common.message.MessageExt;
/**
- * A MessageListenerConcurrently object is used to receive asynchronously delivered messages orderly.one queue,one thread
+ * A MessageListenerConcurrently object is used to receive asynchronously delivered messages orderly.one queue,one
+ * thread
*/
public interface MessageListenerOrderly extends MessageListener {
/**
- * It is not recommend to throw exception,rather than returning ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT if consumption failure
+ * It is not recommend to throw exception,rather than returning ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT
+ * if consumption failure
*
* @param msgs msgs.size() >= 1 DefaultMQPushConsumer.consumeMessageBatchMaxSize=1,you can modify here
- * @param context
* @return The consume status
*/
ConsumeOrderlyStatus consumeMessage(final List msgs,
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsistentHash.java b/client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsistentHash.java
index 09d940a1cfaf59741210e59274ef5b66f005aad6..b00326e6fef7843fd3d44d52583acabd32dbc00f 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsistentHash.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsistentHash.java
@@ -30,7 +30,7 @@ import org.slf4j.Logger;
/**
* Consistent Hashing queue algorithm
*/
-public class AllocateMessageQueueConsistentHash implements AllocateMessageQueueStrategy {
+public class AllocateMessageQueueConsistentHash implements AllocateMessageQueueStrategy {
private final Logger log = ClientLogger.getLog();
private final int virtualNodeCnt;
@@ -41,7 +41,7 @@ public class AllocateMessageQueueConsistentHash implements AllocateMessageQueue
}
public AllocateMessageQueueConsistentHash(int virtualNodeCnt) {
- this(virtualNodeCnt,null);
+ this(virtualNodeCnt, null);
}
public AllocateMessageQueueConsistentHash(int virtualNodeCnt, HashFunction customHashFunction) {
@@ -75,7 +75,6 @@ public class AllocateMessageQueueConsistentHash implements AllocateMessageQueue
return result;
}
-
Collection cidNodes = new ArrayList();
for (String cid : cidAll) {
cidNodes.add(new ClientNode(cid));
@@ -105,7 +104,6 @@ public class AllocateMessageQueueConsistentHash implements AllocateMessageQueue
return "CONSISTENT_HASH";
}
-
private static class ClientNode implements Node {
private final String clientID;
@@ -119,6 +117,4 @@ public class AllocateMessageQueueConsistentHash implements AllocateMessageQueue
}
}
-
-
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java b/client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java
index d4b19b234b3074c8d582f02879077d2f2194a6cb..22ec674288c713c58dabbd705f988a51de801ed6 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java
@@ -52,9 +52,9 @@ public class LocalFileOffsetStore implements OffsetStore {
public LocalFileOffsetStore(MQClientInstance mQClientFactory, String groupName) {
this.mQClientFactory = mQClientFactory;
this.groupName = groupName;
- this.storePath = LOCAL_OFFSET_STORE_DIR + File.separator + //
- this.mQClientFactory.getClientId() + File.separator + //
- this.groupName + File.separator + //
+ this.storePath = LOCAL_OFFSET_STORE_DIR + File.separator +
+ this.mQClientFactory.getClientId() + File.separator +
+ this.groupName + File.separator +
"offsets.json";
}
@@ -217,8 +217,8 @@ public class LocalFileOffsetStore implements OffsetStore {
OffsetSerializeWrapper.fromJson(content, OffsetSerializeWrapper.class);
} catch (Exception e) {
log.warn("readLocalOffset Exception", e);
- throw new MQClientException("readLocalOffset Exception, maybe fastjson version too low" //
- + FAQUrl.suggestTodo(FAQUrl.LOAD_JSON_EXCEPTION), //
+ throw new MQClientException("readLocalOffset Exception, maybe fastjson version too low"
+ + FAQUrl.suggestTodo(FAQUrl.LOAD_JSON_EXCEPTION),
e);
}
return offsetSerializeWrapper;
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/store/OffsetStore.java b/client/src/main/java/org/apache/rocketmq/client/consumer/store/OffsetStore.java
index af745fcb87cfad10cd47a6e89e525d1105bda910..9deed0e3dfe8b400ef4aafa77523bcd70ffee833 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/store/OffsetStore.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/store/OffsetStore.java
@@ -29,52 +29,37 @@ import org.apache.rocketmq.remoting.exception.RemotingException;
public interface OffsetStore {
/**
* Load
- *
- * @throws MQClientException
*/
void load() throws MQClientException;
/**
* Update the offset,store it in memory
- *
- * @param mq
- * @param offset
- * @param increaseOnly
*/
void updateOffset(final MessageQueue mq, final long offset, final boolean increaseOnly);
/**
* Get offset from local storage
*
- * @param mq
- * @param type
* @return The fetched offset
*/
long readOffset(final MessageQueue mq, final ReadOffsetType type);
/**
* Persist all offsets,may be in local storage or remote name server
- *
- * @param mqs
*/
void persistAll(final Set mqs);
/**
* Persist the offset,may be in local storage or remote name server
- *
- * @param mq
*/
void persist(final MessageQueue mq);
/**
* Remove offset
- *
- * @param mq
*/
void removeOffset(MessageQueue mq);
/**
- * @param topic
* @return The cloned offset table of given topic
*/
Map cloneOffsetTable(String topic);
diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java b/client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java
index 5bd5749ea093d2fde9c7f78dbc3321b8a4e4d642..b82e992875e2914ffe961f97c451f34a4ffcaa66 100644
--- a/client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java
+++ b/client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java
@@ -204,7 +204,7 @@ public class RemoteBrokerOffsetStore implements OffsetStore {
MQBrokerException, InterruptedException, MQClientException {
FindBrokerResult findBrokerResult = this.mQClientFactory.findBrokerAddressInAdmin(mq.getBrokerName());
if (null == findBrokerResult) {
- // TODO Here may be heavily overhead for Name Server,need tuning
+
this.mQClientFactory.updateTopicRouteInfoFromNameServer(mq.getTopic());
findBrokerResult = this.mQClientFactory.findBrokerAddressInAdmin(mq.getBrokerName());
}
@@ -232,7 +232,7 @@ public class RemoteBrokerOffsetStore implements OffsetStore {
InterruptedException, MQClientException {
FindBrokerResult findBrokerResult = this.mQClientFactory.findBrokerAddressInAdmin(mq.getBrokerName());
if (null == findBrokerResult) {
- // TODO Here may be heavily overhead for Name Server,need tuning
+
this.mQClientFactory.updateTopicRouteInfoFromNameServer(mq.getTopic());
findBrokerResult = this.mQClientFactory.findBrokerAddressInAdmin(mq.getBrokerName());
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java b/client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java
index 2aadc896321838571eb5240f3c063e5aeb8d7861..69478cf328710766c6900c9454efc08a82a10c5c 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java
@@ -55,7 +55,8 @@ public class ClientRemotingProcessor implements NettyRequestProcessor {
}
@Override
- public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand processRequest(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
switch (request.getCode()) {
case RequestCode.CHECK_TRANSACTION_STATE:
return this.checkTransactionState(ctx, request);
@@ -82,7 +83,8 @@ public class ClientRemotingProcessor implements NettyRequestProcessor {
return false;
}
- public RemotingCommand checkTransactionState(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand checkTransactionState(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final CheckTransactionStateRequestHeader requestHeader =
(CheckTransactionStateRequestHeader) request.decodeCommandCustomHeader(CheckTransactionStateRequestHeader.class);
final ByteBuffer byteBuffer = ByteBuffer.wrap(request.getBody());
@@ -107,7 +109,8 @@ public class ClientRemotingProcessor implements NettyRequestProcessor {
return null;
}
- public RemotingCommand notifyConsumerIdsChanged(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand notifyConsumerIdsChanged(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
try {
final NotifyConsumerIdsChangedRequestHeader requestHeader =
(NotifyConsumerIdsChangedRequestHeader) request.decodeCommandCustomHeader(NotifyConsumerIdsChangedRequestHeader.class);
@@ -121,12 +124,13 @@ public class ClientRemotingProcessor implements NettyRequestProcessor {
return null;
}
- public RemotingCommand resetOffset(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand resetOffset(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final ResetOffsetRequestHeader requestHeader =
(ResetOffsetRequestHeader) request.decodeCommandCustomHeader(ResetOffsetRequestHeader.class);
log.info("invoke reset offset operation from broker. brokerAddr={}, topic={}, group={}, timestamp={}",
- RemotingHelper.parseChannelRemoteAddr(ctx.channel()), requestHeader.getTopic(), requestHeader.getGroup(),
- requestHeader.getTimestamp());
+ RemotingHelper.parseChannelRemoteAddr(ctx.channel()), requestHeader.getTopic(), requestHeader.getGroup(),
+ requestHeader.getTimestamp());
Map offsetTable = new HashMap();
if (request.getBody() != null) {
ResetOffsetBody body = ResetOffsetBody.decode(request.getBody(), ResetOffsetBody.class);
@@ -137,7 +141,8 @@ public class ClientRemotingProcessor implements NettyRequestProcessor {
}
@Deprecated
- public RemotingCommand getConsumeStatus(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ public RemotingCommand getConsumeStatus(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
final GetConsumerStatusRequestHeader requestHeader =
(GetConsumerStatusRequestHeader) request.decodeCommandCustomHeader(GetConsumerStatusRequestHeader.class);
@@ -150,7 +155,8 @@ public class ClientRemotingProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand getConsumerRunningInfo(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
final GetConsumerRunningInfoRequestHeader requestHeader =
(GetConsumerRunningInfoRequestHeader) request.decodeCommandCustomHeader(GetConsumerRunningInfoRequestHeader.class);
@@ -173,7 +179,8 @@ public class ClientRemotingProcessor implements NettyRequestProcessor {
return response;
}
- private RemotingCommand consumeMessageDirectly(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
+ private RemotingCommand consumeMessageDirectly(ChannelHandlerContext ctx,
+ RemotingCommand request) throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
final ConsumeMessageDirectlyResultRequestHeader requestHeader =
(ConsumeMessageDirectlyResultRequestHeader) request
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java
index 983e5157ea9491d587b77917849ead29eae2c4a4..b582b81e00dcbe6cb0f0609b2dff2651a74255ad 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java
@@ -159,7 +159,7 @@ public class MQAdminImpl {
}
} catch (Exception e) {
throw new MQClientException(
- "Can not find Message Queue for this topic, " + topic + FAQUrl.suggestTodo(FAQUrl.MQLIST_NOT_EXIST), //
+ "Can not find Message Queue for this topic, " + topic + FAQUrl.suggestTodo(FAQUrl.MQLIST_NOT_EXIST),
e);
}
@@ -240,7 +240,8 @@ public class MQAdminImpl {
throw new MQClientException("The broker[" + mq.getBrokerName() + "] not exist", null);
}
- public MessageExt viewMessage(String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
+ public MessageExt viewMessage(
+ String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
MessageId messageId = null;
try {
@@ -252,12 +253,14 @@ public class MQAdminImpl {
messageId.getOffset(), timeoutMillis);
}
- public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end) throws MQClientException,
+ public QueryResult queryMessage(String topic, String key, int maxNum, long begin,
+ long end) throws MQClientException,
InterruptedException {
return queryMessage(topic, key, maxNum, begin, end, false);
}
- public MessageExt queryMessageByUniqKey(String topic, String uniqKey) throws InterruptedException, MQClientException {
+ public MessageExt queryMessageByUniqKey(String topic,
+ String uniqKey) throws InterruptedException, MQClientException {
QueryResult qr = this.queryMessage(topic, uniqKey, 32,
MessageClientIDSetter.getNearlyTimeFromID(uniqKey).getTime() - 1000, Long.MAX_VALUE, true);
@@ -268,7 +271,8 @@ public class MQAdminImpl {
}
}
- protected QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end, boolean isUniqKey) throws MQClientException,
+ protected QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end,
+ boolean isUniqKey) throws MQClientException,
InterruptedException {
TopicRouteData topicRouteData = this.mQClientFactory.getAnExistTopicRouteData(topic);
if (null == topicRouteData) {
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java
index 4244bddcf2f2a1edf3b196c5fb9026180bf6d123..c5abc36bf6706a1a92c433225de8795060d61bca 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java
@@ -18,14 +18,14 @@ package org.apache.rocketmq.client.impl;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import java.util.Iterator;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.rocketmq.client.ClientConfig;
import org.apache.rocketmq.client.consumer.PullCallback;
@@ -49,12 +49,12 @@ import org.apache.rocketmq.common.UtilAll;
import org.apache.rocketmq.common.admin.ConsumeStats;
import org.apache.rocketmq.common.admin.TopicStatsTable;
import org.apache.rocketmq.common.message.Message;
+import org.apache.rocketmq.common.message.MessageBatch;
import org.apache.rocketmq.common.message.MessageClientIDSetter;
-import org.apache.rocketmq.common.message.MessageExt;
-import org.apache.rocketmq.common.message.MessageQueue;
import org.apache.rocketmq.common.message.MessageConst;
import org.apache.rocketmq.common.message.MessageDecoder;
-import org.apache.rocketmq.common.message.MessageBatch;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.common.message.MessageQueue;
import org.apache.rocketmq.common.namesrv.TopAddressing;
import org.apache.rocketmq.common.protocol.RequestCode;
import org.apache.rocketmq.common.protocol.ResponseCode;
@@ -152,7 +152,6 @@ import org.apache.rocketmq.remoting.protocol.RemotingCommand;
import org.apache.rocketmq.remoting.protocol.RemotingSerializable;
import org.slf4j.Logger;
-
public class MQClientAPIImpl {
private final static Logger log = ClientLogger.getLog();
@@ -169,7 +168,8 @@ public class MQClientAPIImpl {
private String nameSrvAddr = null;
private ClientConfig clientConfig;
- public MQClientAPIImpl(final NettyClientConfig nettyClientConfig, final ClientRemotingProcessor clientRemotingProcessor,
+ public MQClientAPIImpl(final NettyClientConfig nettyClientConfig,
+ final ClientRemotingProcessor clientRemotingProcessor,
RPCHook rpcHook, final ClientConfig clientConfig) {
this.clientConfig = clientConfig;
topAddressing = new TopAddressing(MixAll.getWSAddr(), clientConfig.getUnitName());
@@ -233,7 +233,8 @@ public class MQClientAPIImpl {
this.remotingClient.shutdown();
}
- public void createSubscriptionGroup(final String addr, final SubscriptionGroupConfig config, final long timeoutMillis)
+ public void createSubscriptionGroup(final String addr, final SubscriptionGroupConfig config,
+ final long timeoutMillis)
throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_SUBSCRIPTIONGROUP, null);
@@ -255,7 +256,8 @@ public class MQClientAPIImpl {
}
- public void createTopic(final String addr, final String defaultTopic, final TopicConfig topicConfig, final long timeoutMillis)
+ public void createTopic(final String addr, final String defaultTopic, final TopicConfig topicConfig,
+ final long timeoutMillis)
throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
CreateTopicRequestHeader requestHeader = new CreateTopicRequestHeader();
requestHeader.setTopic(topicConfig.getTopicName());
@@ -283,32 +285,32 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public SendResult sendMessage(//
- final String addr, // 1
- final String brokerName, // 2
- final Message msg, // 3
- final SendMessageRequestHeader requestHeader, // 4
- final long timeoutMillis, // 5
- final CommunicationMode communicationMode, // 6
- final SendMessageContext context, // 7
- final DefaultMQProducerImpl producer // 8
+ public SendResult sendMessage(
+ final String addr,
+ final String brokerName,
+ final Message msg,
+ final SendMessageRequestHeader requestHeader,
+ final long timeoutMillis,
+ final CommunicationMode communicationMode,
+ final SendMessageContext context,
+ final DefaultMQProducerImpl producer
) throws RemotingException, MQBrokerException, InterruptedException {
return sendMessage(addr, brokerName, msg, requestHeader, timeoutMillis, communicationMode, null, null, null, 0, context, producer);
}
- public SendResult sendMessage(//
- final String addr, // 1
- final String brokerName, // 2
- final Message msg, // 3
- final SendMessageRequestHeader requestHeader, // 4
- final long timeoutMillis, // 5
- final CommunicationMode communicationMode, // 6
- final SendCallback sendCallback, // 7
- final TopicPublishInfo topicPublishInfo, // 8
- final MQClientInstance instance, // 9
- final int retryTimesWhenSendFailed, // 10
- final SendMessageContext context, // 11
- final DefaultMQProducerImpl producer // 12
+ public SendResult sendMessage(
+ final String addr,
+ final String brokerName,
+ final Message msg,
+ final SendMessageRequestHeader requestHeader,
+ final long timeoutMillis,
+ final CommunicationMode communicationMode,
+ final SendCallback sendCallback,
+ final TopicPublishInfo topicPublishInfo,
+ final MQClientInstance instance,
+ final int retryTimesWhenSendFailed,
+ final SendMessageContext context,
+ final DefaultMQProducerImpl producer
) throws RemotingException, MQBrokerException, InterruptedException {
RemotingCommand request = null;
if (sendSmartMsg || msg instanceof MessageBatch) {
@@ -339,31 +341,31 @@ public class MQClientAPIImpl {
return null;
}
- private SendResult sendMessageSync(//
- final String addr, //
- final String brokerName, //
- final Message msg, //
- final long timeoutMillis, //
- final RemotingCommand request//
+ private SendResult sendMessageSync(
+ final String addr,
+ final String brokerName,
+ final Message msg,
+ final long timeoutMillis,
+ final RemotingCommand request
) throws RemotingException, MQBrokerException, InterruptedException {
RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
assert response != null;
return this.processSendResponse(brokerName, msg, response);
}
- private void sendMessageAsync(//
- final String addr, //
- final String brokerName, //
- final Message msg, //
- final long timeoutMillis, //
- final RemotingCommand request, //
- final SendCallback sendCallback, //
- final TopicPublishInfo topicPublishInfo, //
- final MQClientInstance instance, //
- final int retryTimesWhenSendFailed, //
- final AtomicInteger times, //
- final SendMessageContext context, //
- final DefaultMQProducerImpl producer //
+ private void sendMessageAsync(
+ final String addr,
+ final String brokerName,
+ final Message msg,
+ final long timeoutMillis,
+ final RemotingCommand request,
+ final SendCallback sendCallback,
+ final TopicPublishInfo topicPublishInfo,
+ final MQClientInstance instance,
+ final int retryTimesWhenSendFailed,
+ final AtomicInteger times,
+ final SendMessageContext context,
+ final DefaultMQProducerImpl producer
) throws InterruptedException, RemotingException {
this.remotingClient.invokeAsync(addr, request, timeoutMillis, new InvokeCallback() {
@Override
@@ -378,7 +380,6 @@ public class MQClientAPIImpl {
context.getProducer().executeSendMessageHookAfter(context);
}
} catch (Throwable e) {
- //
}
producer.updateFaultItem(brokerName, System.currentTimeMillis() - responseFuture.getBeginTimestamp(), false);
@@ -426,19 +427,19 @@ public class MQClientAPIImpl {
});
}
- private void onExceptionImpl(final String brokerName, //
- final Message msg, //
- final long timeoutMillis, //
- final RemotingCommand request, //
- final SendCallback sendCallback, //
- final TopicPublishInfo topicPublishInfo, //
- final MQClientInstance instance, //
- final int timesTotal, //
- final AtomicInteger curTimes, //
- final Exception e, //
- final SendMessageContext context, //
- final boolean needRetry, //
- final DefaultMQProducerImpl producer // 12
+ private void onExceptionImpl(final String brokerName,
+ final Message msg,
+ final long timeoutMillis,
+ final RemotingCommand request,
+ final SendCallback sendCallback,
+ final TopicPublishInfo topicPublishInfo,
+ final MQClientInstance instance,
+ final int timesTotal,
+ final AtomicInteger curTimes,
+ final Exception e,
+ final SendMessageContext context,
+ final boolean needRetry,
+ final DefaultMQProducerImpl producer
) {
int tmp = curTimes.incrementAndGet();
if (needRetry && tmp <= timesTotal) {
@@ -483,16 +484,15 @@ public class MQClientAPIImpl {
}
}
- private SendResult processSendResponse(//
- final String brokerName, //
- final Message msg, //
- final RemotingCommand response//
+ private SendResult processSendResponse(
+ final String brokerName,
+ final Message msg,
+ final RemotingCommand response
) throws MQBrokerException, RemotingCommandException {
switch (response.getCode()) {
case ResponseCode.FLUSH_DISK_TIMEOUT:
case ResponseCode.FLUSH_SLAVE_TIMEOUT:
case ResponseCode.SLAVE_NOT_AVAILABLE: {
- // TODO LOG
}
case ResponseCode.SUCCESS: {
SendStatus sendStatus = SendStatus.SEND_OK;
@@ -551,12 +551,12 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public PullResult pullMessage(//
- final String addr, //
- final PullMessageRequestHeader requestHeader, //
- final long timeoutMillis, //
- final CommunicationMode communicationMode, //
- final PullCallback pullCallback//
+ public PullResult pullMessage(
+ final String addr,
+ final PullMessageRequestHeader requestHeader,
+ final long timeoutMillis,
+ final CommunicationMode communicationMode,
+ final PullCallback pullCallback
) throws RemotingException, MQBrokerException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.PULL_MESSAGE, requestHeader);
@@ -577,11 +577,11 @@ public class MQClientAPIImpl {
return null;
}
- private void pullMessageAsync(//
- final String addr, // 1
- final RemotingCommand request, //
- final long timeoutMillis, //
- final PullCallback pullCallback//
+ private void pullMessageAsync(
+ final String addr,
+ final RemotingCommand request,
+ final long timeoutMillis,
+ final PullCallback pullCallback
) throws RemotingException, InterruptedException {
this.remotingClient.invokeAsync(addr, request, timeoutMillis, new InvokeCallback() {
@Override
@@ -609,17 +609,18 @@ public class MQClientAPIImpl {
});
}
- private PullResult pullMessageSync(//
- final String addr, // 1
- final RemotingCommand request, // 2
- final long timeoutMillis// 3
+ private PullResult pullMessageSync(
+ final String addr,
+ final RemotingCommand request,
+ final long timeoutMillis
) throws RemotingException, InterruptedException, MQBrokerException {
RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
assert response != null;
return this.processPullResponse(response);
}
- private PullResult processPullResponse(final RemotingCommand response) throws MQBrokerException, RemotingCommandException {
+ private PullResult processPullResponse(
+ final RemotingCommand response) throws MQBrokerException, RemotingCommandException {
PullStatus pullStatus = PullStatus.NO_NEW_MSG;
switch (response.getCode()) {
case ResponseCode.SUCCESS:
@@ -668,7 +669,8 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public long searchOffset(final String addr, final String topic, final int queueId, final long timestamp, final long timeoutMillis)
+ public long searchOffset(final String addr, final String topic, final int queueId, final long timestamp,
+ final long timeoutMillis)
throws RemotingException, MQBrokerException, InterruptedException {
SearchOffsetRequestHeader requestHeader = new SearchOffsetRequestHeader();
requestHeader.setTopic(topic);
@@ -716,9 +718,9 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public List getConsumerIdListByGroup(//
- final String addr, //
- final String consumerGroup, //
+ public List getConsumerIdListByGroup(
+ final String addr,
+ final String consumerGroup,
final long timeoutMillis) throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
MQBrokerException, InterruptedException {
GetConsumerListByGroupRequestHeader requestHeader = new GetConsumerListByGroupRequestHeader();
@@ -767,7 +769,8 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public long getEarliestMsgStoretime(final String addr, final String topic, final int queueId, final long timeoutMillis)
+ public long getEarliestMsgStoretime(final String addr, final String topic, final int queueId,
+ final long timeoutMillis)
throws RemotingException, MQBrokerException, InterruptedException {
GetEarliestMsgStoretimeRequestHeader requestHeader = new GetEarliestMsgStoretimeRequestHeader();
requestHeader.setTopic(topic);
@@ -791,10 +794,10 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public long queryConsumerOffset(//
- final String addr, //
- final QueryConsumerOffsetRequestHeader requestHeader, //
- final long timeoutMillis//
+ public long queryConsumerOffset(
+ final String addr,
+ final QueryConsumerOffsetRequestHeader requestHeader,
+ final long timeoutMillis
) throws RemotingException, MQBrokerException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.QUERY_CONSUMER_OFFSET, requestHeader);
@@ -815,10 +818,10 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public void updateConsumerOffset(//
- final String addr, //
- final UpdateConsumerOffsetRequestHeader requestHeader, //
- final long timeoutMillis//
+ public void updateConsumerOffset(
+ final String addr,
+ final UpdateConsumerOffsetRequestHeader requestHeader,
+ final long timeoutMillis
) throws RemotingException, MQBrokerException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_CONSUMER_OFFSET, requestHeader);
@@ -836,10 +839,10 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public void updateConsumerOffsetOneway(//
- final String addr, //
- final UpdateConsumerOffsetRequestHeader requestHeader, //
- final long timeoutMillis//
+ public void updateConsumerOffsetOneway(
+ final String addr,
+ final UpdateConsumerOffsetRequestHeader requestHeader,
+ final long timeoutMillis
) throws RemotingConnectException, RemotingTooMuchRequestException, RemotingTimeoutException, RemotingSendRequestException,
InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_CONSUMER_OFFSET, requestHeader);
@@ -847,10 +850,10 @@ public class MQClientAPIImpl {
this.remotingClient.invokeOneway(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr), request, timeoutMillis);
}
- public int sendHearbeat(//
- final String addr, //
- final HeartbeatData heartbeatData, //
- final long timeoutMillis//
+ public int sendHearbeat(
+ final String addr,
+ final HeartbeatData heartbeatData,
+ final long timeoutMillis
) throws RemotingException, MQBrokerException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.HEART_BEAT, null);
@@ -868,12 +871,12 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public void unregisterClient(//
- final String addr, //
- final String clientID, //
- final String producerGroup, //
- final String consumerGroup, //
- final long timeoutMillis//
+ public void unregisterClient(
+ final String addr,
+ final String clientID,
+ final String producerGroup,
+ final String consumerGroup,
+ final long timeoutMillis
) throws RemotingException, MQBrokerException, InterruptedException {
final UnregisterClientRequestHeader requestHeader = new UnregisterClientRequestHeader();
requestHeader.setClientID(clientID);
@@ -894,11 +897,11 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public void endTransactionOneway(//
- final String addr, //
- final EndTransactionRequestHeader requestHeader, //
- final String remark, //
- final long timeoutMillis//
+ public void endTransactionOneway(
+ final String addr,
+ final EndTransactionRequestHeader requestHeader,
+ final String remark,
+ final long timeoutMillis
) throws RemotingException, MQBrokerException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.END_TRANSACTION, requestHeader);
@@ -960,9 +963,9 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public Set lockBatchMQ(//
- final String addr, //
- final LockBatchRequestBody requestBody, //
+ public Set lockBatchMQ(
+ final String addr,
+ final LockBatchRequestBody requestBody,
final long timeoutMillis) throws RemotingException, MQBrokerException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.LOCK_BATCH_MQ, null);
@@ -982,11 +985,11 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public void unlockBatchMQ(//
- final String addr, //
- final UnlockBatchRequestBody requestBody, //
- final long timeoutMillis, //
- final boolean oneway//
+ public void unlockBatchMQ(
+ final String addr,
+ final UnlockBatchRequestBody requestBody,
+ final long timeoutMillis,
+ final boolean oneway
) throws RemotingException, MQBrokerException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UNLOCK_BATCH_MQ, null);
@@ -1009,7 +1012,8 @@ public class MQClientAPIImpl {
}
}
- public TopicStatsTable getTopicStatsInfo(final String addr, final String topic, final long timeoutMillis) throws InterruptedException,
+ public TopicStatsTable getTopicStatsInfo(final String addr, final String topic,
+ final long timeoutMillis) throws InterruptedException,
RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
GetTopicStatsInfoRequestHeader requestHeader = new GetTopicStatsInfoRequestHeader();
requestHeader.setTopic(topic);
@@ -1036,7 +1040,8 @@ public class MQClientAPIImpl {
return getConsumeStats(addr, consumerGroup, null, timeoutMillis);
}
- public ConsumeStats getConsumeStats(final String addr, final String consumerGroup, final String topic, final long timeoutMillis)
+ public ConsumeStats getConsumeStats(final String addr, final String consumerGroup, final String topic,
+ final long timeoutMillis)
throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException,
MQBrokerException {
GetConsumeStatsRequestHeader requestHeader = new GetConsumeStatsRequestHeader();
@@ -1059,7 +1064,8 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public ProducerConnection getProducerConnectionList(final String addr, final String producerGroup, final long timeoutMillis)
+ public ProducerConnection getProducerConnectionList(final String addr, final String producerGroup,
+ final long timeoutMillis)
throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException,
MQBrokerException {
GetProducerConnectionListRequestHeader requestHeader = new GetProducerConnectionListRequestHeader();
@@ -1080,7 +1086,8 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public ConsumerConnection getConsumerConnectionList(final String addr, final String consumerGroup, final long timeoutMillis)
+ public ConsumerConnection getConsumerConnectionList(final String addr, final String consumerGroup,
+ final long timeoutMillis)
throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException,
MQBrokerException {
GetConsumerConnectionListRequestHeader requestHeader = new GetConsumerConnectionListRequestHeader();
@@ -1160,7 +1167,8 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public ClusterInfo getBrokerClusterInfo(final long timeoutMillis) throws InterruptedException, RemotingTimeoutException,
+ public ClusterInfo getBrokerClusterInfo(
+ final long timeoutMillis) throws InterruptedException, RemotingTimeoutException,
RemotingSendRequestException, RemotingConnectException, MQBrokerException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_BROKER_CLUSTER_INFO, null);
@@ -1179,33 +1187,18 @@ public class MQClientAPIImpl {
public TopicRouteData getDefaultTopicRouteInfoFromNameServer(final String topic, final long timeoutMillis)
throws RemotingException, MQClientException, InterruptedException {
- GetRouteInfoRequestHeader requestHeader = new GetRouteInfoRequestHeader();
- requestHeader.setTopic(topic);
-
- RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ROUTEINTO_BY_TOPIC, requestHeader);
- RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
- assert response != null;
- switch (response.getCode()) {
- case ResponseCode.TOPIC_NOT_EXIST: {
- // TODO LOG
- break;
- }
- case ResponseCode.SUCCESS: {
- byte[] body = response.getBody();
- if (body != null) {
- return TopicRouteData.decode(body, TopicRouteData.class);
- }
- }
- default:
- break;
- }
-
- throw new MQClientException(response.getCode(), response.getRemark());
+ return getTopicRouteInfoFromNameServer(topic, timeoutMillis, false);
}
public TopicRouteData getTopicRouteInfoFromNameServer(final String topic, final long timeoutMillis)
throws RemotingException, MQClientException, InterruptedException {
+
+ return getTopicRouteInfoFromNameServer(topic, timeoutMillis, true);
+ }
+
+ public TopicRouteData getTopicRouteInfoFromNameServer(final String topic, final long timeoutMillis,
+ boolean allowTopicNotExist) throws MQClientException, InterruptedException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException {
GetRouteInfoRequestHeader requestHeader = new GetRouteInfoRequestHeader();
requestHeader.setTopic(topic);
@@ -1215,8 +1208,10 @@ public class MQClientAPIImpl {
assert response != null;
switch (response.getCode()) {
case ResponseCode.TOPIC_NOT_EXIST: {
- if (!topic.equals(MixAll.DEFAULT_TOPIC))
+ if (allowTopicNotExist && !topic.equals(MixAll.DEFAULT_TOPIC)) {
log.warn("get Topic [{}] RouteInfoFromNameServer is not exist value", topic);
+ }
+
break;
}
case ResponseCode.SUCCESS: {
@@ -1252,7 +1247,8 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public int wipeWritePermOfBroker(final String namesrvAddr, String brokerName, final long timeoutMillis) throws RemotingCommandException,
+ public int wipeWritePermOfBroker(final String namesrvAddr, String brokerName,
+ final long timeoutMillis) throws RemotingCommandException,
RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQClientException {
WipeWritePermOfBrokerRequestHeader requestHeader = new WipeWritePermOfBrokerRequestHeader();
requestHeader.setBrokerName(brokerName);
@@ -1471,8 +1467,10 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public Map> invokeBrokerToGetConsumerStatus(final String addr, final String topic, final String group,
- final String clientAddr, final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
+ public Map> invokeBrokerToGetConsumerStatus(final String addr, final String topic,
+ final String group,
+ final String clientAddr,
+ final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
GetConsumerStatusRequestHeader requestHeader = new GetConsumerStatusRequestHeader();
requestHeader.setTopic(topic);
requestHeader.setGroup(group);
@@ -1519,7 +1517,8 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public List queryConsumeTimeSpan(final String addr, final String topic, final String group, final long timeoutMillis)
+ public List queryConsumeTimeSpan(final String addr, final String topic, final String group,
+ final long timeoutMillis)
throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException,
MQBrokerException {
QueryConsumeTimeSpanRequestHeader requestHeader = new QueryConsumeTimeSpanRequestHeader();
@@ -1565,12 +1564,12 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public void registerMessageFilterClass(final String addr, //
- final String consumerGroup, //
- final String topic, //
- final String className, //
- final int classCRC, //
- final byte[] classBody, //
+ public void registerMessageFilterClass(final String addr,
+ final String consumerGroup,
+ final String topic,
+ final String className,
+ final int classCRC,
+ final byte[] classBody,
final long timeoutMillis) throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
InterruptedException, MQBrokerException {
RegisterMessageFilterClassRequestHeader requestHeader = new RegisterMessageFilterClassRequestHeader();
@@ -1593,7 +1592,8 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public TopicList getSystemTopicList(final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
+ public TopicList getSystemTopicList(
+ final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_SYSTEM_TOPIC_LIST_FROM_NS, null);
RemotingCommand response = this.remotingClient.invokeSync(null, request, timeoutMillis);
@@ -1642,7 +1642,8 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public boolean cleanExpiredConsumeQueue(final String addr, long timeoutMillis) throws MQClientException, RemotingConnectException,
+ public boolean cleanExpiredConsumeQueue(final String addr,
+ long timeoutMillis) throws MQClientException, RemotingConnectException,
RemotingSendRequestException, RemotingTimeoutException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.CLEAN_EXPIRED_CONSUMEQUEUE, null);
RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr),
@@ -1658,7 +1659,8 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public boolean cleanUnusedTopicByAddr(final String addr, long timeoutMillis) throws MQClientException, RemotingConnectException,
+ public boolean cleanUnusedTopicByAddr(final String addr,
+ long timeoutMillis) throws MQClientException, RemotingConnectException,
RemotingSendRequestException, RemotingTimeoutException, InterruptedException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.CLEAN_UNUSED_TOPIC, null);
RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr),
@@ -1674,7 +1676,8 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public ConsumerRunningInfo getConsumerRunningInfo(final String addr, String consumerGroup, String clientId, boolean jstack,
+ public ConsumerRunningInfo getConsumerRunningInfo(final String addr, String consumerGroup, String clientId,
+ boolean jstack,
final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
GetConsumerRunningInfoRequestHeader requestHeader = new GetConsumerRunningInfoRequestHeader();
requestHeader.setConsumerGroup(consumerGroup);
@@ -1701,10 +1704,10 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public ConsumeMessageDirectlyResult consumeMessageDirectly(final String addr, //
- String consumerGroup, //
- String clientId, //
- String msgId, //
+ public ConsumeMessageDirectlyResult consumeMessageDirectly(final String addr,
+ String consumerGroup,
+ String clientId,
+ String msgId,
final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
ConsumeMessageDirectlyResultRequestHeader requestHeader = new ConsumeMessageDirectlyResultRequestHeader();
requestHeader.setConsumerGroup(consumerGroup);
@@ -1731,7 +1734,8 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public Map queryCorrectionOffset(final String addr, final String topic, final String group, Set filterGroup,
+ public Map queryCorrectionOffset(final String addr, final String topic, final String group,
+ Set filterGroup,
long timeoutMillis) throws MQClientException, RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
InterruptedException {
QueryCorrectionOffsetHeader requestHeader = new QueryCorrectionOffsetHeader();
@@ -1854,7 +1858,8 @@ public class MQClientAPIImpl {
}
public void cloneGroupOffset(final String addr, final String srcGroup, final String destGroup, final String topic,
- final boolean isOffline, final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
+ final boolean isOffline,
+ final long timeoutMillis) throws RemotingException, MQClientException, InterruptedException {
CloneGroupOffsetRequestHeader requestHeader = new CloneGroupOffsetRequestHeader();
requestHeader.setSrcGroup(srcGroup);
requestHeader.setDestGroup(destGroup);
@@ -1902,13 +1907,14 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public Set getClusterList(String topic, long timeoutMillis) throws MQClientException, RemotingConnectException,
+ public Set getClusterList(String topic,
+ long timeoutMillis) throws MQClientException, RemotingConnectException,
RemotingSendRequestException, RemotingTimeoutException, InterruptedException {
- // todo:jodie
return Collections.EMPTY_SET;
}
- public ConsumeStatsList fetchConsumeStatsInBroker(String brokerAddr, boolean isOrder, long timeoutMillis) throws MQClientException,
+ public ConsumeStatsList fetchConsumeStatsInBroker(String brokerAddr, boolean isOrder,
+ long timeoutMillis) throws MQClientException,
RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException {
GetConsumeStatsInBrokerHeader requestHeader = new GetConsumeStatsInBrokerHeader();
requestHeader.setIsOrder(isOrder);
@@ -1932,7 +1938,8 @@ public class MQClientAPIImpl {
throw new MQClientException(response.getCode(), response.getRemark());
}
- public SubscriptionGroupWrapper getAllSubscriptionGroup(final String brokerAddr, long timeoutMillis) throws InterruptedException,
+ public SubscriptionGroupWrapper getAllSubscriptionGroup(final String brokerAddr,
+ long timeoutMillis) throws InterruptedException,
RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_SUBSCRIPTIONGROUP_CONFIG, null);
RemotingCommand response = this.remotingClient
@@ -1948,7 +1955,8 @@ public class MQClientAPIImpl {
throw new MQBrokerException(response.getCode(), response.getRemark());
}
- public TopicConfigSerializeWrapper getAllTopicConfig(final String addr, long timeoutMillis) throws RemotingConnectException,
+ public TopicConfigSerializeWrapper getAllTopicConfig(final String addr,
+ long timeoutMillis) throws RemotingConnectException,
RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQBrokerException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, null);
@@ -2028,9 +2036,10 @@ public class MQClientAPIImpl {
return configMap;
}
- public QueryConsumeQueueResponseBody queryConsumeQueue(final String brokerAddr, final String topic, final int queueId,
- final long index, final int count, final String consumerGroup,
- final long timeoutMillis) throws InterruptedException,
+ public QueryConsumeQueueResponseBody queryConsumeQueue(final String brokerAddr, final String topic,
+ final int queueId,
+ final long index, final int count, final String consumerGroup,
+ final long timeoutMillis) throws InterruptedException,
RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQClientException {
QueryConsumeQueueRequestHeader requestHeader = new QueryConsumeQueueRequestHeader();
@@ -2054,8 +2063,8 @@ public class MQClientAPIImpl {
}
public void checkClientInBroker(final String brokerAddr, final String consumerGroup,
- final String clientId, final SubscriptionData subscriptionData,
- final long timeoutMillis)
+ final String clientId, final SubscriptionData subscriptionData,
+ final long timeoutMillis)
throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException,
RemotingConnectException, MQClientException {
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.CHECK_CLIENT_CONFIG, null);
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java
index f566ed0fcca4781d0eb7cca0b62ad059d286cc0f..961e062bb548e075c46832b75a693b83701f1e38 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java
@@ -69,12 +69,12 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
this.consumerGroup = this.defaultMQPushConsumer.getConsumerGroup();
this.consumeRequestQueue = new LinkedBlockingQueue();
- this.consumeExecutor = new ThreadPoolExecutor(//
- this.defaultMQPushConsumer.getConsumeThreadMin(), //
- this.defaultMQPushConsumer.getConsumeThreadMax(), //
- 1000 * 60, //
- TimeUnit.MILLISECONDS, //
- this.consumeRequestQueue, //
+ this.consumeExecutor = new ThreadPoolExecutor(
+ this.defaultMQPushConsumer.getConsumeThreadMin(),
+ this.defaultMQPushConsumer.getConsumeThreadMax(),
+ 1000 * 60,
+ TimeUnit.MILLISECONDS,
+ this.consumeRequestQueue,
new ThreadFactoryImpl("ConsumeMessageThread_"));
this.scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryImpl("ConsumeMessageScheduledThread_"));
@@ -100,8 +100,8 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
@Override
public void updateCorePoolSize(int corePoolSize) {
- if (corePoolSize > 0 //
- && corePoolSize <= Short.MAX_VALUE //
+ if (corePoolSize > 0
+ && corePoolSize <= Short.MAX_VALUE
&& corePoolSize < this.defaultMQPushConsumer.getConsumeThreadMax()) {
this.consumeExecutor.setCorePoolSize(corePoolSize);
}
@@ -115,11 +115,10 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
// this.consumeExecutor.setCorePoolSize(this.consumeExecutor.getCorePoolSize()
// + 1);
// }
- //
// log.info("incCorePoolSize Concurrently from {} to {}, ConsumerGroup:
- // {}", //
- // corePoolSize,//
- // this.consumeExecutor.getCorePoolSize(),//
+ // {}",
+ // corePoolSize,
+ // this.consumeExecutor.getCorePoolSize(),
// this.consumerGroup);
}
@@ -131,11 +130,10 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
// this.consumeExecutor.setCorePoolSize(this.consumeExecutor.getCorePoolSize()
// - 1);
// }
- //
// log.info("decCorePoolSize Concurrently from {} to {}, ConsumerGroup:
- // {}", //
- // corePoolSize,//
- // this.consumeExecutor.getCorePoolSize(),//
+ // {}",
+ // corePoolSize,
+ // this.consumeExecutor.getCorePoolSize(),
// this.consumerGroup);
}
@@ -185,10 +183,10 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
result.setRemark(RemotingHelper.exceptionSimpleDesc(e));
- log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s", //
- RemotingHelper.exceptionSimpleDesc(e), //
- ConsumeMessageConcurrentlyService.this.consumerGroup, //
- msgs, //
+ log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s",
+ RemotingHelper.exceptionSimpleDesc(e),
+ ConsumeMessageConcurrentlyService.this.consumerGroup,
+ msgs,
mq), e);
}
@@ -200,10 +198,10 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
}
@Override
- public void submitConsumeRequest(//
- final List msgs, //
- final ProcessQueue processQueue, //
- final MessageQueue messageQueue, //
+ public void submitConsumeRequest(
+ final List msgs,
+ final ProcessQueue processQueue,
+ final MessageQueue messageQueue,
final boolean dispatchToConsume) {
final int consumeBatchSize = this.defaultMQPushConsumer.getConsumeMessageBatchMaxSize();
if (msgs.size() <= consumeBatchSize) {
@@ -258,10 +256,10 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
}
}
- public void processConsumeResult(//
- final ConsumeConcurrentlyStatus status, //
- final ConsumeConcurrentlyContext context, //
- final ConsumeRequest consumeRequest//
+ public void processConsumeResult(
+ final ConsumeConcurrentlyStatus status,
+ final ConsumeConcurrentlyContext context,
+ final ConsumeRequest consumeRequest
) {
int ackIndex = context.getAckIndex();
@@ -338,10 +336,10 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
return false;
}
- private void submitConsumeRequestLater(//
- final List msgs, //
- final ProcessQueue processQueue, //
- final MessageQueue messageQueue//
+ private void submitConsumeRequestLater(
+ final List msgs,
+ final ProcessQueue processQueue,
+ final MessageQueue messageQueue
) {
this.scheduledExecutorService.schedule(new Runnable() {
@@ -353,7 +351,7 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
}, 5000, TimeUnit.MILLISECONDS);
}
- private void submitConsumeRequestLater(final ConsumeRequest consumeRequest//
+ private void submitConsumeRequestLater(final ConsumeRequest consumeRequest
) {
this.scheduledExecutorService.schedule(new Runnable() {
@@ -419,7 +417,7 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService
status = listener.consumeMessage(Collections.unmodifiableList(msgs), context);
} catch (Throwable e) {
log.warn("consumeMessage exception: {} Group: {} Msgs: {} MQ: {}",
- RemotingHelper.exceptionSimpleDesc(e), //
+ RemotingHelper.exceptionSimpleDesc(e),
ConsumeMessageConcurrentlyService.this.consumerGroup,
msgs,
messageQueue);
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java
index 1fa474caa1d256920ee7aa2ff23ef87ef1a5990a..27b02da3bbcd4e0407f070605b3e76fad1ca1054 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java
@@ -62,7 +62,8 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
private final ScheduledExecutorService scheduledExecutorService;
private volatile boolean stopped = false;
- public ConsumeMessageOrderlyService(DefaultMQPushConsumerImpl defaultMQPushConsumerImpl, MessageListenerOrderly messageListener) {
+ public ConsumeMessageOrderlyService(DefaultMQPushConsumerImpl defaultMQPushConsumerImpl,
+ MessageListenerOrderly messageListener) {
this.defaultMQPushConsumerImpl = defaultMQPushConsumerImpl;
this.messageListener = messageListener;
@@ -70,12 +71,12 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
this.consumerGroup = this.defaultMQPushConsumer.getConsumerGroup();
this.consumeRequestQueue = new LinkedBlockingQueue();
- this.consumeExecutor = new ThreadPoolExecutor(//
- this.defaultMQPushConsumer.getConsumeThreadMin(), //
- this.defaultMQPushConsumer.getConsumeThreadMax(), //
- 1000 * 60, //
- TimeUnit.MILLISECONDS, //
- this.consumeRequestQueue, //
+ this.consumeExecutor = new ThreadPoolExecutor(
+ this.defaultMQPushConsumer.getConsumeThreadMin(),
+ this.defaultMQPushConsumer.getConsumeThreadMax(),
+ 1000 * 60,
+ TimeUnit.MILLISECONDS,
+ this.consumeRequestQueue,
new ThreadFactoryImpl("ConsumeMessageThread_"));
this.scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryImpl("ConsumeMessageScheduledThread_"));
@@ -107,8 +108,8 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
@Override
public void updateCorePoolSize(int corePoolSize) {
- if (corePoolSize > 0 //
- && corePoolSize <= Short.MAX_VALUE //
+ if (corePoolSize > 0
+ && corePoolSize <= Short.MAX_VALUE
&& corePoolSize < this.defaultMQPushConsumer.getConsumeThreadMax()) {
this.consumeExecutor.setCorePoolSize(corePoolSize);
}
@@ -171,10 +172,10 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
result.setRemark(RemotingHelper.exceptionSimpleDesc(e));
- log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s", //
- RemotingHelper.exceptionSimpleDesc(e), //
- ConsumeMessageOrderlyService.this.consumerGroup, //
- msgs, //
+ log.warn(String.format("consumeMessageDirectly exception: %s Group: %s Msgs: %s MQ: %s",
+ RemotingHelper.exceptionSimpleDesc(e),
+ ConsumeMessageOrderlyService.this.consumerGroup,
+ msgs,
mq), e);
}
@@ -187,10 +188,10 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
}
@Override
- public void submitConsumeRequest(//
- final List msgs, //
- final ProcessQueue processQueue, //
- final MessageQueue messageQueue, //
+ public void submitConsumeRequest(
+ final List msgs,
+ final ProcessQueue processQueue,
+ final MessageQueue messageQueue,
final boolean dispathToConsume) {
if (dispathToConsume) {
ConsumeRequest consumeRequest = new ConsumeRequest(processQueue, messageQueue);
@@ -204,7 +205,8 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
}
}
- public void tryLockLaterAndReconsume(final MessageQueue mq, final ProcessQueue processQueue, final long delayMills) {
+ public void tryLockLaterAndReconsume(final MessageQueue mq, final ProcessQueue processQueue,
+ final long delayMills) {
this.scheduledExecutorService.schedule(new Runnable() {
@Override
public void run() {
@@ -226,10 +228,10 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
return false;
}
- private void submitConsumeRequestLater(//
- final ProcessQueue processQueue, //
- final MessageQueue messageQueue, //
- final long suspendTimeMillis//
+ private void submitConsumeRequestLater(
+ final ProcessQueue processQueue,
+ final MessageQueue messageQueue,
+ final long suspendTimeMillis
) {
long timeMillis = suspendTimeMillis;
if (timeMillis == -1) {
@@ -251,11 +253,11 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
}, timeMillis, TimeUnit.MILLISECONDS);
}
- public boolean processConsumeResult(//
- final List msgs, //
- final ConsumeOrderlyStatus status, //
- final ConsumeOrderlyContext context, //
- final ConsumeRequest consumeRequest//
+ public boolean processConsumeResult(
+ final List msgs,
+ final ConsumeOrderlyStatus status,
+ final ConsumeOrderlyContext context,
+ final ConsumeRequest consumeRequest
) {
boolean continueConsume = true;
long commitOffset = -1L;
@@ -273,9 +275,9 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
this.getConsumerStatsManager().incConsumeFailedTPS(consumerGroup, consumeRequest.getMessageQueue().getTopic(), msgs.size());
if (checkReconsumeTimes(msgs)) {
consumeRequest.getProcessQueue().makeMessageToCosumeAgain(msgs);
- this.submitConsumeRequestLater(//
- consumeRequest.getProcessQueue(), //
- consumeRequest.getMessageQueue(), //
+ this.submitConsumeRequestLater(
+ consumeRequest.getProcessQueue(),
+ consumeRequest.getMessageQueue(),
context.getSuspendCurrentQueueTimeMillis());
continueConsume = false;
} else {
@@ -295,9 +297,9 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
break;
case ROLLBACK:
consumeRequest.getProcessQueue().rollback();
- this.submitConsumeRequestLater(//
- consumeRequest.getProcessQueue(), //
- consumeRequest.getMessageQueue(), //
+ this.submitConsumeRequestLater(
+ consumeRequest.getProcessQueue(),
+ consumeRequest.getMessageQueue(),
context.getSuspendCurrentQueueTimeMillis());
continueConsume = false;
break;
@@ -305,9 +307,9 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
this.getConsumerStatsManager().incConsumeFailedTPS(consumerGroup, consumeRequest.getMessageQueue().getTopic(), msgs.size());
if (checkReconsumeTimes(msgs)) {
consumeRequest.getProcessQueue().makeMessageToCosumeAgain(msgs);
- this.submitConsumeRequestLater(//
- consumeRequest.getProcessQueue(), //
- consumeRequest.getMessageQueue(), //
+ this.submitConsumeRequestLater(
+ consumeRequest.getProcessQueue(),
+ consumeRequest.getMessageQueue(),
context.getSuspendCurrentQueueTimeMillis());
continueConsume = false;
}
@@ -468,22 +470,22 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
status = messageListener.consumeMessage(Collections.unmodifiableList(msgs), context);
} catch (Throwable e) {
- log.warn("consumeMessage exception: {} Group: {} Msgs: {} MQ: {}", //
- RemotingHelper.exceptionSimpleDesc(e), //
- ConsumeMessageOrderlyService.this.consumerGroup, //
- msgs, //
+ log.warn("consumeMessage exception: {} Group: {} Msgs: {} MQ: {}",
+ RemotingHelper.exceptionSimpleDesc(e),
+ ConsumeMessageOrderlyService.this.consumerGroup,
+ msgs,
messageQueue);
hasException = true;
} finally {
this.processQueue.getLockConsume().unlock();
}
- if (null == status //
- || ConsumeOrderlyStatus.ROLLBACK == status//
+ if (null == status
+ || ConsumeOrderlyStatus.ROLLBACK == status
|| ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT == status) {
- log.warn("consumeMessage Orderly return not OK, Group: {} Msgs: {} MQ: {}", //
- ConsumeMessageOrderlyService.this.consumerGroup, //
- msgs, //
+ log.warn("consumeMessage Orderly return not OK, Group: {} Msgs: {} MQ: {}",
+ ConsumeMessageOrderlyService.this.consumerGroup,
+ msgs,
messageQueue);
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageService.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageService.java
index 8742191b59d534427a3d90ca33eea14686b8d4b9..0f6f3bb38af6d22e02044bdaa738d2a8d45c2e8c 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageService.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageService.java
@@ -36,9 +36,9 @@ public interface ConsumeMessageService {
ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg, final String brokerName);
- void submitConsumeRequest(//
- final List msgs, //
- final ProcessQueue processQueue, //
- final MessageQueue messageQueue, //
+ void submitConsumeRequest(
+ final List msgs,
+ final ProcessQueue processQueue,
+ final MessageQueue messageQueue,
final boolean dispathToConsume);
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java
index 35ee16fe3b3a36f8cb02465ccf0a7cb85574d360..8640d2d6b526b900317a8820011f164bee6dedef 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java
@@ -97,8 +97,8 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
private void makeSureStateOK() throws MQClientException {
if (this.serviceState != ServiceState.RUNNING) {
- throw new MQClientException("The consumer service state not OK, "//
- + this.serviceState//
+ throw new MQClientException("The consumer service state not OK, "
+ + this.serviceState
+ FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK),
null);
}
@@ -185,7 +185,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
SubscriptionData subscriptionData;
try {
- subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(), //
+ subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(),
mq.getTopic(), subExpression);
} catch (Exception e) {
throw new MQClientException("parse subscription error", e);
@@ -193,18 +193,18 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
long timeoutMillis = block ? this.defaultMQPullConsumer.getConsumerTimeoutMillisWhenSuspend() : timeout;
- PullResult pullResult = this.pullAPIWrapper.pullKernelImpl(//
- mq, // 1
- subscriptionData.getSubString(), // 2
- 0L, // 3
- offset, // 4
- maxNums, // 5
- sysFlag, // 6
- 0, // 7
- this.defaultMQPullConsumer.getBrokerSuspendMaxTimeMillis(), // 8
- timeoutMillis, // 9
- CommunicationMode.SYNC, // 10
- null// 11
+ PullResult pullResult = this.pullAPIWrapper.pullKernelImpl(
+ mq,
+ subscriptionData.getSubString(),
+ 0L,
+ offset,
+ maxNums,
+ sysFlag,
+ 0,
+ this.defaultMQPullConsumer.getBrokerSuspendMaxTimeMillis(),
+ timeoutMillis,
+ CommunicationMode.SYNC,
+ null
);
this.pullAPIWrapper.processPullResult(mq, pullResult, subscriptionData);
if (!this.consumeMessageHookList.isEmpty()) {
@@ -225,7 +225,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
public void subscriptionAutomatically(final String topic) {
if (!this.rebalanceImpl.getSubscriptionInner().containsKey(topic)) {
try {
- SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(), //
+ SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(),
topic, SubscriptionData.SUB_ALL);
this.rebalanceImpl.subscriptionInner.putIfAbsent(topic, subscriptionData);
} catch (Exception ignore) {
@@ -372,13 +372,13 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
this.pullAsyncImpl(mq, subExpression, offset, maxNums, pullCallback, false, timeout);
}
- private void pullAsyncImpl(//
- final MessageQueue mq, //
- final String subExpression, //
- final long offset, //
- final int maxNums, //
- final PullCallback pullCallback, //
- final boolean block, //
+ private void pullAsyncImpl(
+ final MessageQueue mq,
+ final String subExpression,
+ final long offset,
+ final int maxNums,
+ final PullCallback pullCallback,
+ final boolean block,
final long timeout) throws MQClientException, RemotingException, InterruptedException {
this.makeSureStateOK();
@@ -405,7 +405,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
final SubscriptionData subscriptionData;
try {
- subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(), //
+ subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(),
mq.getTopic(), subExpression);
} catch (Exception e) {
throw new MQClientException("parse subscription error", e);
@@ -413,17 +413,17 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
long timeoutMillis = block ? this.defaultMQPullConsumer.getConsumerTimeoutMillisWhenSuspend() : timeout;
- this.pullAPIWrapper.pullKernelImpl(//
- mq, // 1
- subscriptionData.getSubString(), // 2
- 0L, // 3
- offset, // 4
- maxNums, // 5
- sysFlag, // 6
- 0, // 7
- this.defaultMQPullConsumer.getBrokerSuspendMaxTimeMillis(), // 8
- timeoutMillis, // 9
- CommunicationMode.ASYNC, // 10
+ this.pullAPIWrapper.pullKernelImpl(
+ mq,
+ subscriptionData.getSubString(),
+ 0L,
+ offset,
+ maxNums,
+ sysFlag,
+ 0,
+ this.defaultMQPullConsumer.getBrokerSuspendMaxTimeMillis(),
+ timeoutMillis,
+ CommunicationMode.ASYNC,
new PullCallback() {
@Override
@@ -551,8 +551,8 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
this.rebalanceImpl.setAllocateMessageQueueStrategy(this.defaultMQPullConsumer.getAllocateMessageQueueStrategy());
this.rebalanceImpl.setmQClientFactory(this.mQClientFactory);
- this.pullAPIWrapper = new PullAPIWrapper(//
- mQClientFactory, //
+ this.pullAPIWrapper = new PullAPIWrapper(
+ mQClientFactory,
this.defaultMQPullConsumer.getConsumerGroup(), isUnitMode());
this.pullAPIWrapper.registerFilterMessageHook(filterMessageHookList);
@@ -589,8 +589,8 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
case RUNNING:
case START_FAILED:
case SHUTDOWN_ALREADY:
- throw new MQClientException("The PullConsumer service state not OK, maybe started once, "//
- + this.serviceState//
+ throw new MQClientException("The PullConsumer service state not OK, maybe started once, "
+ + this.serviceState
+ FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK),
null);
default:
@@ -606,42 +606,42 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
// consumerGroup
if (null == this.defaultMQPullConsumer.getConsumerGroup()) {
throw new MQClientException(
- "consumerGroup is null" //
- + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL), //
+ "consumerGroup is null"
+ + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),
null);
}
// consumerGroup
if (this.defaultMQPullConsumer.getConsumerGroup().equals(MixAll.DEFAULT_CONSUMER_GROUP)) {
throw new MQClientException(
- "consumerGroup can not equal "//
- + MixAll.DEFAULT_CONSUMER_GROUP //
- + ", please specify another one."//
- + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL), //
+ "consumerGroup can not equal "
+ + MixAll.DEFAULT_CONSUMER_GROUP
+ + ", please specify another one."
+ + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),
null);
}
// messageModel
if (null == this.defaultMQPullConsumer.getMessageModel()) {
throw new MQClientException(
- "messageModel is null" //
- + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL), //
+ "messageModel is null"
+ + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),
null);
}
// allocateMessageQueueStrategy
if (null == this.defaultMQPullConsumer.getAllocateMessageQueueStrategy()) {
throw new MQClientException(
- "allocateMessageQueueStrategy is null" //
- + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL), //
+ "allocateMessageQueueStrategy is null"
+ + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),
null);
}
// allocateMessageQueueStrategy
if (this.defaultMQPullConsumer.getConsumerTimeoutMillisWhenSuspend() < this.defaultMQPullConsumer.getBrokerSuspendMaxTimeMillis()) {
throw new MQClientException(
- "Long polling mode, the consumer consumerTimeoutMillisWhenSuspend must greater than brokerSuspendMaxTimeMillis" //
- + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL), //
+ "Long polling mode, the consumer consumerTimeoutMillisWhenSuspend must greater than brokerSuspendMaxTimeMillis"
+ + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL),
null);
}
}
@@ -651,7 +651,7 @@ public class DefaultMQPullConsumerImpl implements MQConsumerInner {
Set registerTopics = this.defaultMQPullConsumer.getRegisterTopics();
if (registerTopics != null) {
for (final String topic : registerTopics) {
- SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(), //
+ SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(),
topic, SubscriptionData.SUB_ALL);
this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java
index 9bf34be8cdf3e9db713982f2edf40fd7c9b8e3b2..7eda7c1b51b23b6cb71a86c9f887a32f4ee9735f 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java
@@ -297,10 +297,10 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
pullRequest.getMessageQueue().getTopic(), pullResult.getMsgFoundList().size());
boolean dispathToConsume = processQueue.putMessage(pullResult.getMsgFoundList());
- DefaultMQPushConsumerImpl.this.consumeMessageService.submitConsumeRequest(//
- pullResult.getMsgFoundList(), //
- processQueue, //
- pullRequest.getMessageQueue(), //
+ DefaultMQPushConsumerImpl.this.consumeMessageService.submitConsumeRequest(
+ pullResult.getMsgFoundList(),
+ processQueue,
+ pullRequest.getMessageQueue(),
dispathToConsume);
if (DefaultMQPushConsumerImpl.this.defaultMQPushConsumer.getPullInterval() > 0) {
@@ -311,12 +311,12 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
}
}
- if (pullResult.getNextBeginOffset() < prevRequestOffset//
+ if (pullResult.getNextBeginOffset() < prevRequestOffset
|| firstMsgOffset < prevRequestOffset) {
log.warn(
- "[BUG] pull message result maybe data wrong, nextBeginOffset: {} firstMsgOffset: {} prevRequestOffset: {}", //
- pullResult.getNextBeginOffset(), //
- firstMsgOffset, //
+ "[BUG] pull message result maybe data wrong, nextBeginOffset: {} firstMsgOffset: {} prevRequestOffset: {}",
+ pullResult.getNextBeginOffset(),
+ firstMsgOffset,
prevRequestOffset);
}
@@ -336,7 +336,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
DefaultMQPushConsumerImpl.this.executePullRequestImmediately(pullRequest);
break;
case OFFSET_ILLEGAL:
- log.warn("the pull request offset illegal, {} {}", //
+ log.warn("the pull request offset illegal, {} {}",
pullRequest.toString(), pullResult.toString());
pullRequest.setNextOffset(pullResult.getNextBeginOffset());
@@ -396,26 +396,26 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
classFilter = sd.isClassFilterMode();
}
- int sysFlag = PullSysFlag.buildSysFlag(//
+ int sysFlag = PullSysFlag.buildSysFlag(
commitOffsetEnable, // commitOffset
true, // suspend
subExpression != null, // subscription
classFilter // class filter
);
try {
- this.pullAPIWrapper.pullKernelImpl(//
- pullRequest.getMessageQueue(), // 1
- subExpression, // 2
- subscriptionData.getExpressionType(), // 3
- subscriptionData.getSubVersion(), // 4
- pullRequest.getNextOffset(), // 5
- this.defaultMQPushConsumer.getPullBatchSize(), // 6
- sysFlag, // 7
- commitOffsetValue, // 8
- BROKER_SUSPEND_MAX_TIME_MILLIS, // 9
- CONSUMER_TIMEOUT_MILLIS_WHEN_SUSPEND, // 10
- CommunicationMode.ASYNC, // 11
- pullCallback // 12
+ this.pullAPIWrapper.pullKernelImpl(
+ pullRequest.getMessageQueue(),
+ subExpression,
+ subscriptionData.getExpressionType(),
+ subscriptionData.getSubVersion(),
+ pullRequest.getNextOffset(),
+ this.defaultMQPushConsumer.getPullBatchSize(),
+ sysFlag,
+ commitOffsetValue,
+ BROKER_SUSPEND_MAX_TIME_MILLIS,
+ CONSUMER_TIMEOUT_MILLIS_WHEN_SUSPEND,
+ CommunicationMode.ASYNC,
+ pullCallback
);
} catch (Exception e) {
log.error("pullKernelImpl exception", e);
@@ -425,8 +425,8 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
private void makeSureStateOK() throws MQClientException {
if (this.serviceState != ServiceState.RUNNING) {
- throw new MQClientException("The consumer service state not OK, "//
- + this.serviceState//
+ throw new MQClientException("The consumer service state not OK, "
+ + this.serviceState
+ FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK),
null);
}
@@ -608,8 +608,8 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
case RUNNING:
case START_FAILED:
case SHUTDOWN_ALREADY:
- throw new MQClientException("The PushConsumer service state not OK, maybe started once, "//
- + this.serviceState//
+ throw new MQClientException("The PushConsumer service state not OK, maybe started once, "
+ + this.serviceState
+ FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK),
null);
default:
@@ -764,7 +764,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
for (final Map.Entry entry : sub.entrySet()) {
final String topic = entry.getKey();
final String subString = entry.getValue();
- SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), //
+ SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(),
topic, subString);
this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
}
@@ -779,7 +779,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
break;
case CLUSTERING:
final String retryTopic = MixAll.getRetryTopic(this.defaultMQPushConsumer.getConsumerGroup());
- SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), //
+ SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(),
retryTopic, SubscriptionData.SUB_ALL);
this.rebalanceImpl.getSubscriptionInner().put(retryTopic, subscriptionData);
break;
@@ -811,7 +811,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
public void subscribe(String topic, String subExpression) throws MQClientException {
try {
- SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), //
+ SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(),
topic, subExpression);
this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
if (this.mQClientFactory != null) {
@@ -824,7 +824,7 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException {
try {
- SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), //
+ SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(),
topic, "*");
subscriptionData.setSubString(fullClassName);
subscriptionData.setClassFilterMode(true);
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
index 634e0f0e51b61b5b23e98fcfdfb8286ae857d334..b555771c1418a921d800e49a2fcb7646f68fa61b 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java
@@ -55,7 +55,8 @@ public abstract class RebalanceImpl {
protected AllocateMessageQueueStrategy allocateMessageQueueStrategy;
protected MQClientInstance mQClientFactory;
- public RebalanceImpl(String consumerGroup, MessageModel messageModel, AllocateMessageQueueStrategy allocateMessageQueueStrategy,
+ public RebalanceImpl(String consumerGroup, MessageModel messageModel,
+ AllocateMessageQueueStrategy allocateMessageQueueStrategy,
MQClientInstance mQClientFactory) {
this.consumerGroup = consumerGroup;
this.messageModel = messageModel;
@@ -73,9 +74,9 @@ public abstract class RebalanceImpl {
try {
this.mQClientFactory.getMQClientAPIImpl().unlockBatchMQ(findBrokerResult.getBrokerAddr(), requestBody, 1000, oneway);
- log.warn("unlock messageQueue. group:{}, clientId:{}, mq:{}", //
- this.consumerGroup, //
- this.mQClientFactory.getClientId(), //
+ log.warn("unlock messageQueue. group:{}, clientId:{}, mq:{}",
+ this.consumerGroup,
+ this.mQClientFactory.getClientId(),
mq);
} catch (Exception e) {
log.error("unlockBatchMQ exception, " + mq, e);
@@ -245,10 +246,10 @@ public abstract class RebalanceImpl {
boolean changed = this.updateProcessQueueTableInRebalance(topic, mqSet, isOrder);
if (changed) {
this.messageQueueChanged(topic, mqSet, mqSet);
- log.info("messageQueueChanged {} {} {} {}", //
- consumerGroup, //
- topic, //
- mqSet, //
+ log.info("messageQueueChanged {} {} {} {}",
+ consumerGroup,
+ topic,
+ mqSet,
mqSet);
}
} else {
@@ -280,10 +281,10 @@ public abstract class RebalanceImpl {
List allocateResult = null;
try {
- allocateResult = strategy.allocate(//
- this.consumerGroup, //
- this.mQClientFactory.getClientId(), //
- mqAll, //
+ allocateResult = strategy.allocate(
+ this.consumerGroup,
+ this.mQClientFactory.getClientId(),
+ mqAll,
cidAll);
} catch (Throwable e) {
log.error("AllocateMessageQueueStrategy.allocate Exception. allocateMessageQueueStrategyName={}", strategy.getName(),
@@ -327,7 +328,8 @@ public abstract class RebalanceImpl {
}
}
- private boolean updateProcessQueueTableInRebalance(final String topic, final Set mqSet, final boolean isOrder) {
+ private boolean updateProcessQueueTableInRebalance(final String topic, final Set mqSet,
+ final boolean isOrder) {
boolean changed = false;
Iterator> it = this.processQueueTable.entrySet().iterator();
@@ -400,7 +402,8 @@ public abstract class RebalanceImpl {
return changed;
}
- public abstract void messageQueueChanged(final String topic, final Set mqAll, final Set mqDivided);
+ public abstract void messageQueueChanged(final String topic, final Set mqAll,
+ final Set mqDivided);
public abstract boolean removeUnnecessaryMessageQueue(final MessageQueue mq, final ProcessQueue pq);
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePullImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePullImpl.java
index 57bfe2b81ad71f8c745f199cfe12b8a952a168fe..9dd408c1d140ea4f7ce4aa31df5e5181c997b753 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePullImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePullImpl.java
@@ -32,7 +32,8 @@ public class RebalancePullImpl extends RebalanceImpl {
this(null, null, null, null, defaultMQPullConsumerImpl);
}
- public RebalancePullImpl(String consumerGroup, MessageModel messageModel, AllocateMessageQueueStrategy allocateMessageQueueStrategy,
+ public RebalancePullImpl(String consumerGroup, MessageModel messageModel,
+ AllocateMessageQueueStrategy allocateMessageQueueStrategy,
MQClientInstance mQClientFactory, DefaultMQPullConsumerImpl defaultMQPullConsumerImpl) {
super(consumerGroup, messageModel, allocateMessageQueueStrategy, mQClientFactory);
this.defaultMQPullConsumerImpl = defaultMQPullConsumerImpl;
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java
index 112bceeb81ed0fe25e9fbb9c92d8cec55ae8d602..39e025172d4f8333880de09b8d74596b04fc69c3 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java
@@ -40,7 +40,8 @@ public class RebalancePushImpl extends RebalanceImpl {
this(null, null, null, null, defaultMQPushConsumerImpl);
}
- public RebalancePushImpl(String consumerGroup, MessageModel messageModel, AllocateMessageQueueStrategy allocateMessageQueueStrategy,
+ public RebalancePushImpl(String consumerGroup, MessageModel messageModel,
+ AllocateMessageQueueStrategy allocateMessageQueueStrategy,
MQClientInstance mQClientFactory, DefaultMQPushConsumerImpl defaultMQPushConsumerImpl) {
super(consumerGroup, messageModel, allocateMessageQueueStrategy, mQClientFactory);
this.defaultMQPushConsumerImpl = defaultMQPushConsumerImpl;
@@ -74,8 +75,8 @@ public class RebalancePushImpl extends RebalanceImpl {
pq.getLockConsume().unlock();
}
} else {
- log.warn("[WRONG]mq is consuming, so can not unlock it, {}. maybe hanged for a while, {}", //
- mq, //
+ log.warn("[WRONG]mq is consuming, so can not unlock it, {}. maybe hanged for a while, {}",
+ mq,
pq.getTryUnlockTimes());
pq.incTryUnlockTimes();
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceService.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceService.java
index c4d2951aba8bce0669d006382046ff3b77695d76..fab07cb36e0f0976ca08bf77cb92c4b5eb56ead2 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceService.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceService.java
@@ -21,9 +21,6 @@ import org.apache.rocketmq.client.log.ClientLogger;
import org.apache.rocketmq.common.ServiceThread;
import org.slf4j.Logger;
-/**
- * Rebalance Service
- */
public class RebalanceService extends ServiceThread {
private static long waitInterval =
Long.parseLong(System.getProperty(
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
index f146be9bb5cfad6380b8e6544496a669ea2fa4d2..31c2c3cc3ae8c01e5375b389d1ff8420327ac112 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
@@ -148,10 +148,10 @@ public class MQClientInstance {
this.consumerStatsManager = new ConsumerStatsManager(this.scheduledExecutorService);
- log.info("created a new client Instance, FactoryIndex: {} ClinetID: {} {} {}, serializeType={}", //
- this.instanceIndex, //
- this.clientId, //
- this.clientConfig, //
+ log.info("created a new client Instance, FactoryIndex: {} ClinetID: {} {} {}, serializeType={}",
+ this.instanceIndex,
+ this.clientId,
+ this.clientConfig,
MQVersion.getVersionDesc(MQVersion.CURRENT_VERSION), RemotingCommand.getSerializeTypeConfigInThisServer());
}
@@ -584,7 +584,8 @@ public class MQClientInstance {
}
}
- public boolean updateTopicRouteInfoFromNameServer(final String topic, boolean isDefault, DefaultMQProducer defaultMQProducer) {
+ public boolean updateTopicRouteInfoFromNameServer(final String topic, boolean isDefault,
+ DefaultMQProducer defaultMQProducer) {
try {
if (this.lockNamesrv.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) {
try {
@@ -719,7 +720,8 @@ public class MQClientInstance {
return false;
}
- private void uploadFilterClassToAllFilterServer(final String consumerGroup, final String fullClassName, final String topic,
+ private void uploadFilterClassToAllFilterServer(final String consumerGroup, final String fullClassName,
+ final String topic,
final String filterClassSource) throws UnsupportedEncodingException {
byte[] classBody = null;
int classCRC = 0;
@@ -727,13 +729,13 @@ public class MQClientInstance {
classBody = filterClassSource.getBytes(MixAll.DEFAULT_CHARSET);
classCRC = UtilAll.crc32(classBody);
} catch (Exception e1) {
- log.warn("uploadFilterClassToAllFilterServer Exception, ClassName: {} {}", //
- fullClassName, //
+ log.warn("uploadFilterClassToAllFilterServer Exception, ClassName: {} {}",
+ fullClassName,
RemotingHelper.exceptionSimpleDesc(e1));
}
TopicRouteData topicRouteData = this.topicRouteTable.get(topic);
- if (topicRouteData != null //
+ if (topicRouteData != null
&& topicRouteData.getFilterServerTable() != null && !topicRouteData.getFilterServerTable().isEmpty()) {
Iterator>> it = topicRouteData.getFilterServerTable().entrySet().iterator();
while (it.hasNext()) {
@@ -1006,10 +1008,10 @@ public class MQClientInstance {
return null;
}
- public FindBrokerResult findBrokerAddressInSubscribe(//
- final String brokerName, //
- final long brokerId, //
- final boolean onlyThisBroker//
+ public FindBrokerResult findBrokerAddressInSubscribe(
+ final String brokerName,
+ final long brokerId,
+ final boolean onlyThisBroker
) {
String brokerAddr = null;
boolean slave = false;
@@ -1102,7 +1104,6 @@ public class MQClientInstance {
try {
TimeUnit.SECONDS.sleep(10);
} catch (InterruptedException e) {
- //
}
Iterator iterator = processQueueTable.keySet().iterator();
@@ -1171,8 +1172,8 @@ public class MQClientInstance {
return topicRouteTable;
}
- public ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg, //
- final String consumerGroup, //
+ public ConsumeMessageDirectlyResult consumeMessageDirectly(final MessageExt msg,
+ final String consumerGroup,
final String brokerName) {
MQConsumerInner mqConsumerInner = this.consumerTable.get(consumerGroup);
if (null != mqConsumerInner) {
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
index 12f8a3679e50457f353f21c4bdda3674ad9729f3..db9e51241f15a4a0ee0f6f173b5e392054cb3ca3 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
@@ -116,11 +116,11 @@ public class DefaultMQProducerImpl implements MQProducerInner {
public void initTransactionEnv() {
TransactionMQProducer producer = (TransactionMQProducer) this.defaultMQProducer;
this.checkRequestQueue = new LinkedBlockingQueue(producer.getCheckRequestHoldMax());
- this.checkExecutor = new ThreadPoolExecutor(//
- producer.getCheckThreadPoolMinSize(), //
- producer.getCheckThreadPoolMaxSize(), //
- 1000 * 60, //
- TimeUnit.MILLISECONDS, //
+ this.checkExecutor = new ThreadPoolExecutor(
+ producer.getCheckThreadPoolMinSize(),
+ producer.getCheckThreadPoolMaxSize(),
+ 1000 * 60,
+ TimeUnit.MILLISECONDS,
this.checkRequestQueue);
}
@@ -172,8 +172,8 @@ public class DefaultMQProducerImpl implements MQProducerInner {
case RUNNING:
case START_FAILED:
case SHUTDOWN_ALREADY:
- throw new MQClientException("The producer service state not OK, maybe started once, "//
- + this.serviceState//
+ throw new MQClientException("The producer service state not OK, maybe started once, "
+ + this.serviceState
+ FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK),
null);
default:
@@ -248,7 +248,8 @@ public class DefaultMQProducerImpl implements MQProducerInner {
}
@Override
- public void checkTransactionState(final String addr, final MessageExt msg, final CheckTransactionStateRequestHeader header) {
+ public void checkTransactionState(final String addr, final MessageExt msg,
+ final CheckTransactionStateRequestHeader header) {
Runnable request = new Runnable() {
private final String brokerAddr = addr;
private final MessageExt message = msg;
@@ -268,18 +269,18 @@ public class DefaultMQProducerImpl implements MQProducerInner {
exception = e;
}
- this.processTransactionState(//
- localTransactionState, //
- group, //
+ this.processTransactionState(
+ localTransactionState,
+ group,
exception);
} else {
log.warn("checkTransactionState, pick transactionCheckListener by group[{}] failed", group);
}
}
- private void processTransactionState(//
- final LocalTransactionState localTransactionState, //
- final String producerGroup, //
+ private void processTransactionState(
+ final LocalTransactionState localTransactionState,
+ final String producerGroup,
final Throwable exception) {
final EndTransactionRequestHeader thisHeader = new EndTransactionRequestHeader();
thisHeader.setCommitLogOffset(checkRequestHeader.getCommitLogOffset());
@@ -354,8 +355,8 @@ public class DefaultMQProducerImpl implements MQProducerInner {
private void makeSureStateOK() throws MQClientException {
if (this.serviceState != ServiceState.RUNNING) {
- throw new MQClientException("The producer service state not OK, "//
- + this.serviceState//
+ throw new MQClientException("The producer service state not OK, "
+ + this.serviceState
+ FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK),
null);
}
@@ -386,7 +387,8 @@ public class DefaultMQProducerImpl implements MQProducerInner {
return this.mQClientFactory.getMQAdminImpl().earliestMsgStoreTime(mq);
}
- public MessageExt viewMessage(String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
+ public MessageExt viewMessage(
+ String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
this.makeSureStateOK();
return this.mQClientFactory.getMQAdminImpl().viewMessage(msgId);
@@ -407,7 +409,8 @@ public class DefaultMQProducerImpl implements MQProducerInner {
/**
* DEFAULT ASYNC -------------------------------------------------------
*/
- public void send(Message msg, SendCallback sendCallback) throws MQClientException, RemotingException, InterruptedException {
+ public void send(Message msg,
+ SendCallback sendCallback) throws MQClientException, RemotingException, InterruptedException {
send(msg, sendCallback, this.defaultMQProducer.getSendMsgTimeout());
}
@@ -428,11 +431,11 @@ public class DefaultMQProducerImpl implements MQProducerInner {
this.mqFaultStrategy.updateFaultItem(brokerName, currentLatency, isolation);
}
- private SendResult sendDefaultImpl(//
- Message msg, //
- final CommunicationMode communicationMode, //
- final SendCallback sendCallback, //
- final long timeout//
+ private SendResult sendDefaultImpl(
+ Message msg,
+ final CommunicationMode communicationMode,
+ final SendCallback sendCallback,
+ final long timeout
) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
this.makeSureStateOK();
Validators.checkMessage(msg, this.defaultMQProducer);
@@ -579,11 +582,11 @@ public class DefaultMQProducerImpl implements MQProducerInner {
}
}
- private SendResult sendKernelImpl(final Message msg, //
- final MessageQueue mq, //
- final CommunicationMode communicationMode, //
- final SendCallback sendCallback, //
- final TopicPublishInfo topicPublishInfo, //
+ private SendResult sendKernelImpl(final Message msg,
+ final MessageQueue mq,
+ final CommunicationMode communicationMode,
+ final SendCallback sendCallback,
+ final TopicPublishInfo topicPublishInfo,
final long timeout) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
String brokerAddr = this.mQClientFactory.findBrokerAddressInPublish(mq.getBrokerName());
if (null == brokerAddr) {
@@ -674,18 +677,18 @@ public class DefaultMQProducerImpl implements MQProducerInner {
SendResult sendResult = null;
switch (communicationMode) {
case ASYNC:
- sendResult = this.mQClientFactory.getMQClientAPIImpl().sendMessage(//
- brokerAddr, // 1
- mq.getBrokerName(), // 2
- msg, // 3
- requestHeader, // 4
- timeout, // 5
- communicationMode, // 6
- sendCallback, // 7
- topicPublishInfo, // 8
- this.mQClientFactory, // 9
- this.defaultMQProducer.getRetryTimesWhenSendAsyncFailed(), // 10
- context, //
+ sendResult = this.mQClientFactory.getMQClientAPIImpl().sendMessage(
+ brokerAddr,
+ mq.getBrokerName(),
+ msg,
+ requestHeader,
+ timeout,
+ communicationMode,
+ sendCallback,
+ topicPublishInfo,
+ this.mQClientFactory,
+ this.defaultMQProducer.getRetryTimesWhenSendAsyncFailed(),
+ context,
this);
break;
case ONEWAY:
@@ -863,7 +866,8 @@ public class DefaultMQProducerImpl implements MQProducerInner {
/**
* KERNEL ONEWAY -------------------------------------------------------
*/
- public void sendOneway(Message msg, MessageQueue mq) throws MQClientException, RemotingException, InterruptedException {
+ public void sendOneway(Message msg,
+ MessageQueue mq) throws MQClientException, RemotingException, InterruptedException {
this.makeSureStateOK();
Validators.checkMessage(msg, this.defaultMQProducer);
@@ -887,12 +891,12 @@ public class DefaultMQProducerImpl implements MQProducerInner {
return this.sendSelectImpl(msg, selector, arg, CommunicationMode.SYNC, null, timeout);
}
- private SendResult sendSelectImpl(//
- Message msg, //
- MessageQueueSelector selector, //
- Object arg, //
- final CommunicationMode communicationMode, //
- final SendCallback sendCallback, final long timeout//
+ private SendResult sendSelectImpl(
+ Message msg,
+ MessageQueueSelector selector,
+ Object arg,
+ final CommunicationMode communicationMode,
+ final SendCallback sendCallback, final long timeout
) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
this.makeSureStateOK();
Validators.checkMessage(msg, this.defaultMQProducer);
@@ -945,7 +949,8 @@ public class DefaultMQProducerImpl implements MQProducerInner {
}
}
- public TransactionSendResult sendMessageInTransaction(final Message msg, final LocalTransactionExecuter tranExecuter, final Object arg)
+ public TransactionSendResult sendMessageInTransaction(final Message msg,
+ final LocalTransactionExecuter tranExecuter, final Object arg)
throws MQClientException {
if (null == tranExecuter) {
throw new MQClientException("tranExecutor is null", null);
@@ -1013,13 +1018,14 @@ public class DefaultMQProducerImpl implements MQProducerInner {
/**
* DEFAULT SYNC -------------------------------------------------------
*/
- public SendResult send(Message msg) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
+ public SendResult send(
+ Message msg) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
return send(msg, this.defaultMQProducer.getSendMsgTimeout());
}
- public void endTransaction(//
- final SendResult sendResult, //
- final LocalTransactionState localTransactionState, //
+ public void endTransaction(
+ final SendResult sendResult,
+ final LocalTransactionState localTransactionState,
final Throwable localException) throws RemotingException, MQBrokerException, InterruptedException, UnknownHostException {
final MessageId id;
if (sendResult.getOffsetMsgId() != null) {
@@ -1054,7 +1060,8 @@ public class DefaultMQProducerImpl implements MQProducerInner {
this.defaultMQProducer.getSendMsgTimeout());
}
- public SendResult send(Message msg, long timeout) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
+ public SendResult send(Message msg,
+ long timeout) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
return this.sendDefaultImpl(msg, CommunicationMode.SYNC, null, timeout);
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/producer/MQProducerInner.java b/client/src/main/java/org/apache/rocketmq/client/impl/producer/MQProducerInner.java
index 5b2039ec47edcdffa75da96a2c833b4b5a237b80..dfd485dd90909573eac012ff1e94f08f82d8e529 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/producer/MQProducerInner.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/producer/MQProducerInner.java
@@ -28,9 +28,9 @@ public interface MQProducerInner {
TransactionCheckListener checkListener();
- void checkTransactionState(//
- final String addr, //
- final MessageExt msg, //
+ void checkTransactionState(
+ final String addr,
+ final MessageExt msg,
final CheckTransactionStateRequestHeader checkRequestHeader);
void updateTopicPublishInfo(final String topic, final TopicPublishInfo info);
diff --git a/client/src/main/java/org/apache/rocketmq/client/log/ClientLogger.java b/client/src/main/java/org/apache/rocketmq/client/log/ClientLogger.java
index 05d72b40ce08e43bd33d2903cab8c89f8a656514..c3df9a63947ffc927f67e65291b2641fde600054 100644
--- a/client/src/main/java/org/apache/rocketmq/client/log/ClientLogger.java
+++ b/client/src/main/java/org/apache/rocketmq/client/log/ClientLogger.java
@@ -16,14 +16,14 @@
*/
package org.apache.rocketmq.client.log;
-import java.lang.reflect.Method;
-import java.net.URL;
-
import org.apache.rocketmq.common.constant.LoggerName;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.lang.reflect.Method;
+import java.net.URL;
+
public class ClientLogger {
public static final String CLIENT_LOG_ROOT = "rocketmq.client.logRoot";
public static final String CLIENT_LOG_MAXINDEX = "rocketmq.client.logFileMaxIndex";
@@ -31,25 +31,21 @@ public class ClientLogger {
private static Logger log;
- private static Class logClass = null;
-
private static Logger createLogger(final String loggerName) {
- String logConfigFilePath =
- System.getProperty("rocketmq.client.log.configFile",
- System.getenv("ROCKETMQ_CLIENT_LOG_CONFIGFILE"));
+ String logConfigFilePath = System.getProperty("rocketmq.client.log.configFile", System.getenv("ROCKETMQ_CLIENT_LOG_CONFIGFILE"));
Boolean isloadconfig =
- Boolean.parseBoolean(System.getProperty("rocketmq.client.log.loadconfig", "true"));
+ Boolean.parseBoolean(System.getProperty("rocketmq.client.log.loadconfig", "true"));
final String log4JResourceFile =
- System.getProperty("rocketmq.client.log4j.resource.fileName", "log4j_rocketmq_client.xml");
+ System.getProperty("rocketmq.client.log4j.resource.fileName", "log4j_rocketmq_client.xml");
final String logbackResourceFile =
- System.getProperty("rocketmq.client.logback.resource.fileName", "logback_rocketmq_client.xml");
+ System.getProperty("rocketmq.client.logback.resource.fileName", "logback_rocketmq_client.xml");
final String log4J2ResourceFile =
- System.getProperty("rocketmq.client.log4j2.resource.fileName", "log4j2_rocketmq_client.xml");
+ System.getProperty("rocketmq.client.log4j2.resource.fileName", "log4j2_rocketmq_client.xml");
- String clientLogRoot = System.getProperty(CLIENT_LOG_ROOT, "${user.home}/logs/rocketmqlogs");
+ String clientLogRoot = System.getProperty(CLIENT_LOG_ROOT, System.getProperty("user.home") + "/logs/rocketmqlogs");
System.setProperty("client.logRoot", clientLogRoot);
String clientLogLevel = System.getProperty(CLIENT_LOG_LEVEL, "INFO");
System.setProperty("client.logLevel", clientLogLevel);
@@ -85,11 +81,11 @@ public class ClientLogger {
if (null == logConfigFilePath) {
URL url = ClientLogger.class.getClassLoader().getResource(logbackResourceFile);
Method doConfigure =
- joranConfiguratoroObj.getClass().getMethod("doConfigure", URL.class);
+ joranConfiguratoroObj.getClass().getMethod("doConfigure", URL.class);
doConfigure.invoke(joranConfiguratoroObj, url);
} else {
Method doConfigure =
- joranConfiguratoroObj.getClass().getMethod("doConfigure", String.class);
+ joranConfiguratoroObj.getClass().getMethod("doConfigure", String.class);
doConfigure.invoke(joranConfiguratoroObj, logConfigFilePath);
}
@@ -102,7 +98,6 @@ public class ClientLogger {
initialize.invoke(joranConfigurator, "log4j2", logConfigFilePath);
}
}
- logClass = classType;
} catch (Exception e) {
System.err.println(e);
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java b/client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java
index 135a447eba4ba0b5e0925da92431bc8a5c147d7f..d48686e3379507cc78f3608c7e08d08d38bc426a 100644
--- a/client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java
+++ b/client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java
@@ -48,8 +48,8 @@ import org.apache.rocketmq.remoting.exception.RemotingException;
*
*
*
- * Thread Safety: After configuring and starting process, this class can be regarded as thread-safe
- * and used among multiple threads context.
+ * Thread Safety: After configuring and starting process, this class can be regarded as thread-safe
+ * and used among multiple threads context.
*
*/
public class DefaultMQProducer extends ClientConfig implements MQProducer {
@@ -137,6 +137,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Constructor specifying producer group.
+ *
* @param producerGroup Producer group, see the name-sake field.
*/
public DefaultMQProducer(final String producerGroup) {
@@ -145,6 +146,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Constructor specifying the RPC hook.
+ *
* @param rpcHook RPC hook to execute per each remoting command execution.
*/
public DefaultMQProducer(RPCHook rpcHook) {
@@ -178,6 +180,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Fetch message queues of topic topic, to which we may send/publish messages.
+ *
* @param topic Topic to fetch.
* @return List of message queues readily to send messages to
* @throws MQClientException if there is any client error.
@@ -204,12 +207,14 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
* @throws InterruptedException if the sending thread is interrupted.
*/
@Override
- public SendResult send(Message msg) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
+ public SendResult send(
+ Message msg) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
return this.defaultMQProducerImpl.send(msg);
}
/**
* Same to {@link #send(Message)} with send timeout specified in addition.
+ *
* @param msg Message to send.
* @param timeout send timeout.
* @return {@link SendResult} instance to inform senders details of the deliverable, say Message ID of the message,
@@ -220,7 +225,8 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
* @throws InterruptedException if the sending thread is interrupted.
*/
@Override
- public SendResult send(Message msg, long timeout) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
+ public SendResult send(Message msg,
+ long timeout) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
return this.defaultMQProducerImpl.send(msg, timeout);
}
@@ -234,6 +240,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
* Similar to {@link #send(Message)}, internal implementation would potentially retry up to
* {@link #retryTimesWhenSendAsyncFailed} times before claiming sending failure, which may yield message duplication
* and application developers are the one to resolve this potential issue.
+ *
* @param msg Message to send.
* @param sendCallback Callback to execute on sending completed, either successful or unsuccessful.
* @throws MQClientException if there is any client error.
@@ -241,12 +248,14 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
* @throws InterruptedException if the sending thread is interrupted.
*/
@Override
- public void send(Message msg, SendCallback sendCallback) throws MQClientException, RemotingException, InterruptedException {
+ public void send(Message msg,
+ SendCallback sendCallback) throws MQClientException, RemotingException, InterruptedException {
this.defaultMQProducerImpl.send(msg, sendCallback);
}
/**
* Same to {@link #send(Message, SendCallback)} with send timeout specified in addition.
+ *
* @param msg message to send.
* @param sendCallback Callback to execute.
* @param timeout send timeout.
@@ -263,6 +272,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Similar to UDP, this method won't wait for
* acknowledgement from broker before return. Obviously, it has maximums throughput yet potentials of message loss.
+ *
* @param msg Message to send.
* @throws MQClientException if there is any client error.
* @throws RemotingException if there is any network-tier error.
@@ -275,6 +285,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Same to {@link #send(Message)} with target message queue specified in addition.
+ *
* @param msg Message to send.
* @param mq Target message queue.
* @return {@link SendResult} instance to inform senders details of the deliverable, say Message ID of the message,
@@ -327,6 +338,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Same to {@link #send(Message, SendCallback)} with target message queue and send timeout specified.
+ *
* @param msg Message to send.
* @param mq Target message queue.
* @param sendCallback Callback to execute on sending completed, either successful or unsuccessful.
@@ -343,6 +355,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Same to {@link #sendOneway(Message)} with target message queue specified.
+ *
* @param msg Message to send.
* @param mq Target message queue.
* @throws MQClientException if there is any client error.
@@ -350,12 +363,13 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
* @throws InterruptedException if the sending thread is interrupted.
*/
@Override
- public void sendOneway(Message msg, MessageQueue mq) throws MQClientException, RemotingException, InterruptedException {
+ public void sendOneway(Message msg,
+ MessageQueue mq) throws MQClientException, RemotingException, InterruptedException {
this.defaultMQProducerImpl.sendOneway(msg, mq);
}
/**
- * Same to {@link #send(Message)} with message queue selector specified.
+ * Same to {@link #send(Message)} with message queue selector specified.
*
* @param msg Message to send.
* @param selector Message queue selector, through which we get target message queue to deliver message to.
@@ -430,6 +444,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Same to {@link #sendOneway(Message)} with message queue selector specified.
+ *
* @param msg Message to send.
* @param selector Message queue selector, through which to determine target message queue to deliver message
* @param arg Argument used along with message queue selector.
@@ -453,13 +468,15 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
* @throws MQClientException if there is any client error.
*/
@Override
- public TransactionSendResult sendMessageInTransaction(Message msg, LocalTransactionExecuter tranExecuter, final Object arg)
+ public TransactionSendResult sendMessageInTransaction(Message msg, LocalTransactionExecuter tranExecuter,
+ final Object arg)
throws MQClientException {
throw new RuntimeException("sendMessageInTransaction not implement, please use TransactionMQProducer class");
}
/**
* Create a topic on broker.
+ *
* @param key accesskey
* @param newTopic topic name
* @param queueNum topic's queue number
@@ -472,6 +489,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Create a topic on broker.
+ *
* @param key accesskey
* @param newTopic topic name
* @param queueNum topic's queue number
@@ -485,6 +503,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Search consume queue offset of the given time stamp.
+ *
* @param mq Instance of MessageQueue
* @param timestamp from when in milliseconds.
* @return Consume queue offset.
@@ -509,6 +528,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Query minimum offset of the given message queue.
+ *
* @param mq Instance of MessageQueue
* @return minimum offset of the given message queue.
* @throws MQClientException if there is any client error.
@@ -520,6 +540,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Query earliest message store time.
+ *
* @param mq Instance of MessageQueue
* @return earliest message store time.
* @throws MQClientException if there is any client error.
@@ -531,6 +552,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
/**
* Query message of the given offset message ID.
+ *
* @param offsetMsgId message id
* @return Message specified.
* @throws MQBrokerException if there is any broker error.
@@ -539,12 +561,14 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
* @throws InterruptedException if the sending thread is interrupted.
*/
@Override
- public MessageExt viewMessage(String offsetMsgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
+ public MessageExt viewMessage(
+ String offsetMsgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
return this.defaultMQProducerImpl.viewMessage(offsetMsgId);
}
/**
* Query message by key.
+ *
* @param topic message topic
* @param key message key index word
* @param maxNum max message number
@@ -572,7 +596,8 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
* @throws InterruptedException if the sending thread is interrupted.
*/
@Override
- public MessageExt viewMessage(String topic, String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
+ public MessageExt viewMessage(String topic,
+ String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
try {
MessageId oldMsgId = MessageDecoder.decodeMessageId(msgId);
return this.viewMessage(msgId);
@@ -582,22 +607,26 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
}
@Override
- public SendResult send(Collection msgs) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
+ public SendResult send(
+ Collection msgs) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
return this.defaultMQProducerImpl.send(batch(msgs));
}
@Override
- public SendResult send(Collection msgs, long timeout) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
+ public SendResult send(Collection msgs,
+ long timeout) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
return this.defaultMQProducerImpl.send(batch(msgs), timeout);
}
@Override
- public SendResult send(Collection msgs, MessageQueue messageQueue) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
+ public SendResult send(Collection msgs,
+ MessageQueue messageQueue) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
return this.defaultMQProducerImpl.send(batch(msgs), messageQueue);
}
@Override
- public SendResult send(Collection msgs, MessageQueue messageQueue, long timeout) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
+ public SendResult send(Collection msgs, MessageQueue messageQueue,
+ long timeout) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
return this.defaultMQProducerImpl.send(batch(msgs), messageQueue, timeout);
}
@@ -615,6 +644,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
}
return msgBatch;
}
+
public String getProducerGroup() {
return producerGroup;
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/producer/LocalTransactionExecuter.java b/client/src/main/java/org/apache/rocketmq/client/producer/LocalTransactionExecuter.java
index 0c22c3ea6b4f394b28ed19fad8ad812fb1f34a3c..80b5546925fee85484151985aee052107f59e49e 100644
--- a/client/src/main/java/org/apache/rocketmq/client/producer/LocalTransactionExecuter.java
+++ b/client/src/main/java/org/apache/rocketmq/client/producer/LocalTransactionExecuter.java
@@ -19,5 +19,5 @@ package org.apache.rocketmq.client.producer;
import org.apache.rocketmq.common.message.Message;
public interface LocalTransactionExecuter {
- public LocalTransactionState executeLocalTransactionBranch(final Message msg, final Object arg);
+ LocalTransactionState executeLocalTransactionBranch(final Message msg, final Object arg);
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/producer/SendCallback.java b/client/src/main/java/org/apache/rocketmq/client/producer/SendCallback.java
index 1adf1834d91a1f5b4780469903222623deb1b38c..a85fa699c8fa7f69a740f89988062a90591d42fb 100644
--- a/client/src/main/java/org/apache/rocketmq/client/producer/SendCallback.java
+++ b/client/src/main/java/org/apache/rocketmq/client/producer/SendCallback.java
@@ -17,7 +17,7 @@
package org.apache.rocketmq.client.producer;
public interface SendCallback {
- public void onSuccess(final SendResult sendResult);
+ void onSuccess(final SendResult sendResult);
- public void onException(final Throwable e);
+ void onException(final Throwable e);
}
diff --git a/client/src/main/java/org/apache/rocketmq/client/producer/SendResult.java b/client/src/main/java/org/apache/rocketmq/client/producer/SendResult.java
index fa960757983141d5d0c1cfdacda2b55b2cf5d641..80948830fbafbcf09107859113db015ceb60a839 100644
--- a/client/src/main/java/org/apache/rocketmq/client/producer/SendResult.java
+++ b/client/src/main/java/org/apache/rocketmq/client/producer/SendResult.java
@@ -32,7 +32,8 @@ public class SendResult {
public SendResult() {
}
- public SendResult(SendStatus sendStatus, String msgId, String offsetMsgId, MessageQueue messageQueue, long queueOffset) {
+ public SendResult(SendStatus sendStatus, String msgId, String offsetMsgId, MessageQueue messageQueue,
+ long queueOffset) {
this.sendStatus = sendStatus;
this.msgId = msgId;
this.offsetMsgId = offsetMsgId;
@@ -40,7 +41,8 @@ public class SendResult {
this.queueOffset = queueOffset;
}
- public SendResult(final SendStatus sendStatus, final String msgId, final MessageQueue messageQueue, final long queueOffset, final String transactionId,
+ public SendResult(final SendStatus sendStatus, final String msgId, final MessageQueue messageQueue,
+ final long queueOffset, final String transactionId,
final String offsetMsgId, final String regionId) {
this.sendStatus = sendStatus;
this.msgId = msgId;
diff --git a/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumerTest.java b/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumerTest.java
index 33142617d0d3d533a4f5b0e090a35e84f9bcf90b..9cdeda8e8dc15c79d1aa936d3a2a868a96826925 100644
--- a/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumerTest.java
+++ b/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumerTest.java
@@ -86,7 +86,8 @@ public class DefaultMQPullConsumerTest {
@Test
public void testPullMessage_Success() throws Exception {
doAnswer(new Answer() {
- @Override public Object answer(InvocationOnMock mock) throws Throwable {
+ @Override
+ public Object answer(InvocationOnMock mock) throws Throwable {
PullMessageRequestHeader requestHeader = mock.getArgument(1);
return createPullResult(requestHeader, PullStatus.FOUND, Collections.singletonList(new MessageExt()));
}
@@ -103,9 +104,10 @@ public class DefaultMQPullConsumerTest {
}
@Test
- public void testPullMessage_NotFound() throws Exception{
+ public void testPullMessage_NotFound() throws Exception {
doAnswer(new Answer() {
- @Override public Object answer(InvocationOnMock mock) throws Throwable {
+ @Override
+ public Object answer(InvocationOnMock mock) throws Throwable {
PullMessageRequestHeader requestHeader = mock.getArgument(1);
return createPullResult(requestHeader, PullStatus.NO_NEW_MSG, new ArrayList());
}
@@ -119,7 +121,8 @@ public class DefaultMQPullConsumerTest {
@Test
public void testPullMessageAsync_Success() throws Exception {
doAnswer(new Answer() {
- @Override public Object answer(InvocationOnMock mock) throws Throwable {
+ @Override
+ public Object answer(InvocationOnMock mock) throws Throwable {
PullMessageRequestHeader requestHeader = mock.getArgument(1);
PullResult pullResult = createPullResult(requestHeader, PullStatus.FOUND, Collections.singletonList(new MessageExt()));
@@ -131,7 +134,8 @@ public class DefaultMQPullConsumerTest {
MessageQueue messageQueue = new MessageQueue(topic, brokerName, 0);
pullConsumer.pull(messageQueue, "*", 1024, 3, new PullCallback() {
- @Override public void onSuccess(PullResult pullResult) {
+ @Override
+ public void onSuccess(PullResult pullResult) {
assertThat(pullResult).isNotNull();
assertThat(pullResult.getPullStatus()).isEqualTo(PullStatus.FOUND);
assertThat(pullResult.getNextBeginOffset()).isEqualTo(1024 + 1);
@@ -140,13 +144,15 @@ public class DefaultMQPullConsumerTest {
assertThat(pullResult.getMsgFoundList()).isEqualTo(new ArrayList