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

@@ -9,13 +9,18 @@ import com.nis.util.StringUtil;
public final class Configurations {
private static Properties prop = new Properties();
private static Properties msgPropZh = new Properties();
private static Properties msgPropRu = new Properties();
private static Properties msgPropEn = new Properties();
static {
try {
prop.load(Configurations.class.getResourceAsStream("/nis.properties"));
prop.load(Configurations.class.getResourceAsStream("/table.properties"));
prop.load(Configurations.class.getResourceAsStream("/matt.properties"));
//加载国际化配置文件
msgPropZh.load(Configurations.class.getResourceAsStream("/messages/message_zh_CN.properties"));
msgPropRu.load(Configurations.class.getResourceAsStream("/messages/message_ru.properties"));
msgPropEn.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
} catch (Exception e) {
prop = null;
System.err.println("未知nis.properties,请确定文件是否存在!");
@@ -75,10 +80,16 @@ public final class Configurations {
return prop;
}
public static Properties getMsgPropEn() {
return msgPropEn;
}
public static Properties getMsgPropRu() {
return msgPropRu;
}
public static Properties getMsgPropZh() {
return msgPropZh;
}
}