问题描述
有这样一个类:造成死锁------------------------------------------------------------------------------------------packagecom.chl.dps.util;importjava.util.Hashtable;importjava.util.Map;importcom.cathaypacific.vcm.content.subclass.Glossary;importcom.chl.dps.vo.Language;publicclassGlossaryUtil{privateHashtableglossaryHash=newHashtable();privatestaticGlossaryUtil_instance=null;privateGlossaryUtil(){}publicstaticsynchronizedGlossaryUtilgetInstance(){if(_instance==null){_instance=newGlossaryUtil();}return_instance;}publicsynchronizedvoidresetCache(){glossaryHash=newHashtable();}publicStringget(Stringtitle,Stringlocale,StringmsgName){MaplocaleMap=get(title,locale,false);if(localeMap!=null){Stringvalue=(String)localeMap.get(msgName);if(value!=null){returnvalue;}}localeMap=get(title,Language.getLangCode(locale));if(localeMap!=null){Stringvalue=(String)localeMap.get(msgName);if(value!=null){returnvalue;}}returnnull;}publicMapget(Stringtitle,Stringlocale){returnget(title,locale,true);}publicMapget(Stringtitle,Stringlocale,booleandefaultLang){Glossaryglossary=get(title);if(glossary==null){returnnull;}MaplocaleMap=glossary.getGlossary(locale);if(defaultLang&&localeMap==null){localeMap=glossary.getGlossary(Language.DEFAULT);}returnlocaleMap;}publicGlossaryget(Stringkey){if(!contains(key)){put(key,load(key));}return(Glossary)glossaryHash.get(key);}privatesynchronizedbooleancontains(Objectkey){returnglossaryHash.containsKey(key);}privatesynchronizedvoidput(Objectkey,Glossaryvalue){if(value!=null){glossaryHash.put(key,value);}}publicsynchronizedvoidremove(Stringtitle){glossaryHash.remove(title);}privatesynchronizedGlossaryload(Stringtitle){returnContentUtil.findGlossary(title);}/***Matchastringpatternandreplacewiththereplacementstring*intheinputtedtext*<p>*@parampatmatchingstringpattern*@paramrepreplacementstring*@paramorioriginaltext*@returnstringafterreplacement*/publicstaticStringreplace(Stringpat,Stringrep,Stringori){StringBuffersb;if(rep==null){rep="";}if(ori!=null){if(pat!=null){intcount=0;inti,j;for(i=0;(i=ori.indexOf(pat,i))!=-1;i+=pat.length()){++count;}sb=newStringBuffer(ori.length()+count*(rep.length()-pat.length()));for(i=0;(j=ori.indexOf(pat,i))!=-1;i=j+pat.length()){sb.append(ori.substring(i,j)).append(rep);}sb.append(ori.substring(i));}else{returnori;}}else{return"";}returnsb.toString();}}------------------------------------------------------------------------------------------因为占用资源而导致HighJVM损耗,3XMTHREADINFO"WebContainer:127"(TID:0x8073D208,sys_thread_t:0x45D44228,state:CW,nativeID:0x80AE)prio=54XESTACKTRACEatcom.chl.dps.util.GlossaryUtil.load(GlossaryUtil.java(CompiledCode))4XESTACKTRACEatcom.chl.dps.util.GlossaryUtil.get(GlossaryUtil.java(CompiledCode))4XESTACKTRACEatcom.chl.dps.util.GlossaryUtil.get(GlossaryUtil.java(CompiledCode))4XESTACKTRACEatcom.chl.dps.util.GlossaryUtil.get(GlossaryUtil.java(CompiledCode))4XESTACKTRACEatcom.chl.dps.util.GlossaryUtil.get(GlossaryUtil.java(CompiledCode))4XESTACKTRACEatcom.chl.dps.util.HtmlUtil.printPackageHighlightAltText(HtmlUtil.java(CompiledCode))4XESTACKTRACEatcom.chl.dps.util.HtmlUtil.printPkgList_HightLightIcons(HtmlUtil.java(CompiledCode))4XESTACKTRACEatcom.ibm._jsp._v4_5F_promotion_5F_list_5F_landing_5F_page._jspService(_v4_5F_promotion_5F_list_5F_landing_5F_page.java(CompiledCode))------------------------------------------------------------------------------------------各位有什么好建议修改这个类?
解决方案
解决方案二:
不了解运行环境和业务无法动手