DUBBO-263 SimpleMonitor改为异步写入日志
git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@1241 1a56cb94-b969-4eaa-88fa-be21384802f2
This commit is contained in:
parent
741b6f0ecd
commit
9d2e60fdc6
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
package com.alibaba.dubbo.monitor.dubbo;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
|
@ -80,7 +78,7 @@ public class DubboMonitor implements Monitor {
|
|||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Send statistics to monitor " + getUrl());
|
||||
}
|
||||
String timestamp = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
for (Map.Entry<Statistics, AtomicReference<long[]>> entry : statisticsMap.entrySet()) {
|
||||
// 获取已统计数据
|
||||
Statistics statistics = entry.getKey();
|
||||
|
|
|
|||
|
|
@ -161,8 +161,15 @@ public class SimpleMonitorService implements MonitorService {
|
|||
if (POISON_PROTOCOL.equals(statistics.getProtocol())) {
|
||||
return;
|
||||
}
|
||||
long timestamp = statistics.getParameter(Constants.TIMESTAMP_KEY, System.currentTimeMillis());
|
||||
Date now = new Date(timestamp);
|
||||
String timestamp = statistics.getParameter(Constants.TIMESTAMP_KEY);
|
||||
Date now;
|
||||
if (timestamp == null || timestamp.length() == 0) {
|
||||
now = new Date();
|
||||
} else if (timestamp.length() == "yyyyMMddHHmmss".length()) {
|
||||
now = new SimpleDateFormat("yyyyMMddHHmmss").parse(timestamp);
|
||||
} else {
|
||||
now = new Date(Long.parseLong(timestamp));
|
||||
}
|
||||
String day = new SimpleDateFormat("yyyyMMdd").format(now);
|
||||
SimpleDateFormat format = new SimpleDateFormat("HHmm");
|
||||
for (String key : types) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue