随笔 - 175  文章 - 202  trackbacks - 0
<2013年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

第一个Blog,记录哈哈的生活

常用链接

留言簿(16)

随笔分类

随笔档案

文章分类

文章档案

收藏夹

Java links

搜索

  •  

最新评论

阅读排行榜

评论排行榜

设置了 scanPeriod 之后,过了好长时间,都不生效,后来 debug 代码。发现了下面这段。

  private volatile long mask = 0xF;
@Override
public FilterReply decide(Marker marker, Logger logger, Level level,
String format, Object[] params, Throwable t) {
if (!isStarted()) {
return FilterReply.NEUTRAL;
}
// for performance reasons, skip change detection (MASK-1) times out of MASK.
// Only once every MASK calls is change detection code executed
// Note that MASK is a variable itself.
if (((invocationCounter++) & mask) != mask) {
return FilterReply.NEUTRAL;
}
long now = System.currentTimeMillis();
synchronized (configurationWatchList) {
updateMaskIfNecessary(now);
if (changeDetected(now)) {
// Even though reconfiguration involves resetting the loggerContext,
// which clears the list of turbo filters including this instance, it is
// still possible for this instance to be subsequently invoked by another
// thread if it was already executing when the context was reset.
disableSubsequentReconfiguration();
detachReconfigurationToNewThread();
}
}
return FilterReply.NEUTRAL;
}

这行 if (((invocationCounter++) & mask) != mask) { mask = 0xf,其实要每循环 0xf 次,也就是 15 次,才会去 check 一次是否要更新,也就是说,不管过了多久,如果没到这 15 次,也不会去检查是否更新配置。
也就是说,我多打几次 log,配置文件就生效了。

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
posted on 2013-11-12 14:25 哈哈的日子 阅读(1604) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: