处理国际化文件频繁加载导致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

@@ -125,21 +125,7 @@ public class SpecificServiceHostCfgController extends BaseController {
@RequiresPermissions("specific:serviceIp:edit")
@RequestMapping(value = "import/template")
public String importFileTemplate(HttpServletRequest request,HttpServletResponse response, RedirectAttributes redirectAttributes) {
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"));
}
} catch (Exception e) {
msgProp = null;
System.err.println("未知i18n消息配置文件,请确定文件是否存在!");
}
Properties msgProp = getMsgProp();
try {
String fileName = msgProp.getProperty("agreement_ip_configuration").replaceAll(" ", "_")+".xlsx";
List<SpecificServiceHostCfg> list = Lists.newArrayList();