aspose file tools*
The moose likes Java in General and the fly likes Auto Generation of Sequence Numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Auto Generation of Sequence Numbers" Watch "Auto Generation of Sequence Numbers" New topic
Author

Auto Generation of Sequence Numbers

Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 325
My question is similar to generating ID number for each record in database; however, it is to generate a sequence number for every client request received over the web.

I heard that there are 1. idempotent sequence number, which has to be thread safe, and 2. global sequence number.

Are there code examples that I can follow? Thank you.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
For unique random ids you can use java.util.UUID : randomUUID()
Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 325
How to use the java.util.concurrent.atomic.AtomicInteger in a Singleton?
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
It should be like writing any other Singleton class


Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 325
Thanks very much for your help and support.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
You are welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Auto Generation of Sequence Numbers