Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

help me with unique client Ids

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys.
can anyone help me in getting unique client ids.
i 'am using hashcode to generate it.
but if i start two clients on the same JVM then the clientID remains same. well that doesnot create a problem in standalone mode.
but for n/w mode this will be a big problem.
even though it is a ridiculous thought of having two clinets running n/w access from same system.
point to note is that i'am generating unique ids on the client( i hope i'am doing proper)
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a class in the JDK which called VMID. It should help you solve your problem.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Siddharth,
Some more possibilities are UID and ObjID. I haven't got this one totally worked out either. So if you come up with something solid let me know.
Michael Morris
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
In my design, i have a class names IDGenerator and only has one static method: generateId() and a static int variable. whenever this method is called, it will return a unique "id". let this class work in your server in which u want a unique id return to the client.
Hope it helps!
Xiaoma Wang
 
Siddharth Mehrotra
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i'm using java.rmi.server.UID class for generating unique ids.
and it does generate unique ids.
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic