I want to create a unique id in my application. Currently we are using System.currentTimeMillis() for this purpose. But, we have 2 application servers running and there is a possibility that the ids generated on different machines could be same though it is rare. Is there a better way of generating a unique id?
Check out the high/low pattern in the Patterns section
U can try using Random class under the util package for the generation of unique numbers.