Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>: > I've wanted a nickname all my life (aside from the explicitives some would > use!)... never thought it's be Radar :)
Then it probably shouldn't be ;-) > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com > > On Fri, March 18, 2005 1:09 pm, Dakota Jack said: > > The class works, but I don't think it is what you want. Maybe it is. > > Just don't have high expectations. I did and was disappointed. Just > > trying to help you out, Radar! ///;-) > > > > Jack > > > > > > On Fri, 18 Mar 2005 12:21:28 -0500 (EST), Frank W. Zammetti > > <[EMAIL PROTECTED]> wrote: > >> Why do you think it wouldn't work? Does it sometimes return incorrect > >> information in some setups? > >> > >> I thought of doing some kind of mini-browser-type thing, but before I go > >> down that road I wanted to explore some simpler solutions. The Commons > >> ID > >> thing is very nice, but I'm not so sure I'm comfortable putting in > >> something that isn't actually released yet. > >> > >> That being said, what was on the site for it got me to thinking... I > >> think > >> if I do a combination of the sum of the MAC address digits + the current > >> time + the hashCode of the IP address, that is probably as random as I > >> need. But, if you know something about InetAddress that would make this > >> not work, I'm all ears :) > >> > >> Of course, I'm not sure how to get the MAC address yet, but one problem > >> at > >> a time... > >> > >> -- > >> Frank W. Zammetti > >> Founder and Chief Software Architect > >> Omnytex Technologies > >> http://www.omnytex.com > >> > >> On Fri, March 18, 2005 12:14 pm, Dakota Jack said: > >> > InetAddress might not get the answer for you, Frank. I don't know > >> > what your setup is, but you can go to any ip address service outside > >> > your system and get a unique return address for your machines with a > >> > mini-browser. > >> > > >> > Jack > >> > > >> > > >> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti > >> > <[EMAIL PROTECTED]> wrote: > >> >> Yes, I think InetAddress just might do the trick. Thank you Kris! > >> >> > >> >> -- > >> >> Frank W. Zammetti > >> >> Founder and Chief Software Architect > >> >> Omnytex Technologies > >> >> http://www.omnytex.com > >> >> > >> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said: > >> >> > Will InetAddress.getLocalHost() work for you? > >> >> > NetworkInterface.getNetworkInterfaces() might also be of interest. > >> Or, > >> >> you > >> >> > might want to create yourself an instance of java.rmi.dgc.VMID... > >> >> > > >> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>: > >> >> > > >> >> >> Oh boy, I got a good one! It's only related to Struts in that the > >> >> >> application in question is Struts-based, so I hope no one minds a > >> >> >> semi-OT > >> >> >> question... > >> >> >> > >> >> >> Here's the situation... An app I wrote has a daemon thread that is > >> >> >> spawned > >> >> >> at startup (from a Struts plugin) that does periodic background > >> >> >> processing > >> >> >> tasks. This works great, never had a bit of trouble. > >> >> >> > >> >> >> Now though, the app is moving from a single server to a clusted > >> >> >> environment. > >> >> >> > >> >> >> So, what's going to happen is that each server in the cluster will > >> >> have > >> >> >> its own instance of the thread running on it. Not a huge problem > >> >> except > >> >> >> that I have to be sure only one instance of the thread (i.e., one > >> >> server > >> >> >> in the cluster) is executing concurrently. > >> >> >> > >> >> >> The easy solution is just a database table that is checked when > >> the > >> >> >> thread > >> >> >> wakes up. If there is no entry in it, then there is no other > >> >> instance > >> >> >> running, so it can write an entry to the table and go off and do > >> its > >> >> >> thing. > >> >> >> > >> >> >> I want to be extremely certain that no issues arise in terms of > >> one > >> >> >> instance of the thread reading from the database while another > >> >> instance > >> >> >> is > >> >> >> writing, etc. So, aside from transactional database calls and > >> >> row-level > >> >> >> locking, I want to do one more thing: I want the thread to sleep a > >> >> >> random > >> >> >> number of seconds (1-300) at startup. This will ensure that, all > >> the > >> >> >> database locking and such aside, the threads should all be offset > >> >> from > >> >> >> one > >> >> >> another in terms of when they run. > >> >> >> > >> >> >> So, I need a random number generated when the thread starts up. > >> As > >> >> we > >> >> >> all > >> >> >> know though, random number generation on most computers that don't > >> >> have > >> >> >> something like a Brownian motion sensor attached stuck in a cup of > >> >> >> boiling > >> >> >> coffee can't generate truly random numbers. So, in theory, what > >> >> could > >> >> >> happen is that if all the servers in the cluster come up at the > >> same > >> >> >> time, > >> >> >> the threads could wind up running at the same time regardless of > >> the > >> >> >> random sleep at the start! It might never happen in reality, > >> small > >> >> >> fluctuations would probably offset them anyway, but I want to be > >> more > >> >> >> certain than that. > >> >> >> > >> >> >> So now we're at the crux of the problem... > >> >> >> > >> >> >> I can't just seed the random number generator with the current > >> time > >> >> >> because it concievably might not be random enough. So, I thought > >> I > >> >> >> could > >> >> >> just tally up the octets of the server's IP address and add that > >> to > >> >> the > >> >> >> current time. Then the seed on each server should be different > >> >> enough. > >> >> >> > >> >> >> But, there doesn't appear to be any way to get the server IP > >> address > >> >> >> independant of a request, so I can't get at it in my plugin. > >> Anyone > >> >> >> know > >> >> >> differently? > >> >> >> > >> >> >> Assuming that is the case, can anyone think of any other way to > >> seed > >> >> the > >> >> >> generator that would ensure a different value on different > >> machines > >> >> in > >> >> >> the > >> >> >> cluster? There are some options like encoding the individual > >> server > >> >> >> names > >> >> >> in my app's config file with a different seed value for each, but > >> >> that > >> >> >> makes maintenance a pain if a new server is added or one removed > >> or > >> >> >> addresses simply changed. > >> >> >> > >> >> >> Any ideas? Thanks! > >> >> >> > >> >> >> -- > >> >> >> Frank W. Zammetti > >> >> >> Founder and Chief Software Architect > >> >> >> Omnytex Technologies > >> >> >> http://www.omnytex.com > >> >> > > >> >> > -- > >> >> > Kris Schneider <mailto:[EMAIL PROTECTED]> > >> >> > D.O.Tech <http://www.dotech.com/> > >> >> > > >> >> > > --------------------------------------------------------------------- > >> >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >> > For additional commands, e-mail: [EMAIL PROTECTED] > >> >> > > >> >> > > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >> For additional commands, e-mail: [EMAIL PROTECTED] > >> >> > >> >> > >> > > >> > > >> > -- > >> > "You can lead a horse to water but you cannot make it float on its > >> back." > >> > ~Dakota Jack~ > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> > For additional commands, e-mail: [EMAIL PROTECTED] > >> > > >> > > >> > >> > > > > > > -- > > "You can lead a horse to water but you cannot make it float on its back." > > ~Dakota Jack~ > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]