您的位置:首页 > 编程语言

缓存缺失一段代码引发的问题

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;

        }

    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: