Class NumericVersionGenerator
- java.lang.Object
-
- org.infinispan.container.versioning.NumericVersionGenerator
-
- All Implemented Interfaces:
VersionGenerator
public class NumericVersionGenerator extends Object implements VersionGenerator
Generates unique numeric versions for both local and clustered environments. When used on clustered caches, node information is used to guarantee versions are unique cluster-wide. If the cache is configured to be local, the version generated is based around an atomic counter. On the contrary, if the cache is clustered, the generated version is composed of: [view id (2 bytes)][rank (2 bytes)][version counter (4 bytes)], where rank refers to the position of this node within the view.- Since:
- 5.3
- Author:
- Galder ZamarreƱo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
NumericVersionGenerator.RankCalculator
-
Constructor Summary
Constructors Constructor Description NumericVersionGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumericVersionGenerator
clustered(boolean clustered)
IncrementableEntryVersion
generateNew()
Generates a new entry versionIncrementableEntryVersion
increment(IncrementableEntryVersion initialVersion)
IncrementableEntryVersion
nonExistingVersion()
void
start()
-
-
-
Method Detail
-
start
public void start()
-
clustered
public NumericVersionGenerator clustered(boolean clustered)
-
generateNew
public IncrementableEntryVersion generateNew()
Description copied from interface:VersionGenerator
Generates a new entry version- Specified by:
generateNew
in interfaceVersionGenerator
- Returns:
- a new entry version
-
increment
public IncrementableEntryVersion increment(IncrementableEntryVersion initialVersion)
- Specified by:
increment
in interfaceVersionGenerator
-
nonExistingVersion
public IncrementableEntryVersion nonExistingVersion()
- Specified by:
nonExistingVersion
in interfaceVersionGenerator
-
-