Package com.hazelcast.client.config
Class ClientFlakeIdGeneratorConfig
java.lang.Object
com.hazelcast.client.config.ClientFlakeIdGeneratorConfig
The
ClientFlakeIdGeneratorConfig
contains the configuration for the client
regarding Flake ID Generator
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Default value for bit-length of node id componentstatic final int
Default value forgetPrefetchCount()
.static final long
Default value forgetPrefetchValidityMillis()
.static final int
Maximum value for prefetch count. -
Constructor Summary
ConstructorDescriptionCopy-constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
getName()
Returns the configuration name.int
long
int
hashCode()
Sets the name or name pattern for this config.setPrefetchCount
(int prefetchCount) Sets how many IDs are pre-fetched on the background when one call toFlakeIdGenerator.newId()
is made.setPrefetchValidityMillis
(long prefetchValidityMs) Sets for how long the pre-fetched IDs can be used.toString()
-
Field Details
-
DEFAULT_PREFETCH_COUNT
public static final int DEFAULT_PREFETCH_COUNTDefault value forgetPrefetchCount()
.- See Also:
-
DEFAULT_PREFETCH_VALIDITY_MILLIS
public static final long DEFAULT_PREFETCH_VALIDITY_MILLISDefault value forgetPrefetchValidityMillis()
.- See Also:
-
DEFAULT_BITS_NODE_ID
public static final int DEFAULT_BITS_NODE_IDDefault value for bit-length of node id component- See Also:
-
MAXIMUM_PREFETCH_COUNT
public static final int MAXIMUM_PREFETCH_COUNTMaximum value for prefetch count. The limit is ~10% of the default time we allow the IDs to be from the futureThe reason to limit the prefetch count is that a single call to
FlakeIdGenerator.newId()
might be blocked if the future allowance is exceeded: we want to avoid a single call for a large batch to block another call for a small batch.- See Also:
-
-
Constructor Details
-
ClientFlakeIdGeneratorConfig
-
ClientFlakeIdGeneratorConfig
Copy-constructor
-
-
Method Details
-
getName
Returns the configuration name. This can be actual object name or pattern. -
setName
Sets the name or name pattern for this config. Must not be modified after this instance is added toClientConfig
. -
getPrefetchCount
public int getPrefetchCount()- See Also:
-
setPrefetchCount
Sets how many IDs are pre-fetched on the background when one call toFlakeIdGenerator.newId()
is made. Default is 100.- Parameters:
prefetchCount
- the desired prefetch count, in the range 1..100,000.- Returns:
- this instance for fluent API
-
getPrefetchValidityMillis
public long getPrefetchValidityMillis()- See Also:
-
setPrefetchValidityMillis
Sets for how long the pre-fetched IDs can be used. If this time elapses, a new batch of IDs will be fetched. Time unit is milliseconds, default is 600,000 (10 minutes).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.
- Parameters:
prefetchValidityMs
- the desired ID validity or unlimited, if <=0- Returns:
- this instance for fluent API
-
equals
-
hashCode
public int hashCode() -
toString
-