处理国际化文件频繁加载导致java.net.SocketException: Too many open files的问题

This commit is contained in:
zhangdongxu
2018-12-19 17:45:03 +08:00
parent 90fc989831
commit 0e6ba4a68c
14 changed files with 129 additions and 119 deletions

View File

@@ -910,17 +910,17 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
Properties msgProp = new Properties();
try {
String language = LocaleContextHolder.getLocale().getLanguage();
if(language.equals("zh_cn")||language.equals("zh")){
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_zh_CN.properties"));
}else if(language.equals("ru")){
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_ru.properties"));
}else{
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
if (language.equals("zh_cn") || language.equals("zh")) {
msgProp=Configurations.getMsgPropZh();
} else if (language.equals("ru")) {
msgProp=Configurations.getMsgPropRu();
} else {
msgProp=Configurations.getMsgPropEn();
}
} catch (Exception e) {
msgProp = null;
logger.error("未知i18n消息配置文件,请确定文件是否存在!",e);
logger.error("未知i18n消息配置文件,请确定文件是否存在!", e);
}
return msgProp;
}