缓存缺失一段代码引发的问题
2013-05-31 15:44
281 查看
2011年11月7日,现场的环境用沙盘多开几个窗口系统就卡的不行了。原因是现场的环境解析系统总配置文件,配置项没有找到一直等待。原因:当系统总配置文件中没有配置参数isAddPrefixion,重用库代码中会先到内存中读取此参数,如果读不到,则遍历整改系统总配置文件。一个用户登录,会读很多次配置文件,多的上百次。在windows、HP
unix上不会有堵塞的问题(但性能上肯定会有影响),在IBM AIX上操作文件会有堵塞,环境上很容易重现。
修改ToolKit.java中的一个方法getConfigInfo()。
public synchronized String getConfigInfo(String attribute)
{
if(configInfoCache.containsKey(attribute))
return (String)configInfoCache.get(attribute);
String strConfigInfo = xmlParser.parserNode("CT-CONFIG", attribute);
if(strConfigInfo == null)
{
logger.error(attribute);----需要写入到日志
configInfoCache.put(attribute, strConfigInfo);----需要加上这段代码
return null;
} else
{
strConfigInfo = fillVariable(strConfigInfo);
configInfoCache.put(attribute, strConfigInfo);
return strConfigInfo;
}
}
unix上不会有堵塞的问题(但性能上肯定会有影响),在IBM AIX上操作文件会有堵塞,环境上很容易重现。
修改ToolKit.java中的一个方法getConfigInfo()。
public synchronized String getConfigInfo(String attribute)
{
if(configInfoCache.containsKey(attribute))
return (String)configInfoCache.get(attribute);
String strConfigInfo = xmlParser.parserNode("CT-CONFIG", attribute);
if(strConfigInfo == null)
{
logger.error(attribute);----需要写入到日志
configInfoCache.put(attribute, strConfigInfo);----需要加上这段代码
return null;
} else
{
strConfigInfo = fillVariable(strConfigInfo);
configInfoCache.put(attribute, strConfigInfo);
return strConfigInfo;
}
}
相关文章推荐
- 因C#一段代码,引发的问题
- js构造函数原型(prototype)问题分析(一段烂代码引发的博客)
- 一段代码引发的有趣问题
- "Spark Streaming + Kafka direct + checkpoints + 代码改变" 引发的问题(一)
- 一段html代码引发的页面重复请求问题
- jpa+spring jdbc混合作战引发的缓存问题
- 如何用Java编写一段代码引发内存泄露
- 怎样用Java编写一段代码引发内存泄露
- 一段简单的代码,解决了数据乱码的问题。?characterEncoding=utf8
- 多线程程序一段问题代码分析
- C# ListView双缓存代码,解决闪屏问题
- 如何用Java编写一段代码引发内存泄露
- 报错JedisConnectionException: Could not get a resource from the pool 已解决。(不是代码问题,Tomcat缓存问题)
- 同一段C++代码在win下和linux下同时编译时产生的头文件包含问题及解决
- 网上找了一段代码,利用MemoryStream来存储分块的数据包,将其转换成为byte[]后,所有字节都为0.找到问题了。
- 用Java编写一段代码引发内存泄露
- 一段奇葩Javascript代码引发的思考
- 摘抄:一段代码mysql5不能运行的问题
- Javascript---有趣的一段代码--this指向问题
- 为什么Thread.stop会过期?一段引起同步异常问题的代码样例