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

@@ -10,6 +10,7 @@ import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.method.HandlerMethod;
import com.google.common.collect.Lists;
@@ -206,8 +207,15 @@ public class LogUtils {
menuMap2 = Maps.newHashMap();
Properties msgProp = new Properties();
try {
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
} catch (IOException e) {
String language = LocaleContextHolder.getLocale().getLanguage();
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) {
e.printStackTrace();
}
List<SysMenu> menuList = menuDao.findAllList(new SysMenu());