User: Stephan Bösebeck
Date: 24.07.12
Time: 21:36
Generate a new unique sequence number. Uses Sequence to store the current value. Process is as follows:
- lock the entry in sequence collection with my own UUID (rather unique) using atomar $set operation
- read my locked entries (should only be one). If one is found, I have a valid lock. If not found, somebody
locked over. Wait a while and try again
- increase the number by one (or the given increment) on the locked element, get this value
- remove the lock (atomar using $set)
- return current value