The hibernate project as a uuid class, you could look at how they do it... Here's the docs:
http://www.hibernate.org/hib_docs/reference/html/or-mapping.html#or-mapp ing-s1-4-uuid -gabe -----Original Message----- From: Tom Ly [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 12:10 PM To: Tomcat Users List Subject: Re: How do you generate a unique number for each request across muliple tomcat instances? bump Tom Ly <[EMAIL PROTECTED]> wrote:That works great in a windows environment. But on Linux machines,the line will always return 127.0.0.1 Tim Funk 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 --------------------------------- Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
