提交 246be9eb 编写于 作者: S shroman

ROCKETMQ-6: Use logger for exceptions instead of e.printStackTrace().

Signed-off-by: Nshroman <rshtykh@yahoo.com>
上级 9ad9ad06
...@@ -210,7 +210,7 @@ public class BrokerController { ...@@ -210,7 +210,7 @@ public class BrokerController {
this.messageStore.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(this.brokerConfig, this.consumerFilterManager)); this.messageStore.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(this.brokerConfig, this.consumerFilterManager));
} catch (IOException e) { } catch (IOException e) {
result = false; result = false;
e.printStackTrace(); log.error("Failed to initialize", e);
} }
} }
......
...@@ -67,7 +67,7 @@ import org.slf4j.Logger; ...@@ -67,7 +67,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class PullMessageProcessor implements NettyRequestProcessor { public class PullMessageProcessor implements NettyRequestProcessor {
private static final Logger LOG = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME); private static final Logger log = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME);
private final BrokerController brokerController; private final BrokerController brokerController;
private List<ConsumeMessageHook> consumeMessageHookList; private List<ConsumeMessageHook> consumeMessageHookList;
...@@ -94,9 +94,7 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -94,9 +94,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
response.setOpaque(request.getOpaque()); response.setOpaque(request.getOpaque());
if (LOG.isDebugEnabled()) { log.debug("receive PullMessage request command, {}", request);
LOG.debug("receive PullMessage request command, {}", request);
}
if (!PermName.isReadable(this.brokerController.getBrokerConfig().getBrokerPermission())) { if (!PermName.isReadable(this.brokerController.getBrokerConfig().getBrokerPermission())) {
response.setCode(ResponseCode.NO_PERMISSION); response.setCode(ResponseCode.NO_PERMISSION);
...@@ -126,7 +124,7 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -126,7 +124,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
TopicConfig topicConfig = this.brokerController.getTopicConfigManager().selectTopicConfig(requestHeader.getTopic()); TopicConfig topicConfig = this.brokerController.getTopicConfigManager().selectTopicConfig(requestHeader.getTopic());
if (null == topicConfig) { if (null == topicConfig) {
LOG.error("The topic {} not exist, consumer: {} ", requestHeader.getTopic(), RemotingHelper.parseChannelRemoteAddr(channel)); log.error("the topic {} not exist, consumer: {}", requestHeader.getTopic(), RemotingHelper.parseChannelRemoteAddr(channel));
response.setCode(ResponseCode.TOPIC_NOT_EXIST); response.setCode(ResponseCode.TOPIC_NOT_EXIST);
response.setRemark(String.format("topic[%s] not exist, apply first please! %s", requestHeader.getTopic(), FAQUrl.suggestTodo(FAQUrl.APPLY_TOPIC_URL))); response.setRemark(String.format("topic[%s] not exist, apply first please! %s", requestHeader.getTopic(), FAQUrl.suggestTodo(FAQUrl.APPLY_TOPIC_URL)));
return response; return response;
...@@ -141,7 +139,7 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -141,7 +139,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
if (requestHeader.getQueueId() < 0 || requestHeader.getQueueId() >= topicConfig.getReadQueueNums()) { if (requestHeader.getQueueId() < 0 || requestHeader.getQueueId() >= topicConfig.getReadQueueNums()) {
String errorInfo = String.format("queueId[%d] is illegal, topic:[%s] topicConfig.readQueueNums:[%d] consumer:[%s]", 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); log.warn(errorInfo);
response.setCode(ResponseCode.SYSTEM_ERROR); response.setCode(ResponseCode.SYSTEM_ERROR);
response.setRemark(errorInfo); response.setRemark(errorInfo);
return response; return response;
...@@ -162,7 +160,7 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -162,7 +160,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
assert consumerFilterData != null; assert consumerFilterData != null;
} }
} catch (Exception e) { } 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()); requestHeader.getConsumerGroup());
response.setCode(ResponseCode.SUBSCRIPTION_PARSE_FAILED); response.setCode(ResponseCode.SUBSCRIPTION_PARSE_FAILED);
response.setRemark("parse the consumer's subscription failed"); response.setRemark("parse the consumer's subscription failed");
...@@ -172,7 +170,7 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -172,7 +170,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
ConsumerGroupInfo consumerGroupInfo = ConsumerGroupInfo consumerGroupInfo =
this.brokerController.getConsumerManager().getConsumerGroupInfo(requestHeader.getConsumerGroup()); this.brokerController.getConsumerManager().getConsumerGroupInfo(requestHeader.getConsumerGroup());
if (null == consumerGroupInfo) { if (null == consumerGroupInfo) {
LOG.warn("The consumer's group info not exist, group: {}", requestHeader.getConsumerGroup()); log.warn("the consumer's group info not exist, group: {}", requestHeader.getConsumerGroup());
response.setCode(ResponseCode.SUBSCRIPTION_NOT_EXIST); response.setCode(ResponseCode.SUBSCRIPTION_NOT_EXIST);
response.setRemark("the consumer's group info not exist" + FAQUrl.suggestTodo(FAQUrl.SAME_GROUP_DIFFERENT_TOPIC)); response.setRemark("the consumer's group info not exist" + FAQUrl.suggestTodo(FAQUrl.SAME_GROUP_DIFFERENT_TOPIC));
return response; return response;
...@@ -187,14 +185,14 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -187,14 +185,14 @@ public class PullMessageProcessor implements NettyRequestProcessor {
subscriptionData = consumerGroupInfo.findSubscriptionData(requestHeader.getTopic()); subscriptionData = consumerGroupInfo.findSubscriptionData(requestHeader.getTopic());
if (null == subscriptionData) { if (null == subscriptionData) {
LOG.warn("The consumer's subscription not exist, group: {}, topic:{}", requestHeader.getConsumerGroup(), requestHeader.getTopic()); log.warn("the consumer's subscription not exist, group: {}, topic:{}", requestHeader.getConsumerGroup(), requestHeader.getTopic());
response.setCode(ResponseCode.SUBSCRIPTION_NOT_EXIST); response.setCode(ResponseCode.SUBSCRIPTION_NOT_EXIST);
response.setRemark("the consumer's subscription not exist" + FAQUrl.suggestTodo(FAQUrl.SAME_GROUP_DIFFERENT_TOPIC)); response.setRemark("the consumer's subscription not exist" + FAQUrl.suggestTodo(FAQUrl.SAME_GROUP_DIFFERENT_TOPIC));
return response; return response;
} }
if (subscriptionData.getSubVersion() < requestHeader.getSubVersion()) { if (subscriptionData.getSubVersion() < requestHeader.getSubVersion()) {
LOG.warn("The broker's subscription is not latest, group: {} {}", requestHeader.getConsumerGroup(), log.warn("The broker's subscription is not latest, group: {} {}", requestHeader.getConsumerGroup(),
subscriptionData.getSubString()); subscriptionData.getSubString());
response.setCode(ResponseCode.SUBSCRIPTION_NOT_LATEST); response.setCode(ResponseCode.SUBSCRIPTION_NOT_LATEST);
response.setRemark("the consumer's subscription not latest"); response.setRemark("the consumer's subscription not latest");
...@@ -209,7 +207,7 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -209,7 +207,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
return response; return response;
} }
if (consumerFilterData.getClientVersion() < requestHeader.getSubVersion()) { if (consumerFilterData.getClientVersion() < requestHeader.getSubVersion()) {
LOG.warn("The broker's consumer filter data is not latest, group: {}, topic: {}, serverV: {}, clientV: {}", log.warn("The broker's consumer filter data is not latest, group: {}, topic: {}, serverV: {}, clientV: {}",
requestHeader.getConsumerGroup(), requestHeader.getTopic(), consumerFilterData.getClientVersion(), requestHeader.getSubVersion()); requestHeader.getConsumerGroup(), requestHeader.getTopic(), consumerFilterData.getClientVersion(), requestHeader.getSubVersion());
response.setCode(ResponseCode.FILTER_DATA_NOT_LATEST); response.setCode(ResponseCode.FILTER_DATA_NOT_LATEST);
response.setRemark("the consumer's consumer filter data not latest"); response.setRemark("the consumer's consumer filter data not latest");
...@@ -287,12 +285,12 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -287,12 +285,12 @@ public class PullMessageProcessor implements NettyRequestProcessor {
response.setCode(ResponseCode.PULL_OFFSET_MOVED); response.setCode(ResponseCode.PULL_OFFSET_MOVED);
// XXX: warn and notify me // XXX: warn and notify me
LOG.info("the broker store no queue data, fix the request offset {} to {}, Topic: {} QueueId: {} Consumer Group: {}", // log.info("the broker store no queue data, fix the request offset {} to {}, Topic: {} QueueId: {} Consumer Group: {}", //
requestHeader.getQueueOffset(), // requestHeader.getQueueOffset(), //
getMessageResult.getNextBeginOffset(), // getMessageResult.getNextBeginOffset(), //
requestHeader.getTopic(), // requestHeader.getTopic(), //
requestHeader.getQueueId(), // requestHeader.getQueueId(), //
requestHeader.getConsumerGroup()// requestHeader.getConsumerGroup()//
); );
} else { } else {
response.setCode(ResponseCode.PULL_NOT_FOUND); response.setCode(ResponseCode.PULL_NOT_FOUND);
...@@ -307,16 +305,17 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -307,16 +305,17 @@ public class PullMessageProcessor implements NettyRequestProcessor {
case OFFSET_OVERFLOW_BADLY: case OFFSET_OVERFLOW_BADLY:
response.setCode(ResponseCode.PULL_OFFSET_MOVED); response.setCode(ResponseCode.PULL_OFFSET_MOVED);
// XXX: warn and notify me // XXX: warn and notify me
LOG.info("The request offset:{} over flow badly, broker max offset:{} , consumer: {}", requestHeader.getQueueOffset(), getMessageResult.getMaxOffset(), channel.remoteAddress()); log.info("the request offset: {} over flow badly, broker max offset: {}, consumer: {}",
requestHeader.getQueueOffset(), getMessageResult.getMaxOffset(), channel.remoteAddress());
break; break;
case OFFSET_OVERFLOW_ONE: case OFFSET_OVERFLOW_ONE:
response.setCode(ResponseCode.PULL_NOT_FOUND); response.setCode(ResponseCode.PULL_NOT_FOUND);
break; break;
case OFFSET_TOO_SMALL: case OFFSET_TOO_SMALL:
response.setCode(ResponseCode.PULL_OFFSET_MOVED); response.setCode(ResponseCode.PULL_OFFSET_MOVED);
LOG.info("The request offset is too small. group={}, topic={}, requestOffset={}, brokerMinOffset={}, clientIp={}", log.info("the request offset too small. group={}, topic={}, requestOffset={}, brokerMinOffset={}, clientIp={}",
requestHeader.getConsumerGroup(), requestHeader.getTopic(), requestHeader.getQueueOffset(), requestHeader.getConsumerGroup(), requestHeader.getTopic(), requestHeader.getQueueOffset(),
getMessageResult.getMinOffset(), channel.remoteAddress()); getMessageResult.getMinOffset(), channel.remoteAddress());
break; break;
default: default:
assert false; assert false;
...@@ -391,12 +390,12 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -391,12 +390,12 @@ public class PullMessageProcessor implements NettyRequestProcessor {
public void operationComplete(ChannelFuture future) throws Exception { public void operationComplete(ChannelFuture future) throws Exception {
getMessageResult.release(); getMessageResult.release();
if (!future.isSuccess()) { if (!future.isSuccess()) {
LOG.error("Fail to transfer messages from page cache to {}", channel.remoteAddress(), future.cause()); log.error("transfer many message by pagecache failed, {}", channel.remoteAddress(), future.cause());
} }
} }
}); });
} catch (Throwable e) { } catch (Throwable e) {
LOG.error("Error occurred when transferring messages from page cache", e); log.error("transfer many message by pagecache exception", e);
getMessageResult.release(); getMessageResult.release();
} }
...@@ -437,16 +436,16 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -437,16 +436,16 @@ public class PullMessageProcessor implements NettyRequestProcessor {
event.setOffsetRequest(requestHeader.getQueueOffset()); event.setOffsetRequest(requestHeader.getQueueOffset());
event.setOffsetNew(getMessageResult.getNextBeginOffset()); event.setOffsetNew(getMessageResult.getNextBeginOffset());
this.generateOffsetMovedEvent(event); this.generateOffsetMovedEvent(event);
LOG.warn( log.warn(
"PULL_OFFSET_MOVED:correction offset. topic={}, groupId={}, requestOffset={}, newOffset={}, suggestBrokerId={}", "PULL_OFFSET_MOVED:correction offset. topic={}, groupId={}, requestOffset={}, newOffset={}, suggestBrokerId={}",
requestHeader.getTopic(), requestHeader.getConsumerGroup(), event.getOffsetRequest(), event.getOffsetNew(), requestHeader.getTopic(), requestHeader.getConsumerGroup(), event.getOffsetRequest(), event.getOffsetNew(),
responseHeader.getSuggestWhichBrokerId()); responseHeader.getSuggestWhichBrokerId());
} else { } else {
responseHeader.setSuggestWhichBrokerId(subscriptionGroupConfig.getBrokerId()); responseHeader.setSuggestWhichBrokerId(subscriptionGroupConfig.getBrokerId());
response.setCode(ResponseCode.PULL_RETRY_IMMEDIATELY); response.setCode(ResponseCode.PULL_RETRY_IMMEDIATELY);
LOG.warn("PULL_OFFSET_MOVED:none correction. topic={}, groupId={}, requestOffset={}, suggestBrokerId={}", log.warn("PULL_OFFSET_MOVED:none correction. topic={}, groupId={}, requestOffset={}, suggestBrokerId={}",
requestHeader.getTopic(), requestHeader.getConsumerGroup(), requestHeader.getQueueOffset(), requestHeader.getTopic(), requestHeader.getConsumerGroup(), requestHeader.getQueueOffset(),
responseHeader.getSuggestWhichBrokerId()); responseHeader.getSuggestWhichBrokerId());
} }
break; break;
...@@ -525,7 +524,7 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -525,7 +524,7 @@ public class PullMessageProcessor implements NettyRequestProcessor {
PutMessageResult putMessageResult = this.brokerController.getMessageStore().putMessage(msgInner); PutMessageResult putMessageResult = this.brokerController.getMessageStore().putMessage(msgInner);
} catch (Exception e) { } catch (Exception e) {
LOG.warn(String.format("GenerateOffsetMovedEvent Exception, %s", event.toString()), e); log.warn(String.format("generateOffsetMovedEvent Exception, %s", event.toString()), e);
} }
} }
...@@ -544,20 +543,21 @@ public class PullMessageProcessor implements NettyRequestProcessor { ...@@ -544,20 +543,21 @@ public class PullMessageProcessor implements NettyRequestProcessor {
@Override @Override
public void operationComplete(ChannelFuture future) throws Exception { public void operationComplete(ChannelFuture future) throws Exception {
if (!future.isSuccess()) { if (!future.isSuccess()) {
LOG.error("ProcessRequestWrapper response to {} failed", future.channel().remoteAddress(), future.cause()); log.error("processRequestWrapper response to {} failed",
LOG.error(request.toString()); future.channel().remoteAddress(), future.cause());
LOG.error(response.toString()); log.error(request.toString());
log.error(response.toString());
} }
} }
}); });
} catch (Throwable e) { } catch (Throwable e) {
LOG.error("ProcessRequestWrapper process request over, but response failed", e); log.error("processRequestWrapper process request over, but response failed", e);
LOG.error(request.toString()); log.error(request.toString());
LOG.error(response.toString()); log.error(response.toString());
} }
} }
} catch (RemotingCommandException e1) { } catch (RemotingCommandException e1) {
LOG.error("ExecuteRequestWhenWakeup run", e1); log.error("excuteRequestWhenWakeup run", e1);
} }
} }
}; };
......
...@@ -41,7 +41,7 @@ import org.slf4j.Logger; ...@@ -41,7 +41,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class TopicConfigManager extends ConfigManager { public class TopicConfigManager extends ConfigManager {
private static final Logger LOG = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME); private static final Logger log = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME);
private static final long LOCK_TIMEOUT_MILLIS = 3000; private static final long LOCK_TIMEOUT_MILLIS = 3000;
private transient final Lock lockTopicConfigTable = new ReentrantLock(); private transient final Lock lockTopicConfigTable = new ReentrantLock();
...@@ -181,15 +181,17 @@ public class TopicConfigManager extends ConfigManager { ...@@ -181,15 +181,17 @@ public class TopicConfigManager extends ConfigManager {
topicConfig.setTopicSysFlag(topicSysFlag); topicConfig.setTopicSysFlag(topicSysFlag);
topicConfig.setTopicFilterType(defaultTopicConfig.getTopicFilterType()); topicConfig.setTopicFilterType(defaultTopicConfig.getTopicFilterType());
} else { } else {
LOG.warn("Create new topic failed, because the default topic[{}] has no perm [{}] producer:[{}]", log.warn("Create new topic failed, because the default topic[{}] has no perm [{}] producer:[{}]",
defaultTopic, defaultTopicConfig.getPerm(), remoteAddress); defaultTopic, defaultTopicConfig.getPerm(), remoteAddress);
} }
} else { } else {
LOG.warn("Create new topic failed, because the default topic[{}] not exist. producer:[{}]", defaultTopic, remoteAddress); log.warn("Create new topic failed, because the default topic[{}] not exist. producer:[{}]",
defaultTopic, remoteAddress);
} }
if (topicConfig != null) { if (topicConfig != null) {
LOG.info("Create new topic by default topic:[{}] config:[{}] producer:[{}]", defaultTopic, topicConfig, remoteAddress); log.info("Create new topic by default topic:[{}] config:[{}] producer:[{}]",
defaultTopic, topicConfig, remoteAddress);
this.topicConfigTable.put(topic, topicConfig); this.topicConfigTable.put(topic, topicConfig);
...@@ -204,7 +206,7 @@ public class TopicConfigManager extends ConfigManager { ...@@ -204,7 +206,7 @@ public class TopicConfigManager extends ConfigManager {
} }
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOG.error("createTopicInSendMessageMethod exception", e); log.error("createTopicInSendMessageMethod exception", e);
} }
if (createNew) { if (createNew) {
...@@ -238,7 +240,7 @@ public class TopicConfigManager extends ConfigManager { ...@@ -238,7 +240,7 @@ public class TopicConfigManager extends ConfigManager {
topicConfig.setPerm(perm); topicConfig.setPerm(perm);
topicConfig.setTopicSysFlag(topicSysFlag); topicConfig.setTopicSysFlag(topicSysFlag);
LOG.info("create new topic {}", topicConfig); log.info("create new topic {}", topicConfig);
this.topicConfigTable.put(topic, topicConfig); this.topicConfigTable.put(topic, topicConfig);
createNew = true; createNew = true;
this.dataVersion.nextVersion(); this.dataVersion.nextVersion();
...@@ -248,7 +250,7 @@ public class TopicConfigManager extends ConfigManager { ...@@ -248,7 +250,7 @@ public class TopicConfigManager extends ConfigManager {
} }
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOG.error("createTopicInSendMessageBackMethod exception", e); log.error("createTopicInSendMessageBackMethod exception", e);
} }
if (createNew) { if (createNew) {
...@@ -269,8 +271,8 @@ public class TopicConfigManager extends ConfigManager { ...@@ -269,8 +271,8 @@ public class TopicConfigManager extends ConfigManager {
topicConfig.setTopicSysFlag(TopicSysFlag.clearUnitFlag(oldTopicSysFlag)); topicConfig.setTopicSysFlag(TopicSysFlag.clearUnitFlag(oldTopicSysFlag));
} }
LOG.info("update topic sys flag. oldTopicSysFlag={}, newTopicSysFlag", oldTopicSysFlag, log.info("update topic sys flag. oldTopicSysFlag={}, newTopicSysFlag", oldTopicSysFlag,
topicConfig.getTopicSysFlag()); topicConfig.getTopicSysFlag());
this.topicConfigTable.put(topic, topicConfig); this.topicConfigTable.put(topic, topicConfig);
...@@ -289,8 +291,8 @@ public class TopicConfigManager extends ConfigManager { ...@@ -289,8 +291,8 @@ public class TopicConfigManager extends ConfigManager {
topicConfig.setTopicSysFlag(TopicSysFlag.setUnitSubFlag(oldTopicSysFlag)); topicConfig.setTopicSysFlag(TopicSysFlag.setUnitSubFlag(oldTopicSysFlag));
} }
LOG.info("update topic sys flag. oldTopicSysFlag={}, newTopicSysFlag", oldTopicSysFlag, log.info("update topic sys flag. oldTopicSysFlag={}, newTopicSysFlag", oldTopicSysFlag,
topicConfig.getTopicSysFlag()); topicConfig.getTopicSysFlag());
this.topicConfigTable.put(topic, topicConfig); this.topicConfigTable.put(topic, topicConfig);
...@@ -304,9 +306,9 @@ public class TopicConfigManager extends ConfigManager { ...@@ -304,9 +306,9 @@ public class TopicConfigManager extends ConfigManager {
public void updateTopicConfig(final TopicConfig topicConfig) { public void updateTopicConfig(final TopicConfig topicConfig) {
TopicConfig old = this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig); TopicConfig old = this.topicConfigTable.put(topicConfig.getTopicName(), topicConfig);
if (old != null) { if (old != null) {
LOG.info("update topic config, old:[{}] new:[{}]", old, topicConfig); log.info("update topic config, old:[{}] new:[{}]", old, topicConfig);
} else { } else {
LOG.info("create new topic [{}]", topicConfig); log.info("create new topic [{}]", topicConfig);
} }
this.dataVersion.nextVersion(); this.dataVersion.nextVersion();
...@@ -324,7 +326,7 @@ public class TopicConfigManager extends ConfigManager { ...@@ -324,7 +326,7 @@ public class TopicConfigManager extends ConfigManager {
if (topicConfig != null && !topicConfig.isOrder()) { if (topicConfig != null && !topicConfig.isOrder()) {
topicConfig.setOrder(true); topicConfig.setOrder(true);
isChange = true; isChange = true;
LOG.info("update order topic config, topic={}, order={}", topic, true); log.info("update order topic config, topic={}, order={}", topic, true);
} }
} }
...@@ -335,7 +337,7 @@ public class TopicConfigManager extends ConfigManager { ...@@ -335,7 +337,7 @@ public class TopicConfigManager extends ConfigManager {
if (topicConfig.isOrder()) { if (topicConfig.isOrder()) {
topicConfig.setOrder(false); topicConfig.setOrder(false);
isChange = true; isChange = true;
LOG.info("update order topic config, topic={}, order={}", topic, false); log.info("update order topic config, topic={}, order={}", topic, false);
} }
} }
} }
...@@ -359,11 +361,11 @@ public class TopicConfigManager extends ConfigManager { ...@@ -359,11 +361,11 @@ public class TopicConfigManager extends ConfigManager {
public void deleteTopicConfig(final String topic) { public void deleteTopicConfig(final String topic) {
TopicConfig old = this.topicConfigTable.remove(topic); TopicConfig old = this.topicConfigTable.remove(topic);
if (old != null) { if (old != null) {
LOG.info("Delete topic config OK, topic:{}", old); log.info("delete topic config OK, topic: {}", old);
this.dataVersion.nextVersion(); this.dataVersion.nextVersion();
this.persist(); this.persist();
} else { } else {
LOG.warn("Delete topic config failed, topic:{} not exist", topic); log.warn("delete topic config failed, topic: {} not exists", topic);
} }
} }
...@@ -409,7 +411,7 @@ public class TopicConfigManager extends ConfigManager { ...@@ -409,7 +411,7 @@ public class TopicConfigManager extends ConfigManager {
Iterator<Entry<String, TopicConfig>> it = tcs.getTopicConfigTable().entrySet().iterator(); Iterator<Entry<String, TopicConfig>> it = tcs.getTopicConfigTable().entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Entry<String, TopicConfig> next = it.next(); Entry<String, TopicConfig> next = it.next();
LOG.info("load exist local topic, {}", next.getValue().toString()); log.info("load exist local topic, {}", next.getValue().toString());
} }
} }
......
...@@ -16,13 +16,19 @@ ...@@ -16,13 +16,19 @@
*/ */
package org.apache.rocketmq.common; package org.apache.rocketmq.common;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.rocketmq.common.annotation.ImportantField; import org.apache.rocketmq.common.annotation.ImportantField;
import org.apache.rocketmq.common.constant.LoggerName;
import org.apache.rocketmq.common.constant.PermName; import org.apache.rocketmq.common.constant.PermName;
import org.apache.rocketmq.remoting.common.RemotingUtil; import org.apache.rocketmq.remoting.common.RemotingUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class BrokerConfig { public class BrokerConfig {
private static final Logger log = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME);
private String rocketmqHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV)); private String rocketmqHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV));
@ImportantField @ImportantField
private String namesrvAddr = System.getProperty(MixAll.NAMESRV_ADDR_PROPERTY, System.getenv(MixAll.NAMESRV_ADDR_ENV)); private String namesrvAddr = System.getProperty(MixAll.NAMESRV_ADDR_PROPERTY, System.getenv(MixAll.NAMESRV_ADDR_ENV));
...@@ -121,16 +127,6 @@ public class BrokerConfig { ...@@ -121,16 +127,6 @@ public class BrokerConfig {
private boolean filterSupportRetry = false; private boolean filterSupportRetry = false;
private boolean enablePropertyFilter = false; private boolean enablePropertyFilter = false;
public static String localHostName() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return "DEFAULT_BROKER";
}
public boolean isTraceOn() { public boolean isTraceOn() {
return traceOn; return traceOn;
} }
...@@ -179,6 +175,16 @@ public class BrokerConfig { ...@@ -179,6 +175,16 @@ public class BrokerConfig {
this.slaveReadEnable = slaveReadEnable; this.slaveReadEnable = slaveReadEnable;
} }
public static String localHostName() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
log.error("Failed to obtain the host name", e);
}
return "DEFAULT_BROKER";
}
public int getRegisterBrokerTimeoutMills() { public int getRegisterBrokerTimeoutMills() {
return registerBrokerTimeoutMills; return registerBrokerTimeoutMills;
} }
......
...@@ -22,7 +22,7 @@ import org.slf4j.Logger; ...@@ -22,7 +22,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public abstract class ConfigManager { public abstract class ConfigManager {
private static final Logger PLOG = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME); private static final Logger log = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME);
public abstract String encode(); public abstract String encode();
...@@ -36,11 +36,11 @@ public abstract class ConfigManager { ...@@ -36,11 +36,11 @@ public abstract class ConfigManager {
return this.loadBak(); return this.loadBak();
} else { } else {
this.decode(jsonString); this.decode(jsonString);
PLOG.info("load {} OK", fileName); log.info("load {} OK", fileName);
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {
PLOG.error("load " + fileName + " Failed, and try to load backup file", e); log.error("load [{}] failed, and try to load backup file", fileName, e);
return this.loadBak(); return this.loadBak();
} }
} }
...@@ -54,11 +54,11 @@ public abstract class ConfigManager { ...@@ -54,11 +54,11 @@ public abstract class ConfigManager {
String jsonString = MixAll.file2String(fileName + ".bak"); String jsonString = MixAll.file2String(fileName + ".bak");
if (jsonString != null && jsonString.length() > 0) { if (jsonString != null && jsonString.length() > 0) {
this.decode(jsonString); this.decode(jsonString);
PLOG.info("load " + fileName + " OK"); log.info("load [{}] OK", fileName);
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {
PLOG.error("load " + fileName + " Failed", e); log.error("load [{}] Failed", fileName, e);
return false; return false;
} }
...@@ -74,7 +74,7 @@ public abstract class ConfigManager { ...@@ -74,7 +74,7 @@ public abstract class ConfigManager {
try { try {
MixAll.string2File(jsonString, fileName); MixAll.string2File(jsonString, fileName);
} catch (IOException e) { } catch (IOException e) {
PLOG.error("persist file Exception, " + fileName, e); log.error("persist file [{}] exception", fileName, e);
} }
} }
} }
......
...@@ -22,7 +22,6 @@ import java.io.FileInputStream; ...@@ -22,7 +22,6 @@ import java.io.FileInputStream;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -43,10 +42,14 @@ import java.util.Properties; ...@@ -43,10 +42,14 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import org.apache.rocketmq.common.annotation.ImportantField; import org.apache.rocketmq.common.annotation.ImportantField;
import org.apache.rocketmq.common.constant.LoggerName;
import org.apache.rocketmq.common.help.FAQUrl; import org.apache.rocketmq.common.help.FAQUrl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MixAll { public class MixAll {
private static final Logger log = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME);
public static final String ROCKETMQ_HOME_ENV = "ROCKETMQ_HOME"; public static final String ROCKETMQ_HOME_ENV = "ROCKETMQ_HOME";
public static final String ROCKETMQ_HOME_PROPERTY = "rocketmq.home.dir"; public static final String ROCKETMQ_HOME_PROPERTY = "rocketmq.home.dir";
public static final String NAMESRV_ADDR_ENV = "NAMESRV_ADDR"; public static final String NAMESRV_ADDR_ENV = "NAMESRV_ADDR";
...@@ -243,11 +246,11 @@ public class MixAll { ...@@ -243,11 +246,11 @@ public class MixAll {
return url.getPath(); return url.getPath();
} }
public static void printObjectProperties(final Logger log, final Object object) { public static void printObjectProperties(final Logger logger, final Object object) {
printObjectProperties(log, object, false); printObjectProperties(logger, object, false);
} }
public static void printObjectProperties(final Logger log, final Object object, final boolean onlyImportantField) { public static void printObjectProperties(final Logger logger, final Object object, final boolean onlyImportantField) {
Field[] fields = object.getClass().getDeclaredFields(); Field[] fields = object.getClass().getDeclaredFields();
for (Field field : fields) { for (Field field : fields) {
if (!Modifier.isStatic(field.getModifiers())) { if (!Modifier.isStatic(field.getModifiers())) {
...@@ -261,7 +264,7 @@ public class MixAll { ...@@ -261,7 +264,7 @@ public class MixAll {
value = ""; value = "";
} }
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
e.printStackTrace(); log.error("Failed to obtain object properties", e);
} }
if (onlyImportantField) { if (onlyImportantField) {
...@@ -271,8 +274,9 @@ public class MixAll { ...@@ -271,8 +274,9 @@ public class MixAll {
} }
} }
if (log != null) { if (logger != null) {
log.info(name + "=" + value); logger.info(name + "=" + value);
} else {
} }
} }
} }
...@@ -294,11 +298,8 @@ public class MixAll { ...@@ -294,11 +298,8 @@ public class MixAll {
try { try {
InputStream in = new ByteArrayInputStream(str.getBytes(DEFAULT_CHARSET)); InputStream in = new ByteArrayInputStream(str.getBytes(DEFAULT_CHARSET));
properties.load(in); properties.load(in);
} catch (UnsupportedEncodingException e) { } catch (Exception e) {
e.printStackTrace(); log.error("Failed to handle properties", e);
return null;
} catch (IOException e) {
e.printStackTrace();
return null; return null;
} }
...@@ -318,7 +319,7 @@ public class MixAll { ...@@ -318,7 +319,7 @@ public class MixAll {
field.setAccessible(true); field.setAccessible(true);
value = field.get(object); value = field.get(object);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
e.printStackTrace(); log.error("Failed to handle properties", e);
} }
if (value != null) { if (value != null) {
......
...@@ -23,7 +23,8 @@ import org.slf4j.Logger; ...@@ -23,7 +23,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public abstract class ServiceThread implements Runnable { public abstract class ServiceThread implements Runnable {
private static final Logger STLOG = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME); private static final Logger log = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME);
private static final long JOIN_TIME = 90 * 1000; private static final long JOIN_TIME = 90 * 1000;
protected final Thread thread; protected final Thread thread;
...@@ -47,7 +48,7 @@ public abstract class ServiceThread implements Runnable { ...@@ -47,7 +48,7 @@ public abstract class ServiceThread implements Runnable {
public void shutdown(final boolean interrupt) { public void shutdown(final boolean interrupt) {
this.stopped = true; this.stopped = true;
STLOG.info("shutdown thread " + this.getServiceName() + " interrupt " + interrupt); log.info("shutdown thread " + this.getServiceName() + " interrupt " + interrupt);
if (hasNotified.compareAndSet(false, true)) { if (hasNotified.compareAndSet(false, true)) {
waitPoint.countDown(); // notify waitPoint.countDown(); // notify
...@@ -63,10 +64,10 @@ public abstract class ServiceThread implements Runnable { ...@@ -63,10 +64,10 @@ public abstract class ServiceThread implements Runnable {
this.thread.join(this.getJointime()); this.thread.join(this.getJointime());
} }
long eclipseTime = System.currentTimeMillis() - beginTime; long eclipseTime = System.currentTimeMillis() - beginTime;
STLOG.info("join thread " + this.getServiceName() + " eclipse time(ms) " + eclipseTime + " " log.info("join thread " + this.getServiceName() + " eclipse time(ms) " + eclipseTime + " "
+ this.getJointime()); + this.getJointime());
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("Interrupted", e);
} }
} }
...@@ -80,7 +81,7 @@ public abstract class ServiceThread implements Runnable { ...@@ -80,7 +81,7 @@ public abstract class ServiceThread implements Runnable {
public void stop(final boolean interrupt) { public void stop(final boolean interrupt) {
this.stopped = true; this.stopped = true;
STLOG.info("stop thread " + this.getServiceName() + " interrupt " + interrupt); log.info("stop thread " + this.getServiceName() + " interrupt " + interrupt);
if (hasNotified.compareAndSet(false, true)) { if (hasNotified.compareAndSet(false, true)) {
waitPoint.countDown(); // notify waitPoint.countDown(); // notify
...@@ -93,7 +94,7 @@ public abstract class ServiceThread implements Runnable { ...@@ -93,7 +94,7 @@ public abstract class ServiceThread implements Runnable {
public void makeStop() { public void makeStop() {
this.stopped = true; this.stopped = true;
STLOG.info("makestop thread " + this.getServiceName()); log.info("makestop thread " + this.getServiceName());
} }
public void wakeup() { public void wakeup() {
...@@ -114,7 +115,7 @@ public abstract class ServiceThread implements Runnable { ...@@ -114,7 +115,7 @@ public abstract class ServiceThread implements Runnable {
try { try {
waitPoint.await(interval, TimeUnit.MILLISECONDS); waitPoint.await(interval, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("Interrupted", e);
} finally { } finally {
hasNotified.set(false); hasNotified.set(false);
this.onWaitEnd(); this.onWaitEnd();
......
...@@ -36,9 +36,16 @@ import java.util.Map; ...@@ -36,9 +36,16 @@ import java.util.Map;
import java.util.zip.CRC32; import java.util.zip.CRC32;
import java.util.zip.DeflaterOutputStream; import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream; import java.util.zip.InflaterInputStream;
import org.apache.rocketmq.common.constant.LoggerName;
import org.apache.rocketmq.remoting.common.RemotingHelper; import org.apache.rocketmq.remoting.common.RemotingHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UtilAll { public class UtilAll {
private static final Logger log = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME);
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
public static final String YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd#HH:mm:ss:SSS"; public static final String YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd#HH:mm:ss:SSS";
public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
...@@ -269,15 +276,18 @@ public class UtilAll { ...@@ -269,15 +276,18 @@ public class UtilAll {
} finally { } finally {
try { try {
byteArrayInputStream.close(); byteArrayInputStream.close();
} catch (IOException ignored) { } catch (IOException e) {
log.error("Failed to close the stream", e);
} }
try { try {
inflaterInputStream.close(); inflaterInputStream.close();
} catch (IOException ignored) { } catch (IOException e) {
log.error("Failed to close the stream", e);
} }
try { try {
byteArrayOutputStream.close(); byteArrayOutputStream.close();
} catch (IOException ignored) { } catch (IOException e) {
log.error("Failed to close the stream", e);
} }
} }
......
...@@ -28,8 +28,8 @@ import org.slf4j.LoggerFactory; ...@@ -28,8 +28,8 @@ import org.slf4j.LoggerFactory;
public class NamesrvConfig { public class NamesrvConfig {
private static final Logger log = LoggerFactory.getLogger(LoggerName.NAMESRV_LOGGER_NAME); private static final Logger log = LoggerFactory.getLogger(LoggerName.NAMESRV_LOGGER_NAME);
private String rocketmqHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV));
private String rocketmqHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV));
private String kvConfigPath = System.getProperty("user.home") + File.separator + "namesrv" + File.separator + "kvConfig.json"; private String kvConfigPath = System.getProperty("user.home") + File.separator + "namesrv" + File.separator + "kvConfig.json";
private String configStorePath = System.getProperty("user.home") + File.separator + "namesrv" + File.separator + "namesrv.properties"; private String configStorePath = System.getProperty("user.home") + File.separator + "namesrv" + File.separator + "namesrv.properties";
private String productEnvName = "center"; private String productEnvName = "center";
......
...@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory; ...@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
public class TopAddressing { public class TopAddressing {
private static final Logger log = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME); private static final Logger log = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME);
private String nsAddr; private String nsAddr;
private String wsAddr; private String wsAddr;
private String unitName; private String unitName;
......
...@@ -17,11 +17,16 @@ ...@@ -17,11 +17,16 @@
package org.apache.rocketmq.common.protocol; package org.apache.rocketmq.common.protocol;
import org.apache.rocketmq.common.constant.LoggerName;
import org.apache.rocketmq.common.protocol.header.namesrv.RegisterBrokerRequestHeader; import org.apache.rocketmq.common.protocol.header.namesrv.RegisterBrokerRequestHeader;
import org.apache.rocketmq.remoting.common.RemotingHelper; import org.apache.rocketmq.remoting.common.RemotingHelper;
import org.apache.rocketmq.remoting.protocol.RemotingCommand; import org.apache.rocketmq.remoting.protocol.RemotingCommand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MQProtosHelper { public class MQProtosHelper {
private static final Logger log = LoggerFactory.getLogger(LoggerName.COMMON_LOGGER_NAME);
public static boolean registerBrokerToNameServer(final String nsaddr, final String brokerAddr, public static boolean registerBrokerToNameServer(final String nsaddr, final String brokerAddr,
final long timeoutMillis) { final long timeoutMillis) {
RegisterBrokerRequestHeader requestHeader = new RegisterBrokerRequestHeader(); RegisterBrokerRequestHeader requestHeader = new RegisterBrokerRequestHeader();
...@@ -36,7 +41,7 @@ public class MQProtosHelper { ...@@ -36,7 +41,7 @@ public class MQProtosHelper {
return ResponseCode.SUCCESS == response.getCode(); return ResponseCode.SUCCESS == response.getCode();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Failed to register broker", e);
} }
return false; return false;
......
...@@ -44,7 +44,7 @@ import org.slf4j.Logger; ...@@ -44,7 +44,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class DynaCode { public class DynaCode {
private static final Logger LOGGER = LoggerFactory.getLogger(LoggerName.FILTERSRV_LOGGER_NAME); private static final Logger log = LoggerFactory.getLogger(LoggerName.FILTERSRV_LOGGER_NAME);
private static final String FILE_SP = System.getProperty("file.separator"); private static final String FILE_SP = System.getProperty("file.separator");
...@@ -231,7 +231,7 @@ public class DynaCode { ...@@ -231,7 +231,7 @@ public class DynaCode {
loadClass.put(getFullClassName(code), null); loadClass.put(getFullClassName(code), null);
} }
if (null != srcFile) { if (null != srcFile) {
LOGGER.warn("Dyna Create Java Source File:---->" + srcFile.getAbsolutePath()); log.warn("Dyna Create Java Source File:----> {}", srcFile.getAbsolutePath());
srcFileAbsolutePaths.add(srcFile.getAbsolutePath()); srcFileAbsolutePaths.add(srcFile.getAbsolutePath());
srcFile.deleteOnExit(); srcFile.deleteOnExit();
} }
...@@ -277,9 +277,9 @@ public class DynaCode { ...@@ -277,9 +277,9 @@ public class DynaCode {
Class<?> classz = classLoader.loadClass(key); Class<?> classz = classLoader.loadClass(key);
if (null != classz) { if (null != classz) {
loadClass.put(key, classz); loadClass.put(key, classz);
LOGGER.info("Dyna Load Java Class File OK:----> className: " + key); log.info("Dyna Load Java Class File OK:----> className: {}", key);
} else { } else {
LOGGER.error("Dyna Load Java Class File Fail:----> className: " + key); log.error("Dyna Load Java Class File Fail:----> className: {}", key);
} }
} }
} }
......
...@@ -45,7 +45,7 @@ public class ClusterTestRequestProcessor extends DefaultRequestProcessor { ...@@ -45,7 +45,7 @@ public class ClusterTestRequestProcessor extends DefaultRequestProcessor {
try { try {
adminExt.start(); adminExt.start();
} catch (MQClientException e) { } catch (MQClientException e) {
e.printStackTrace(); log.error("Failed to start processor", e);
} }
} }
......
...@@ -26,11 +26,15 @@ import org.apache.rocketmq.remoting.exception.RemotingConnectException; ...@@ -26,11 +26,15 @@ import org.apache.rocketmq.remoting.exception.RemotingConnectException;
import org.apache.rocketmq.remoting.exception.RemotingSendRequestException; import org.apache.rocketmq.remoting.exception.RemotingSendRequestException;
import org.apache.rocketmq.remoting.exception.RemotingTimeoutException; import org.apache.rocketmq.remoting.exception.RemotingTimeoutException;
import org.apache.rocketmq.remoting.protocol.RemotingCommand; import org.apache.rocketmq.remoting.protocol.RemotingCommand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RemotingHelper { public class RemotingHelper {
public static final String ROCKETMQ_REMOTING = "RocketmqRemoting"; public static final String ROCKETMQ_REMOTING = "RocketmqRemoting";
public static final String DEFAULT_CHARSET = "UTF-8"; public static final String DEFAULT_CHARSET = "UTF-8";
private static final Logger log = LoggerFactory.getLogger(ROCKETMQ_REMOTING);
public static String exceptionSimpleDesc(final Throwable e) { public static String exceptionSimpleDesc(final Throwable e) {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if (e != null) { if (e != null) {
...@@ -126,7 +130,7 @@ public class RemotingHelper { ...@@ -126,7 +130,7 @@ public class RemotingHelper {
byteBufferBody.flip(); byteBufferBody.flip();
return RemotingCommand.decode(byteBufferBody); return RemotingCommand.decode(byteBufferBody);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("invokeSync failure", e);
if (sendRequestOK) { if (sendRequestOK) {
throw new RemotingTimeoutException(addr, timeoutMillis); throw new RemotingTimeoutException(addr, timeoutMillis);
......
...@@ -26,8 +26,6 @@ import java.net.InetAddress; ...@@ -26,8 +26,6 @@ import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.NetworkInterface; import java.net.NetworkInterface;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.nio.channels.Selector; import java.nio.channels.Selector;
import java.nio.channels.SocketChannel; import java.nio.channels.SocketChannel;
import java.nio.channels.spi.SelectorProvider; import java.nio.channels.spi.SelectorProvider;
...@@ -130,10 +128,8 @@ public class RemotingUtil { ...@@ -130,10 +128,8 @@ public class RemotingUtil {
//If failed to find,fall back to localhost //If failed to find,fall back to localhost
final InetAddress localHost = InetAddress.getLocalHost(); final InetAddress localHost = InetAddress.getLocalHost();
return normalizeHostAddress(localHost); return normalizeHostAddress(localHost);
} catch (SocketException e) { } catch (Exception e) {
e.printStackTrace(); log.error("Failed to obtain local address", e);
} catch (UnknownHostException e) {
e.printStackTrace();
} }
return null; return null;
......
...@@ -23,7 +23,8 @@ import org.slf4j.LoggerFactory; ...@@ -23,7 +23,8 @@ import org.slf4j.LoggerFactory;
* Base class for background thread * Base class for background thread
*/ */
public abstract class ServiceThread implements Runnable { public abstract class ServiceThread implements Runnable {
private static final Logger STLOG = LoggerFactory.getLogger(RemotingHelper.ROCKETMQ_REMOTING); private static final Logger log = LoggerFactory.getLogger(RemotingHelper.ROCKETMQ_REMOTING);
private static final long JOIN_TIME = 90 * 1000; private static final long JOIN_TIME = 90 * 1000;
protected final Thread thread; protected final Thread thread;
protected volatile boolean hasNotified = false; protected volatile boolean hasNotified = false;
...@@ -45,7 +46,7 @@ public abstract class ServiceThread implements Runnable { ...@@ -45,7 +46,7 @@ public abstract class ServiceThread implements Runnable {
public void shutdown(final boolean interrupt) { public void shutdown(final boolean interrupt) {
this.stopped = true; this.stopped = true;
STLOG.info("shutdown thread " + this.getServiceName() + " interrupt " + interrupt); log.info("shutdown thread " + this.getServiceName() + " interrupt " + interrupt);
synchronized (this) { synchronized (this) {
if (!this.hasNotified) { if (!this.hasNotified) {
this.hasNotified = true; this.hasNotified = true;
...@@ -61,10 +62,10 @@ public abstract class ServiceThread implements Runnable { ...@@ -61,10 +62,10 @@ public abstract class ServiceThread implements Runnable {
long beginTime = System.currentTimeMillis(); long beginTime = System.currentTimeMillis();
this.thread.join(this.getJointime()); this.thread.join(this.getJointime());
long eclipseTime = System.currentTimeMillis() - beginTime; long eclipseTime = System.currentTimeMillis() - beginTime;
STLOG.info("join thread " + this.getServiceName() + " eclipse time(ms) " + eclipseTime + " " log.info("join thread " + this.getServiceName() + " eclipse time(ms) " + eclipseTime + " "
+ this.getJointime()); + this.getJointime());
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("Interrupted", e);
} }
} }
...@@ -78,7 +79,7 @@ public abstract class ServiceThread implements Runnable { ...@@ -78,7 +79,7 @@ public abstract class ServiceThread implements Runnable {
public void stop(final boolean interrupt) { public void stop(final boolean interrupt) {
this.stopped = true; this.stopped = true;
STLOG.info("stop thread " + this.getServiceName() + " interrupt " + interrupt); log.info("stop thread " + this.getServiceName() + " interrupt " + interrupt);
synchronized (this) { synchronized (this) {
if (!this.hasNotified) { if (!this.hasNotified) {
this.hasNotified = true; this.hasNotified = true;
...@@ -93,7 +94,7 @@ public abstract class ServiceThread implements Runnable { ...@@ -93,7 +94,7 @@ public abstract class ServiceThread implements Runnable {
public void makeStop() { public void makeStop() {
this.stopped = true; this.stopped = true;
STLOG.info("makestop thread " + this.getServiceName()); log.info("makestop thread " + this.getServiceName());
} }
public void wakeup() { public void wakeup() {
...@@ -116,7 +117,7 @@ public abstract class ServiceThread implements Runnable { ...@@ -116,7 +117,7 @@ public abstract class ServiceThread implements Runnable {
try { try {
this.wait(interval); this.wait(interval);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("Interrupted", e);
} finally { } finally {
this.hasNotified = false; this.hasNotified = false;
this.onWaitEnd(); this.onWaitEnd();
......
...@@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory; ...@@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
public class NettyDecoder extends LengthFieldBasedFrameDecoder { public class NettyDecoder extends LengthFieldBasedFrameDecoder {
private static final Logger log = LoggerFactory.getLogger(RemotingHelper.ROCKETMQ_REMOTING); private static final Logger log = LoggerFactory.getLogger(RemotingHelper.ROCKETMQ_REMOTING);
private static final int FRAME_MAX_LENGTH = // private static final int FRAME_MAX_LENGTH = //
Integer.parseInt(System.getProperty("com.rocketmq.remoting.frameMaxLength", "16777216")); Integer.parseInt(System.getProperty("com.rocketmq.remoting.frameMaxLength", "16777216"));
......
...@@ -53,7 +53,7 @@ public abstract class NettyRemotingAbstract { ...@@ -53,7 +53,7 @@ public abstract class NettyRemotingAbstract {
/** /**
* Remoting logger instance. * Remoting logger instance.
*/ */
private static final Logger PLOG = LoggerFactory.getLogger(RemotingHelper.ROCKETMQ_REMOTING); private static final Logger log = LoggerFactory.getLogger(RemotingHelper.ROCKETMQ_REMOTING);
/** /**
* Semaphore to limit maximum number of on-going one-way requests, which protects system memory footprint. * Semaphore to limit maximum number of on-going one-way requests, which protects system memory footprint.
...@@ -175,17 +175,17 @@ public abstract class NettyRemotingAbstract { ...@@ -175,17 +175,17 @@ public abstract class NettyRemotingAbstract {
try { try {
ctx.writeAndFlush(response); ctx.writeAndFlush(response);
} catch (Throwable e) { } catch (Throwable e) {
PLOG.error("process request over, but response failed", e); log.error("process request over, but response failed", e);
PLOG.error(cmd.toString()); log.error(cmd.toString());
PLOG.error(response.toString()); log.error(response.toString());
} }
} else { } else {
} }
} }
} catch (Throwable e) { } catch (Throwable e) {
PLOG.error("process request exception", e); log.error("process request exception", e);
PLOG.error(cmd.toString()); log.error(cmd.toString());
if (!cmd.isOnewayRPC()) { if (!cmd.isOnewayRPC()) {
final RemotingCommand response = RemotingCommand.createResponseCommand(RemotingSysResponseCode.SYSTEM_ERROR, // final RemotingCommand response = RemotingCommand.createResponseCommand(RemotingSysResponseCode.SYSTEM_ERROR, //
...@@ -210,7 +210,7 @@ public abstract class NettyRemotingAbstract { ...@@ -210,7 +210,7 @@ public abstract class NettyRemotingAbstract {
pair.getObject2().submit(requestTask); pair.getObject2().submit(requestTask);
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
if ((System.currentTimeMillis() % 10000) == 0) { if ((System.currentTimeMillis() % 10000) == 0) {
PLOG.warn(RemotingHelper.parseChannelRemoteAddr(ctx.channel()) // log.warn(RemotingHelper.parseChannelRemoteAddr(ctx.channel()) //
+ ", too many requests and system thread pool busy, RejectedExecutionException " // + ", too many requests and system thread pool busy, RejectedExecutionException " //
+ pair.getObject2().toString() // + pair.getObject2().toString() //
+ " request code: " + cmd.getCode()); + " request code: " + cmd.getCode());
...@@ -229,7 +229,7 @@ public abstract class NettyRemotingAbstract { ...@@ -229,7 +229,7 @@ public abstract class NettyRemotingAbstract {
RemotingCommand.createResponseCommand(RemotingSysResponseCode.REQUEST_CODE_NOT_SUPPORTED, error); RemotingCommand.createResponseCommand(RemotingSysResponseCode.REQUEST_CODE_NOT_SUPPORTED, error);
response.setOpaque(opaque); response.setOpaque(opaque);
ctx.writeAndFlush(response); ctx.writeAndFlush(response);
PLOG.error(RemotingHelper.parseChannelRemoteAddr(ctx.channel()) + error); log.error(RemotingHelper.parseChannelRemoteAddr(ctx.channel()) + error);
} }
} }
...@@ -254,8 +254,8 @@ public abstract class NettyRemotingAbstract { ...@@ -254,8 +254,8 @@ public abstract class NettyRemotingAbstract {
responseFuture.putResponse(cmd); responseFuture.putResponse(cmd);
} }
} else { } else {
PLOG.warn("receive response, but not matched any request, " + RemotingHelper.parseChannelRemoteAddr(ctx.channel())); log.warn("receive response, but not matched any request, " + RemotingHelper.parseChannelRemoteAddr(ctx.channel()));
PLOG.warn(cmd.toString()); log.warn(cmd.toString());
} }
} }
...@@ -274,13 +274,13 @@ public abstract class NettyRemotingAbstract { ...@@ -274,13 +274,13 @@ public abstract class NettyRemotingAbstract {
try { try {
responseFuture.executeInvokeCallback(); responseFuture.executeInvokeCallback();
} catch (Throwable e) { } catch (Throwable e) {
PLOG.warn("execute callback in executor exception, and callback throw", e); log.warn("execute callback in executor exception, and callback throw", e);
} }
} }
}); });
} catch (Exception e) { } catch (Exception e) {
runInThisThread = true; runInThisThread = true;
PLOG.warn("execute callback in executor exception, maybe executor busy", e); log.warn("execute callback in executor exception, maybe executor busy", e);
} }
} else { } else {
runInThisThread = true; runInThisThread = true;
...@@ -290,7 +290,7 @@ public abstract class NettyRemotingAbstract { ...@@ -290,7 +290,7 @@ public abstract class NettyRemotingAbstract {
try { try {
responseFuture.executeInvokeCallback(); responseFuture.executeInvokeCallback();
} catch (Throwable e) { } catch (Throwable e) {
PLOG.warn("executeInvokeCallback Exception", e); log.warn("executeInvokeCallback Exception", e);
} }
} }
} }
...@@ -324,7 +324,7 @@ public abstract class NettyRemotingAbstract { ...@@ -324,7 +324,7 @@ public abstract class NettyRemotingAbstract {
rep.release(); rep.release();
it.remove(); it.remove();
rfList.add(rep); rfList.add(rep);
PLOG.warn("remove timeout request, " + rep); log.warn("remove timeout request, " + rep);
} }
} }
...@@ -332,7 +332,7 @@ public abstract class NettyRemotingAbstract { ...@@ -332,7 +332,7 @@ public abstract class NettyRemotingAbstract {
try { try {
executeInvokeCallback(rf); executeInvokeCallback(rf);
} catch (Throwable e) { } catch (Throwable e) {
PLOG.warn("scanResponseTable, operationComplete Exception", e); log.warn("scanResponseTable, operationComplete Exception", e);
} }
} }
} }
...@@ -358,7 +358,7 @@ public abstract class NettyRemotingAbstract { ...@@ -358,7 +358,7 @@ public abstract class NettyRemotingAbstract {
responseTable.remove(opaque); responseTable.remove(opaque);
responseFuture.setCause(f.cause()); responseFuture.setCause(f.cause());
responseFuture.putResponse(null); responseFuture.putResponse(null);
PLOG.warn("send a request command to channel <" + addr + "> failed."); log.warn("send a request command to channel <" + addr + "> failed.");
} }
}); });
...@@ -404,17 +404,17 @@ public abstract class NettyRemotingAbstract { ...@@ -404,17 +404,17 @@ public abstract class NettyRemotingAbstract {
try { try {
executeInvokeCallback(responseFuture); executeInvokeCallback(responseFuture);
} catch (Throwable e) { } catch (Throwable e) {
PLOG.warn("excute callback in writeAndFlush addListener, and callback throw", e); log.warn("excute callback in writeAndFlush addListener, and callback throw", e);
} finally { } finally {
responseFuture.release(); responseFuture.release();
} }
PLOG.warn("send a request command to channel <{}> failed.", RemotingHelper.parseChannelRemoteAddr(channel)); log.warn("send a request command to channel <{}> failed.", RemotingHelper.parseChannelRemoteAddr(channel));
} }
}); });
} catch (Exception e) { } catch (Exception e) {
responseFuture.release(); responseFuture.release();
PLOG.warn("send a request command to channel <" + RemotingHelper.parseChannelRemoteAddr(channel) + "> Exception", e); log.warn("send a request command to channel <" + RemotingHelper.parseChannelRemoteAddr(channel) + "> Exception", e);
throw new RemotingSendRequestException(RemotingHelper.parseChannelRemoteAddr(channel), e); throw new RemotingSendRequestException(RemotingHelper.parseChannelRemoteAddr(channel), e);
} }
} else { } else {
...@@ -427,7 +427,7 @@ public abstract class NettyRemotingAbstract { ...@@ -427,7 +427,7 @@ public abstract class NettyRemotingAbstract {
this.semaphoreAsync.getQueueLength(), // this.semaphoreAsync.getQueueLength(), //
this.semaphoreAsync.availablePermits()// this.semaphoreAsync.availablePermits()//
); );
PLOG.warn(info); log.warn(info);
throw new RemotingTimeoutException(info); throw new RemotingTimeoutException(info);
} }
} }
...@@ -445,13 +445,13 @@ public abstract class NettyRemotingAbstract { ...@@ -445,13 +445,13 @@ public abstract class NettyRemotingAbstract {
public void operationComplete(ChannelFuture f) throws Exception { public void operationComplete(ChannelFuture f) throws Exception {
once.release(); once.release();
if (!f.isSuccess()) { if (!f.isSuccess()) {
PLOG.warn("send a request command to channel <" + channel.remoteAddress() + "> failed."); log.warn("send a request command to channel <" + channel.remoteAddress() + "> failed.");
} }
} }
}); });
} catch (Exception e) { } catch (Exception e) {
once.release(); once.release();
PLOG.warn("write send a request command to channel <" + channel.remoteAddress() + "> failed."); log.warn("write send a request command to channel <" + channel.remoteAddress() + "> failed.");
throw new RemotingSendRequestException(RemotingHelper.parseChannelRemoteAddr(channel), e); throw new RemotingSendRequestException(RemotingHelper.parseChannelRemoteAddr(channel), e);
} }
} else { } else {
...@@ -464,7 +464,7 @@ public abstract class NettyRemotingAbstract { ...@@ -464,7 +464,7 @@ public abstract class NettyRemotingAbstract {
this.semaphoreOneway.getQueueLength(), // this.semaphoreOneway.getQueueLength(), //
this.semaphoreOneway.availablePermits()// this.semaphoreOneway.availablePermits()//
); );
PLOG.warn(info); log.warn(info);
throw new RemotingTimeoutException(info); throw new RemotingTimeoutException(info);
} }
} }
...@@ -478,13 +478,13 @@ public abstract class NettyRemotingAbstract { ...@@ -478,13 +478,13 @@ public abstract class NettyRemotingAbstract {
if (this.eventQueue.size() <= maxSize) { if (this.eventQueue.size() <= maxSize) {
this.eventQueue.add(event); this.eventQueue.add(event);
} else { } else {
PLOG.warn("event queue size[{}] enough, so drop this event {}", this.eventQueue.size(), event.toString()); log.warn("event queue size[{}] enough, so drop this event {}", this.eventQueue.size(), event.toString());
} }
} }
@Override @Override
public void run() { public void run() {
PLOG.info(this.getServiceName() + " service started"); log.info(this.getServiceName() + " service started");
final ChannelEventListener listener = NettyRemotingAbstract.this.getChannelEventListener(); final ChannelEventListener listener = NettyRemotingAbstract.this.getChannelEventListener();
...@@ -511,11 +511,11 @@ public abstract class NettyRemotingAbstract { ...@@ -511,11 +511,11 @@ public abstract class NettyRemotingAbstract {
} }
} }
} catch (Exception e) { } catch (Exception e) {
PLOG.warn(this.getServiceName() + " service has exception. ", e); log.warn(this.getServiceName() + " service has exception. ", e);
} }
} }
PLOG.info(this.getServiceName() + " service end"); log.info(this.getServiceName() + " service end");
} }
@Override @Override
......
...@@ -127,7 +127,7 @@ public class AllocateMappedFileService extends ServiceThread { ...@@ -127,7 +127,7 @@ public class AllocateMappedFileService extends ServiceThread {
try { try {
this.thread.join(this.getJointime()); this.thread.join(this.getJointime());
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("Interrupted", e);
} }
for (AllocateRequest req : this.requestTable.values()) { for (AllocateRequest req : this.requestTable.values()) {
......
...@@ -903,35 +903,6 @@ public class CommitLog { ...@@ -903,35 +903,6 @@ public class CommitLog {
public static class GroupCommitRequest {
private final long nextOffset;
private final CountDownLatch countDownLatch = new CountDownLatch(1);
private volatile boolean flushOK = false;
public GroupCommitRequest(long nextOffset) {
this.nextOffset = nextOffset;
}
public long getNextOffset() {
return nextOffset;
}
public void wakeupCustomer(final boolean flushOK) {
this.flushOK = flushOK;
this.countDownLatch.countDown();
}
public boolean waitForFlush(long timeout) {
try {
this.countDownLatch.await(timeout, TimeUnit.MILLISECONDS);
return this.flushOK;
} catch (InterruptedException e) {
e.printStackTrace();
return false;
}
}
}
abstract class FlushCommitLogService extends ServiceThread { abstract class FlushCommitLogService extends ServiceThread {
protected static final int RETRY_TIMES_OVER = 10; protected static final int RETRY_TIMES_OVER = 10;
} }
...@@ -1070,6 +1041,39 @@ public class CommitLog { ...@@ -1070,6 +1041,39 @@ public class CommitLog {
} }
} }
public static class GroupCommitRequest {
private final long nextOffset;
private final CountDownLatch countDownLatch = new CountDownLatch(1);
private volatile boolean flushOK = false;
public GroupCommitRequest(long nextOffset) {
this.nextOffset = nextOffset;
}
public long getNextOffset() {
return nextOffset;
}
public void wakeupCustomer(final boolean flushOK) {
this.flushOK = flushOK;
this.countDownLatch.countDown();
}
public boolean waitForFlush(long timeout) {
try {
this.countDownLatch.await(timeout, TimeUnit.MILLISECONDS);
return this.flushOK;
} catch (InterruptedException e) {
log.error("Interrupted", e);
return false;
}
}
}
/** /**
* GroupCommit Service * GroupCommit Service
*/ */
......
...@@ -25,9 +25,9 @@ import org.slf4j.Logger; ...@@ -25,9 +25,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class ConsumeQueue { public class ConsumeQueue {
private static final Logger log = LoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME);
public static final int CQ_STORE_UNIT_SIZE = 20; public static final int CQ_STORE_UNIT_SIZE = 20;
private static final Logger log = LoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME);
private static final Logger LOG_ERROR = LoggerFactory.getLogger(LoggerName.STORE_ERROR_LOGGER_NAME); private static final Logger LOG_ERROR = LoggerFactory.getLogger(LoggerName.STORE_ERROR_LOGGER_NAME);
private final DefaultMessageStore defaultMessageStore; private final DefaultMessageStore defaultMessageStore;
......
...@@ -512,7 +512,7 @@ public class MappedFile extends ReferenceResource { ...@@ -512,7 +512,7 @@ public class MappedFile extends ReferenceResource {
try { try {
Thread.sleep(0); Thread.sleep(0);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("Interrupted", e);
} }
} }
} }
......
...@@ -71,7 +71,7 @@ public class StoreCheckpoint { ...@@ -71,7 +71,7 @@ public class StoreCheckpoint {
try { try {
this.fileChannel.close(); this.fileChannel.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("Failed to properly close the channel", e);
} }
} }
......
...@@ -16,9 +16,14 @@ ...@@ -16,9 +16,14 @@
*/ */
package org.apache.rocketmq.store.ha; package org.apache.rocketmq.store.ha;
import org.apache.rocketmq.common.constant.LoggerName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap; import java.util.HashMap;
public class WaitNotifyObject { public class WaitNotifyObject {
private static final Logger log = LoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME);
protected final HashMap<Long/* thread id */, Boolean/* notified */> waitingThreadTable = protected final HashMap<Long/* thread id */, Boolean/* notified */> waitingThreadTable =
new HashMap<Long, Boolean>(16); new HashMap<Long, Boolean>(16);
...@@ -45,7 +50,7 @@ public class WaitNotifyObject { ...@@ -45,7 +50,7 @@ public class WaitNotifyObject {
try { try {
this.wait(interval); this.wait(interval);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("Interrupted", e);
} finally { } finally {
this.hasNotified = false; this.hasNotified = false;
this.onWaitEnd(); this.onWaitEnd();
...@@ -84,7 +89,7 @@ public class WaitNotifyObject { ...@@ -84,7 +89,7 @@ public class WaitNotifyObject {
try { try {
this.wait(interval); this.wait(interval);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("Interrupted", e);
} finally { } finally {
this.waitingThreadTable.put(currentThreadId, false); this.waitingThreadTable.put(currentThreadId, false);
this.onWaitEnd(); this.onWaitEnd();
......
...@@ -147,7 +147,7 @@ public class IndexFile { ...@@ -147,7 +147,7 @@ public class IndexFile {
try { try {
fileLock.release(); fileLock.release();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("Failed to release the lock", e);
} }
} }
} }
...@@ -254,7 +254,7 @@ public class IndexFile { ...@@ -254,7 +254,7 @@ public class IndexFile {
try { try {
fileLock.release(); fileLock.release();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("Failed to release the lock", e);
} }
} }
......
...@@ -275,7 +275,7 @@ public class IndexService { ...@@ -275,7 +275,7 @@ public class IndexService {
log.info("Tried to create index file " + times + " times"); log.info("Tried to create index file " + times + " times");
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("Interrupted", e);
} }
} }
......
...@@ -44,8 +44,9 @@ import org.slf4j.Logger; ...@@ -44,8 +44,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class ScheduleMessageService extends ConfigManager { public class ScheduleMessageService extends ConfigManager {
public static final String SCHEDULE_TOPIC = "SCHEDULE_TOPIC_XXXX";
private static final Logger log = LoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME); private static final Logger log = LoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME);
public static final String SCHEDULE_TOPIC = "SCHEDULE_TOPIC_XXXX";
private static final long FIRST_DELAY_TIME = 1000L; private static final long FIRST_DELAY_TIME = 1000L;
private static final long DELAY_FOR_A_WHILE = 100L; private static final long DELAY_FOR_A_WHILE = 100L;
private static final long DELAY_FOR_A_PERIOD = 10000L; private static final long DELAY_FOR_A_PERIOD = 10000L;
......
...@@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory; ...@@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
public class BrokerStats { public class BrokerStats {
private static final Logger log = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME); private static final Logger log = LoggerFactory.getLogger(LoggerName.BROKER_LOGGER_NAME);
private final DefaultMessageStore defaultMessageStore; private final DefaultMessageStore defaultMessageStore;
private volatile long msgPutTotalYesterdayMorning; private volatile long msgPutTotalYesterdayMorning;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册