public class FlakeIdGeneratorConfigReadOnly extends FlakeIdGeneratorConfig
DEFAULT_PREFETCH_COUNT, DEFAULT_PREFETCH_VALIDITY_MILLIS, MAXIMUM_PREFETCH_COUNT
Modifier and Type | Method and Description |
---|---|
FlakeIdGeneratorConfig |
setIdOffset(long idOffset)
Deprecated.
Sets the offset that will be added to the returned IDs.
|
void |
setName(String name)
Deprecated.
Sets the name or name pattern for this config.
|
FlakeIdGeneratorConfig |
setNodeIdOffset(long nodeIdOffset)
Deprecated.
Sets the offset that will be added to the node ID assigned to cluster member for this generator.
|
FlakeIdGeneratorConfig |
setPrefetchCount(int prefetchCount)
Deprecated.
Sets how many IDs are pre-fetched on the background when one call to
FlakeIdGenerator.newId() is made. |
FlakeIdGeneratorConfig |
setPrefetchValidityMillis(long prefetchValidityMs)
Deprecated.
Sets for how long the pre-fetched IDs can be used.
|
FlakeIdGeneratorConfig |
setStatisticsEnabled(boolean statisticsEnabled)
Deprecated.
Enables or disables statistics gathering of
LocalFlakeIdGeneratorStats . |
equals, getAsReadOnly, getFactoryId, getId, getIdOffset, getName, getNodeIdOffset, getPrefetchCount, getPrefetchValidityMillis, hashCode, isStatisticsEnabled, readData, toString, writeData
public void setName(String name)
FlakeIdGeneratorConfig
Config
.setName
in class FlakeIdGeneratorConfig
public FlakeIdGeneratorConfig setPrefetchCount(int prefetchCount)
FlakeIdGeneratorConfig
FlakeIdGenerator.newId()
is made. Default is 100.
This setting pertains only to newId
calls made on the member
that configured it.
setPrefetchCount
in class FlakeIdGeneratorConfig
prefetchCount
- the desired prefetch count, in the range 1..100,000.public FlakeIdGeneratorConfig setPrefetchValidityMillis(long prefetchValidityMs)
FlakeIdGeneratorConfig
The IDs contain timestamp component, which ensures rough global ordering of IDs. If an ID is assigned to an object that was created much later, it will be much out of order. If you don't care about ordering, set this value to 0.
This setting pertains only to newId
calls made on the member
that configured it.
setPrefetchValidityMillis
in class FlakeIdGeneratorConfig
prefetchValidityMs
- the desired ID validity or unlimited, if <=0public FlakeIdGeneratorConfig setIdOffset(long idOffset)
FlakeIdGeneratorConfig
IdGenerator
, default value works for all green-field projects.
For example: Largest ID returned from IdGenerator
is 150. FlakeIdGenerator
now
returns 100. If you configure idOffset
of 50 and stop using the IdGenerator
, the next
ID from FlakeIdGenerator
will be 151 or larger and no duplicate IDs will be generated.
In real-life, the IDs are much larger. You also need to add a reserve to the offset because the IDs from
FlakeIdGenerator
are only roughly ordered. Recommended reserve is 1<<38
,
that is 274877906944.
Negative values are allowed to increase the lifespan of the generator, however keep in mind that the generated IDs might also be negative.
setIdOffset
in class FlakeIdGeneratorConfig
idOffset
- the value added to each generated IDpublic FlakeIdGeneratorConfig setNodeIdOffset(long nodeIdOffset)
FlakeIdGeneratorConfig
setNodeIdOffset
in class FlakeIdGeneratorConfig
nodeIdOffset
- the value added to the node idfor the node id logic
public FlakeIdGeneratorConfig setStatisticsEnabled(boolean statisticsEnabled)
FlakeIdGeneratorConfig
LocalFlakeIdGeneratorStats
.setStatisticsEnabled
in class FlakeIdGeneratorConfig
statisticsEnabled
- true
if statistics gathering is enabled
(which is also the default), false
otherwiseCopyright © 2020 Hazelcast, Inc.. All Rights Reserved.