现在的位置: 首页 > 综合 > 正文

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

2014年07月31日 ⁄ 综合 ⁄ 共 849字 ⁄ 字号 评论关闭

       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;

        }

    }

抱歉!评论已关闭.