Package ca.uhn.hl7v2.util.idgenerator
Class HiLoGenerator
java.lang.Object
ca.uhn.hl7v2.util.idgenerator.IDGenerator.OrderedSupport
ca.uhn.hl7v2.util.idgenerator.HiLoGenerator
- All Implemented Interfaces:
IDGenerator,IDGenerator.Ordered
- Direct Known Subclasses:
DelegatingHiLoGenerator
Abstract base class for a HiLo-style generator that cheaply generates "lo"
IDs in memory but only seldomly increments (potentially more expensive) a
"hi" ID, e.g. in a persistent store. The combination of "lo" and "hi" ID
becomes the final ID returned to the caller.
- Author:
- Christian Ohr
-
Nested Class Summary
Nested classes/interfaces inherited from interface ca.uhn.hl7v2.util.idgenerator.IDGenerator
IDGenerator.Ordered, IDGenerator.OrderedSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetID()Generates and returns a new ID.abstract longgetMaxLo()Returns the maximum Lo ID (expect the Hi ID be incremented afterwards)protected abstract longReturns the next Hi IDprotected longReturns then next Lo IDvoidreset()Resets the generatorprotected abstract voidResets the Hi IDMethods inherited from class ca.uhn.hl7v2.util.idgenerator.IDGenerator.OrderedSupport
getIncrement
-
Constructor Details
-
HiLoGenerator
public HiLoGenerator()
-
-
Method Details
-
getID
Description copied from interface:IDGeneratorGenerates and returns a new ID. Note: This method must be implemented to be thread-safe.- Returns:
- a new ID.
- Throws:
IOException
-
getNextHiId
Returns the next Hi ID- Returns:
- the next Hi ID
- Throws:
IOException
-
resetHiId
Resets the Hi ID -
getNextLoId
Returns then next Lo ID- Returns:
-
reset
Resets the generator- Specified by:
resetin interfaceIDGenerator.Ordered- Overrides:
resetin classIDGenerator.OrderedSupport
-
getMaxLo
Returns the maximum Lo ID (expect the Hi ID be incremented afterwards)- Returns:
- the maximum Lo ID
-