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 classNumericVersionGenerator.RankCalculator
-
Constructor Summary
Constructors Constructor Description NumericVersionGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumericVersionGeneratorclustered(boolean clustered)IncrementableEntryVersiongenerateNew()Generates a new entry versionIncrementableEntryVersionincrement(IncrementableEntryVersion initialVersion)IncrementableEntryVersionnonExistingVersion()voidstart()
-
-
-
Method Detail
-
start
public void start()
-
clustered
public NumericVersionGenerator clustered(boolean clustered)
-
generateNew
public IncrementableEntryVersion generateNew()
Description copied from interface:VersionGeneratorGenerates a new entry version- Specified by:
generateNewin interfaceVersionGenerator- Returns:
- a new entry version
-
increment
public IncrementableEntryVersion increment(IncrementableEntryVersion initialVersion)
- Specified by:
incrementin interfaceVersionGenerator
-
nonExistingVersion
public IncrementableEntryVersion nonExistingVersion()
- Specified by:
nonExistingVersionin interfaceVersionGenerator
-
-