This commit is contained in:
地平线
2015-08-27 19:28:06 +08:00
parent a799f99488
commit e1d4b4815c

View File

@@ -110,6 +110,8 @@ public final class Application {
Application.this.factory.register(RESNAME_APP_ADDR, Application.this.localAddress.getHostAddress()); Application.this.factory.register(RESNAME_APP_ADDR, Application.this.localAddress.getHostAddress());
Application.this.factory.register(RESNAME_APP_ADDR, InetAddress.class, Application.this.localAddress); Application.this.factory.register(RESNAME_APP_ADDR, InetAddress.class, Application.this.localAddress);
{ {
String node = config.getValue("node", "").trim();
if (node.isEmpty()) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
byte[] bs = this.localAddress.getAddress(); byte[] bs = this.localAddress.getAddress();
int v1 = bs[bs.length - 2] & 0xff; int v1 = bs[bs.length - 2] & 0xff;
@@ -118,7 +120,8 @@ public final class Application {
sb.append(Integer.toHexString(v1)); sb.append(Integer.toHexString(v1));
if (v2 <= 0xf) sb.append('0'); if (v2 <= 0xf) sb.append('0');
sb.append(Integer.toHexString(v2)); sb.append(Integer.toHexString(v2));
String node = sb.toString(); node = sb.toString();
}
Application.this.factory.register(RESNAME_APP_NODE, node); Application.this.factory.register(RESNAME_APP_NODE, node);
System.setProperty(RESNAME_APP_NODE, node); System.setProperty(RESNAME_APP_NODE, node);
} }