Commit bb8ae1ad authored by yanzg's avatar yanzg

修复异常提醒,从而正确的跟踪异常信息

parent 5ac74567
......@@ -57,10 +57,12 @@ public class LogCountTime implements ThreadNext.Next, InitializingBean {
/**
* 获取缓存对象
*
* @param tag 标签
* @param urlFrom 地址
* @param level 等级
* @return 缓存对象
*/
private LogUrlCountVo getCount(String urlFrom, int level) {
private LogUrlCountVo getCount(String tag, String urlFrom, int level) {
// 初始化日期
initToday();
// 目标地址
......@@ -71,7 +73,7 @@ public class LogCountTime implements ThreadNext.Next, InitializingBean {
urlTo = urlFrom;
}
// 关键字
String key = StringHelper.getId(urlTo, level);
String key = StringHelper.getId(tag, urlTo, level);
// 缓存中获取对象
LogUrlCountVo ret = todayMemoryCache.get(key);
if (ret != null) {
......@@ -83,7 +85,7 @@ public class LogCountTime implements ThreadNext.Next, InitializingBean {
if (ret != null) {
return ret;
}
ret = new LogUrlCountVo(urlTo, level);
ret = new LogUrlCountVo(tag, urlTo, level);
todayMemoryCache.put(key, ret);
return ret;
}
......@@ -105,12 +107,12 @@ public class LogCountTime implements ThreadNext.Next, InitializingBean {
LogInfoVo.Handle hisHandle = log.getHandle();
if (hisHandle != null) {
// 当前合计对象
LogUrlCountVo count = getCount(log.getUrl(), hisHandle.getLevel());
LogUrlCountVo count = getCount(log.getTag(), log.getUrl(), hisHandle.getLevel());
count.subFinish(hisHandle.getUseTime(), hisHandle.isLog());
}
log.setHandle(handle);
// 当前合计对象
LogUrlCountVo count = getCount(log.getUrl(), handle.getLevel());
LogUrlCountVo count = getCount(log.getTag(), log.getUrl(), handle.getLevel());
count.addFinish(handle.getUseTime(), handle.isLog());
}
}
......
......@@ -9,6 +9,7 @@ public class LogUrlCountVo {
private final Object lockStart = new Object();
private final Object lockFinish = new Object();
private volatile String tag;
private volatile String url;
private volatile int level;
private volatile int startCount;
......@@ -19,7 +20,7 @@ public class LogUrlCountVo {
private volatile long minTime = Long.MAX_VALUE;
private volatile long maxTime;
public LogUrlCountVo(String url, int level) {
public LogUrlCountVo(String tag, String url, int level) {
this.url = url;
this.level = level;
}
......@@ -50,6 +51,14 @@ public class LogUrlCountVo {
}
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getUrl() {
return url;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment