Class ComponentIdGenerator
This component generates type-one UUID. It is used for generating ID of all NiFi components. Giving the 128-bit UUID structure which consists of Least Significant Bits (LSB) and Most Significant Bits (MSB) this component provides support for generating and maintaining INCEPTION ID of the component (MSB) as well as its INSTANCE ID (LSB).
It is also important to understand that while this component does seed itself
from current time which could be extracted from the resulting UUID via call
to UUID.timestamp()
operation, one should not be relying on such time
as the exact time when such ID was generated since in the event the same time
is passed to one of the generateId()
operation it will be
incremented by 1 since the goal of this component to only ensure uniqueness
and type-one semantics where each UUID generated by this component is
comparable and each subsequent ID is > then previous ID.
For more details on how it is interacted with please see org.apache.nifi.web.util.SnippetUtils as well as org.apache.nifi.web.util.SnippetUtilsTest which contain additional documentation on its usage as well as ID generation contracts defined in NiFi.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static long
private static long
static final Object
private static final org.slf4j.Logger
private static final SecureRandom
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final UUID
Will generate unique time based UUID where the next UUID is always greater then the previous.static final UUID
generateId
(long currentTime) static final UUID
generateId
(long msb, long lsb, boolean ensureUnique)
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
lock
-
lastTime
private static long lastTime -
clockSequence
private static long clockSequence -
randomGenerator
-
-
Constructor Details
-
ComponentIdGenerator
public ComponentIdGenerator()
-
-
Method Details
-
generateId
Will generate unique time based UUID where the next UUID is always greater then the previous. -
generateId
-
generateId
-