• Post Reply Bookmark Topic Watch Topic
  • New Topic

Requset for generating sequence number  RSS feed

 
siva priya uppini
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to generate sequence number every time i am getting the started value

 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch, siva priya uppini!

I moved your post to the Java in General forum, because it has nothing to do with JSP. And I put your code in the "code" tags so it would be readable -- could you do that the next time?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You only call the getUniqueNumber() method once. How do you call the method where you expect a sequence?
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That method of creating a singleton, with the null test in the static method, does it actually work? Is it thread‑safe? I am not certain, but it doesn’t look right to me. Find a copy of Effective Java by Joshua Bloch, and you will find singleton creation described properly.

Can you get numbers in a sequence by making all those members static and making the class uninstantiable?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!