Package de.caluga.morphium
Klasse SequenceGenerator
java.lang.Object
de.caluga.morphium.SequenceGenerator
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
-
Verschachtelte Klassen - Übersicht
Verschachtelte Klassen -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungSequenceGenerator(Morphium m, String n) SequenceGenerator(Morphium mrph, String name, int inc, long startValue) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibunglonggetId()intgetInc()getName()longlongvoidvoidsetInc(int inc) voidsetMorphium(Morphium morphium) voidvoidsetStartValue(long startValue)
-
Konstruktordetails
-
SequenceGenerator
-
SequenceGenerator
-
-
Methodendetails
-
getCurrentValue
public long getCurrentValue() -
getNextValue
public long getNextValue() -
getInc
public int getInc() -
setInc
public void setInc(int inc) -
getStartValue
public long getStartValue() -
setStartValue
public void setStartValue(long startValue) -
getId
-
setId
-
getName
-
setName
-
getMorphium
-
setMorphium
-