Skip to content

Commit

Permalink
[ISSUE #1308] Fix some spelling errors of method names. (#1307)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxiangCN authored and vongosling committed Jul 15, 2019
1 parent 6e7df55 commit be7c6dd
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 51 deletions.
Expand Up @@ -319,7 +319,7 @@ public boolean initialize() throws CloneNotSupportedException {

this.registerProcessor();

final long initialDelay = UtilAll.computNextMorningTimeMillis() - System.currentTimeMillis();
final long initialDelay = UtilAll.computeNextMorningTimeMillis() - System.currentTimeMillis();
final long period = 1000 * 60 * 60 * 24;
this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
Expand Down
Expand Up @@ -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.constant.LoggerName;
import org.apache.rocketmq.logging.InternalLogger;
import org.apache.rocketmq.logging.InternalLoggerFactory;
Expand Down Expand Up @@ -98,10 +99,10 @@ public void dispatch(DispatchRequest request) {

request.setBitMap(filterBitMap.bytes());

long eclipseTime = System.currentTimeMillis() - startTime;
long elapsedTime = UtilAll.computeElapsedTimeMilliseconds(startTime);
// 1ms
if (eclipseTime >= 1) {
log.warn("Spend {} ms to calc bit map, consumerNum={}, topic={}", eclipseTime, filterDatas.size(), request.getTopic());
if (elapsedTime >= 1) {
log.warn("Spend {} ms to calc bit map, consumerNum={}, topic={}", elapsedTime, filterDatas.size(), request.getTopic());
}
} catch (Throwable e) {
log.error("Calc bit map error! topic={}, offset={}, queueId={}, {}", request.getTopic(), request.getCommitLogOffset(), request.getQueueId(), e);
Expand Down
Expand Up @@ -78,8 +78,8 @@ public void shutdown(final boolean interrupt) {
if (!this.thread.isDaemon()) {
this.thread.join(this.getJointime());
}
long eclipseTime = System.currentTimeMillis() - beginTime;
log.info("join thread " + this.getServiceName() + " eclipse time(ms) " + eclipseTime + " "
long elapsedTime = System.currentTimeMillis() - beginTime;
log.info("join thread " + this.getServiceName() + " elapsed time(ms) " + elapsedTime + " "
+ this.getJointime());
} catch (InterruptedException e) {
log.error("Interrupted", e);
Expand Down
10 changes: 5 additions & 5 deletions common/src/main/java/org/apache/rocketmq/common/UtilAll.java
Expand Up @@ -93,7 +93,7 @@ public static String offset2FileName(final long offset) {
return nf.format(offset);
}

public static long computeEclipseTimeMilliseconds(final long beginTime) {
public static long computeElapsedTimeMilliseconds(final long beginTime) {
return System.currentTimeMillis() - beginTime;
}

Expand Down Expand Up @@ -124,7 +124,7 @@ public static String timeMillisToHumanString(final long t) {
cal.get(Calendar.MILLISECOND));
}

public static long computNextMorningTimeMillis() {
public static long computeNextMorningTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.add(Calendar.DAY_OF_MONTH, 1);
Expand All @@ -136,7 +136,7 @@ public static long computNextMorningTimeMillis() {
return cal.getTimeInMillis();
}

public static long computNextMinutesTimeMillis() {
public static long computeNextMinutesTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.add(Calendar.DAY_OF_MONTH, 0);
Expand All @@ -148,7 +148,7 @@ public static long computNextMinutesTimeMillis() {
return cal.getTimeInMillis();
}

public static long computNextHourTimeMillis() {
public static long computeNextHourTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.add(Calendar.DAY_OF_MONTH, 0);
Expand All @@ -160,7 +160,7 @@ public static long computNextHourTimeMillis() {
return cal.getTimeInMillis();
}

public static long computNextHalfHourTimeMillis() {
public static long computeNextHalfHourTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.add(Calendar.DAY_OF_MONTH, 0);
Expand Down
Expand Up @@ -51,7 +51,7 @@ public void run() {
} catch (Throwable e) {
}
}
}, Math.abs(UtilAll.computNextMinutesTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 5, TimeUnit.MILLISECONDS);
}, Math.abs(UtilAll.computeNextMinutesTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 5, TimeUnit.MILLISECONDS);
}

public void printAtMinutes() {
Expand Down
Expand Up @@ -58,7 +58,7 @@ public void run() {
} catch (Throwable ignored) {
}
}
}, Math.abs(UtilAll.computNextMinutesTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 5, TimeUnit.MILLISECONDS);
}, Math.abs(UtilAll.computeNextMinutesTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 5, TimeUnit.MILLISECONDS);
}

private void printAtMinutes() {
Expand Down
Expand Up @@ -127,7 +127,7 @@ public void run() {
} catch (Throwable ignored) {
}
}
}, Math.abs(UtilAll.computNextMinutesTimeMillis() - System.currentTimeMillis()), 1000 * 60, TimeUnit.MILLISECONDS);
}, Math.abs(UtilAll.computeNextMinutesTimeMillis() - System.currentTimeMillis()), 1000 * 60, TimeUnit.MILLISECONDS);

this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
Expand All @@ -137,7 +137,7 @@ public void run() {
} catch (Throwable ignored) {
}
}
}, Math.abs(UtilAll.computNextHourTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 60, TimeUnit.MILLISECONDS);
}, Math.abs(UtilAll.computeNextHourTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 60, TimeUnit.MILLISECONDS);

this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
Expand All @@ -147,7 +147,7 @@ public void run() {
} catch (Throwable ignored) {
}
}
}, Math.abs(UtilAll.computNextMorningTimeMillis() - System.currentTimeMillis()) - 2000, 1000 * 60 * 60 * 24, TimeUnit.MILLISECONDS);
}, Math.abs(UtilAll.computeNextMorningTimeMillis() - System.currentTimeMillis()) - 2000, 1000 * 60 * 60 * 24, TimeUnit.MILLISECONDS);
}

public void samplingInSeconds() {
Expand Down
Expand Up @@ -81,7 +81,7 @@ public void run() {
} catch (Throwable ignored) {
}
}
}, Math.abs(UtilAll.computNextMinutesTimeMillis() - System.currentTimeMillis()), 1000 * 60, TimeUnit.MILLISECONDS);
}, Math.abs(UtilAll.computeNextMinutesTimeMillis() - System.currentTimeMillis()), 1000 * 60, TimeUnit.MILLISECONDS);

this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
Expand All @@ -91,7 +91,7 @@ public void run() {
} catch (Throwable ignored) {
}
}
}, Math.abs(UtilAll.computNextHourTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 60, TimeUnit.MILLISECONDS);
}, Math.abs(UtilAll.computeNextHourTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 60, TimeUnit.MILLISECONDS);

this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
Expand All @@ -101,7 +101,7 @@ public void run() {
} catch (Throwable ignored) {
}
}
}, Math.abs(UtilAll.computNextMorningTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 60 * 24, TimeUnit.MILLISECONDS);
}, Math.abs(UtilAll.computeNextMorningTimeMillis() - System.currentTimeMillis()), 1000 * 60 * 60 * 24, TimeUnit.MILLISECONDS);
}

private void samplingInSeconds() {
Expand Down
Expand Up @@ -103,8 +103,8 @@ private List<QueueTimeSpan> newUniqueConsumeTimeSpanSet() {
List<QueueTimeSpan> queueTimeSpans = new ArrayList<QueueTimeSpan>();
QueueTimeSpan queueTimeSpan = new QueueTimeSpan();
queueTimeSpan.setMinTimeStamp(System.currentTimeMillis());
queueTimeSpan.setMaxTimeStamp(UtilAll.computNextHourTimeMillis());
queueTimeSpan.setConsumeTimeStamp(UtilAll.computNextMinutesTimeMillis());
queueTimeSpan.setMaxTimeStamp(UtilAll.computeNextHourTimeMillis());
queueTimeSpan.setConsumeTimeStamp(UtilAll.computeNextMinutesTimeMillis());
queueTimeSpan.setDelayTime(5000l);
MessageQueue messageQueue = new MessageQueue(UUID.randomUUID().toString(), UUID.randomUUID().toString(), new Random().nextInt());
queueTimeSpan.setMessageQueue(messageQueue);
Expand Down
Expand Up @@ -62,8 +62,8 @@ public void shutdown(final boolean interrupt) {

long beginTime = System.currentTimeMillis();
this.thread.join(this.getJointime());
long eclipseTime = System.currentTimeMillis() - beginTime;
log.info("join thread " + this.getServiceName() + " eclipse time(ms) " + eclipseTime + " "
long elapsedTime = System.currentTimeMillis() - beginTime;
log.info("join thread " + this.getServiceName() + " elapsed time(ms) " + elapsedTime + " "
+ this.getJointime());
} catch (InterruptedException e) {
log.error("Interrupted", e);
Expand Down
Expand Up @@ -176,10 +176,10 @@ private boolean mmapOperation() {
mappedFile = new MappedFile(req.getFilePath(), req.getFileSize());
}

long eclipseTime = UtilAll.computeEclipseTimeMilliseconds(beginTime);
if (eclipseTime > 10) {
long elapsedTime = UtilAll.computeElapsedTimeMilliseconds(beginTime);
if (elapsedTime > 10) {
int queueSize = this.requestQueue.size();
log.warn("create mappedFile spent time(ms) " + eclipseTime + " queue size " + queueSize
log.warn("create mappedFile spent time(ms) " + elapsedTime + " queue size " + queueSize
+ " " + req.getFilePath() + " " + req.getFileSize());
}

Expand Down
16 changes: 8 additions & 8 deletions store/src/main/java/org/apache/rocketmq/store/CommitLog.java
Expand Up @@ -569,7 +569,7 @@ public PutMessageResult putMessage(final MessageExtBrokerInner msg) {
}
}

long eclipseTimeInLock = 0;
long elapsedTimeInLock = 0;
MappedFile unlockMappedFile = null;
MappedFile mappedFile = this.mappedFileQueue.getLastMappedFile();

Expand Down Expand Up @@ -619,14 +619,14 @@ public PutMessageResult putMessage(final MessageExtBrokerInner msg) {
return new PutMessageResult(PutMessageStatus.UNKNOWN_ERROR, result);
}

eclipseTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginLockTimestamp;
elapsedTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginLockTimestamp;
beginTimeInLock = 0;
} finally {
putMessageLock.unlock();
}

if (eclipseTimeInLock > 500) {
log.warn("[NOTIFYME]putMessage in lock cost time(ms)={}, bodyLength={} AppendMessageResult={}", eclipseTimeInLock, msg.getBody().length, result);
if (elapsedTimeInLock > 500) {
log.warn("[NOTIFYME]putMessage in lock cost time(ms)={}, bodyLength={} AppendMessageResult={}", elapsedTimeInLock, msg.getBody().length, result);
}

if (null != unlockMappedFile && this.defaultMessageStore.getMessageStoreConfig().isWarmMapedFileEnable()) {
Expand Down Expand Up @@ -714,7 +714,7 @@ public PutMessageResult putMessages(final MessageExtBatch messageExtBatch) {
return new PutMessageResult(PutMessageStatus.MESSAGE_ILLEGAL, null);
}

long eclipseTimeInLock = 0;
long elapsedTimeInLock = 0;
MappedFile unlockMappedFile = null;
MappedFile mappedFile = this.mappedFileQueue.getLastMappedFile();

Expand Down Expand Up @@ -769,14 +769,14 @@ public PutMessageResult putMessages(final MessageExtBatch messageExtBatch) {
return new PutMessageResult(PutMessageStatus.UNKNOWN_ERROR, result);
}

eclipseTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginLockTimestamp;
elapsedTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginLockTimestamp;
beginTimeInLock = 0;
} finally {
putMessageLock.unlock();
}

if (eclipseTimeInLock > 500) {
log.warn("[NOTIFYME]putMessages in lock cost time(ms)={}, bodyLength={} AppendMessageResult={}", eclipseTimeInLock, messageExtBatch.getBody().length, result);
if (elapsedTimeInLock > 500) {
log.warn("[NOTIFYME]putMessages in lock cost time(ms)={}, bodyLength={} AppendMessageResult={}", elapsedTimeInLock, messageExtBatch.getBody().length, result);
}

if (null != unlockMappedFile && this.defaultMessageStore.getMessageStoreConfig().isWarmMapedFileEnable()) {
Expand Down
Expand Up @@ -394,11 +394,11 @@ public PutMessageResult putMessage(MessageExtBrokerInner msg) {
long beginTime = this.getSystemClock().now();
PutMessageResult result = this.commitLog.putMessage(msg);

long eclipseTime = this.getSystemClock().now() - beginTime;
if (eclipseTime > 500) {
log.warn("putMessage not in lock eclipse time(ms)={}, bodyLength={}", eclipseTime, msg.getBody().length);
long elapsedTime = this.getSystemClock().now() - beginTime;
if (elapsedTime > 500) {
log.warn("putMessage not in lock elapsed time(ms)={}, bodyLength={}", elapsedTime, msg.getBody().length);
}
this.storeStatsService.setPutMessageEntireTimeMax(eclipseTime);
this.storeStatsService.setPutMessageEntireTimeMax(elapsedTime);

if (null == result || !result.isOk()) {
this.storeStatsService.getPutMessageFailedTimes().incrementAndGet();
Expand Down Expand Up @@ -450,11 +450,11 @@ public PutMessageResult putMessages(MessageExtBatch messageExtBatch) {
long beginTime = this.getSystemClock().now();
PutMessageResult result = this.commitLog.putMessages(messageExtBatch);

long eclipseTime = this.getSystemClock().now() - beginTime;
if (eclipseTime > 500) {
log.warn("not in lock eclipse time(ms)={}, bodyLength={}", eclipseTime, messageExtBatch.getBody().length);
long elapsedTime = this.getSystemClock().now() - beginTime;
if (elapsedTime > 500) {
log.warn("not in lock elapsed time(ms)={}, bodyLength={}", elapsedTime, messageExtBatch.getBody().length);
}
this.storeStatsService.setPutMessageEntireTimeMax(eclipseTime);
this.storeStatsService.setPutMessageEntireTimeMax(elapsedTime);

if (null == result || !result.isOk()) {
this.storeStatsService.getPutMessageFailedTimes().incrementAndGet();
Expand Down Expand Up @@ -642,8 +642,8 @@ public GetMessageResult getMessage(final String group, final String topic, final
} else {
this.storeStatsService.getGetMessageTimesTotalMiss().incrementAndGet();
}
long eclipseTime = this.getSystemClock().now() - beginTime;
this.storeStatsService.setGetMessageEntireTimeMax(eclipseTime);
long elapsedTime = this.getSystemClock().now() - beginTime;
this.storeStatsService.setGetMessageEntireTimeMax(elapsedTime);

getResult.setStatus(status);
getResult.setNextBeginOffset(nextBeginOffset);
Expand Down
Expand Up @@ -448,7 +448,7 @@ public boolean destroy(final long intervalForcibly) {
log.info("delete file[REF:" + this.getRefCount() + "] " + this.fileName
+ (result ? " OK, " : " Failed, ") + "W:" + this.getWrotePosition() + " M:"
+ this.getFlushedPosition() + ", "
+ UtilAll.computeEclipseTimeMilliseconds(beginTime));
+ UtilAll.computeElapsedTimeMilliseconds(beginTime));
} catch (Exception e) {
log.warn("close file channel " + this.fileName + " Failed. ", e);
}
Expand Down
Expand Up @@ -411,7 +411,7 @@ public PutMessageResult putMessage(final MessageExtBrokerInner msg) {
EncodeResult encodeResult;

putMessageLock.lock(); //spin or ReentrantLock ,depending on store config
long eclipseTimeInLock;
long elapsedTimeInLock;
long queueOffset;
try {
beginTimeInDledgerLock = this.defaultMessageStore.getSystemClock().now();
Expand All @@ -431,8 +431,8 @@ public PutMessageResult putMessage(final MessageExtBrokerInner msg) {
long wroteOffset = dledgerFuture.getPos() + DLedgerEntry.BODY_OFFSET;
ByteBuffer buffer = ByteBuffer.allocate(MessageDecoder.MSG_ID_LENGTH);
String msgId = MessageDecoder.createMessageId(buffer, msg.getStoreHostBytes(), wroteOffset);
eclipseTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginTimeInDledgerLock;
appendResult = new AppendMessageResult(AppendMessageStatus.PUT_OK, wroteOffset, encodeResult.data.length, msgId, System.currentTimeMillis(), queueOffset, eclipseTimeInLock);
elapsedTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginTimeInDledgerLock;
appendResult = new AppendMessageResult(AppendMessageStatus.PUT_OK, wroteOffset, encodeResult.data.length, msgId, System.currentTimeMillis(), queueOffset, elapsedTimeInLock);
switch (tranType) {
case MessageSysFlag.TRANSACTION_PREPARED_TYPE:
case MessageSysFlag.TRANSACTION_ROLLBACK_TYPE:
Expand All @@ -453,8 +453,8 @@ public PutMessageResult putMessage(final MessageExtBrokerInner msg) {
putMessageLock.unlock();
}

if (eclipseTimeInLock > 500) {
log.warn("[NOTIFYME]putMessage in lock cost time(ms)={}, bodyLength={} AppendMessageResult={}", eclipseTimeInLock, msg.getBody().length, appendResult);
if (elapsedTimeInLock > 500) {
log.warn("[NOTIFYME]putMessage in lock cost time(ms)={}, bodyLength={} AppendMessageResult={}", elapsedTimeInLock, msg.getBody().length, appendResult);
}

PutMessageStatus putMessageStatus = PutMessageStatus.UNKNOWN_ERROR;
Expand Down
Expand Up @@ -77,7 +77,7 @@ public void flush() {
this.indexHeader.updateByteBuffer();
this.mappedByteBuffer.force();
this.mappedFile.release();
log.info("flush index file eclipse time(ms) " + (System.currentTimeMillis() - beginTime));
log.info("flush index file elapsed time(ms) " + (System.currentTimeMillis() - beginTime));
}
}

Expand Down

0 comments on commit be7c6dd

Please sign in to comment.