One way to get around that:
http://java.sun.com/j2se/1.4.2/docs/guide/idl/jidlFAQ.html#linuxior
http://dast.nlanr.net/Projects/Beacon/guide_faq.html

-Tim

Tom Ly wrote:

That works great in a windows environment. But on Linux machines,the line <InetAddress.getLocalHost().getHostAddress() > will always return 127.0.0.1

Tim Funk <[EMAIL PROTECTED]> wrote:Ideally use a string for uniqueness, not an int. For an int is too small across a cluster.

To get a unique string, concatenate your IP address with java.rmi.server.UID(), for example:
String guid = InetAddress.getLocalHost().getHostAddress() +
(new java.rmi.server.UID()).toString());


See the javadocs on UID for more info.

-Tim

Tom Ly wrote:


I have an application where I need to generate a unique int for each request that comes in. I've got about 8 Tomcat instances running spread across four machines(two tomcat's each machine). It's pretty simple with one Tomcat, but with mulitple Tomcats it gets tricky. I tried using InetAddress to get the ip address of the current machine and use that to set the range for each tomcat(since the ip address will always be unique), but since I'm using Linux, it'll always return 127.0.0.1 as the ip address, so I can use class InetAddress. Any advice on what to do?




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to