|
From: <lk...@us...> - 2004-12-13 10:40:09
|
Update of /cvsroot/openorb/TransactionService/src/main/org/openorb/ots/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9462/src/main/org/openorb/ots/Impl Modified Files: XID.java Log Message: cache host address for improved performance Index: XID.java =================================================================== RCS file: /cvsroot/openorb/TransactionService/src/main/org/openorb/ots/Impl/XID.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- XID.java 10 Feb 2004 21:57:20 -0000 1.10 +++ XID.java 13 Dec 2004 10:39:59 -0000 1.11 @@ -15,6 +15,21 @@ */ public class XID { + private static String s_hostAddress = null; + + static + { + try + { + java.net.InetAddress inet = java.net.InetAddress.getLocalHost(); + s_hostAddress = inet.getHostAddress(); + } + catch ( java.lang.Exception ex ) + { + // TODO: ??? + } + } + /** * Reference to an XID */ @@ -164,7 +179,7 @@ String id = "[" + System.currentTimeMillis() + "]"; // Now, we get OpenORB information about IP Address - id = id + getServerHostName(); + id = id + getServerHostAddress(); return id.getBytes(); } @@ -191,19 +206,10 @@ } /** - * Return the host name + * Return the host address. */ - private String getServerHostName() + private static String getServerHostAddress() { - try - { - java.net.InetAddress inet = java.net.InetAddress.getLocalHost(); - return inet.getHostAddress(); - } - catch ( java.lang.Exception ex ) - { - // TODO: ??? - } - return null; + return s_hostAddress; } } |