summaryrefslogtreecommitdiff
path: root/java/src/Ice/Util.java
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-01-29 06:49:10 +0000
committerMark Spruiell <mes@zeroc.com>2002-01-29 06:49:10 +0000
commit0001dc614d21380fb22a22566a44e6d2eae88542 (patch)
treec2a50cf5bd26da7ce3844146473989ebac902515 /java/src/Ice/Util.java
parentadding server (diff)
downloadice-0001dc614d21380fb22a22566a44e6d2eae88542.tar.bz2
ice-0001dc614d21380fb22a22566a44e6d2eae88542.tar.xz
ice-0001dc614d21380fb22a22566a44e6d2eae88542.zip
align with stable_31
Diffstat (limited to 'java/src/Ice/Util.java')
-rw-r--r--java/src/Ice/Util.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/java/src/Ice/Util.java b/java/src/Ice/Util.java
index 58c970bd331..42a0d5023f5 100644
--- a/java/src/Ice/Util.java
+++ b/java/src/Ice/Util.java
@@ -83,5 +83,38 @@ public final class Util
}
}
+ public static synchronized String
+ generateUUID()
+ {
+ java.rmi.server.UID uid = new java.rmi.server.UID();
+
+ if (_localAddress == null)
+ {
+ java.net.InetAddress addr = null;
+ try
+ {
+ addr = java.net.InetAddress.getLocalHost();
+ }
+ catch (java.net.UnknownHostException ex)
+ {
+ throw new DNSException();
+ }
+ byte[] ip = addr.getAddress();
+ _localAddress = "";
+ for (int i = 0; i < ip.length; i++)
+ {
+ if (i > 0)
+ {
+ _localAddress += ":";
+ }
+ int n = ip[i] < 0 ? ip[i] + 256 : ip[i];
+ _localAddress += Integer.toHexString(n);
+ }
+ }
+
+ return _localAddress + ":" + uid;
+ }
+
private static Properties _defaultProperties = null;
+ private static String _localAddress = null;
}