I am using java.util.concurrent.atomic.AtomicLong class to generate sequence numbers for id generation. I need to start this number from 1 each day what are the available logic, methods which I can use?
Asked
Active
Viewed 1,720 times
1
Keith Thompson
- 254,901
- 44
- 429
- 631
andare
- 21
- 6
-
Your title says 0, but the body of the question says 1. (Probably not a big deal.) – Keith Thompson Jan 18 '12 at 09:46
1 Answers
3
Here's an answer on how to get the beginning of a day using Joda Time. Then use the method AtomicLong#set(long) to reset the value.
Community
- 1
- 1
Boris Pavlović
- 63,078
- 28
- 122
- 148