File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
 
Similar Threads
Sequence number in Entity Bean
What is the difference between these two ways PostgreSQL)?
[Hibernate] Please explain hilo generator
how to hide the message sequence number of borland together?
Creating a Sequnce