Class RequestUUID
This identifier is composed of a node's unique identifier and a locally generated, monotonically increasing request ID.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic RequestUUID
An emptyRequestUUID
used to indicate that an operation does **not** require a unique identifier. -
Method Summary
Modifier and TypeMethodDescriptionasNodeUUID
(UUID otherNodeUUID) Creates a newRequestUUID
instance by replacing this record'snode identifier
with the providedotherNodeUUID
, while retaining the originalrequest identifier
.boolean
long
int
hashCode()
static RequestUUID
localOf
(long requestId) Creates aRequestUUID
suitable for a single-instance, non-clustered environment.static RequestUUID
Creates aRequestUUID
for the specified nodeAddress
and request ID.Returns anAddress
representing the origin of this request within the cluster.toString()
-
Field Details
-
NO_REQUEST
An emptyRequestUUID
used to indicate that an operation does **not** require a unique identifier.This instance contains a zeroed-out UUID (`00000000-0000-0000-0000-000000000000`) and a `requestId` of `0`. It's used as a placeholder when an operation's unique identification is either not applicable or explicitly unnecessary.
-
-
Method Details
-
of
Creates aRequestUUID
for the specified nodeAddress
and request ID. TheRequestUUID
's node identifier will be derived from the providedaddress
.- Parameters:
address
- TheAddress
of the node that originated the operation. ThenodeUUID
will be obtained from this address.requestId
- The local, monotonically increasing request identifier unique to the node.- Returns:
- A
RequestUUID
representing the given address and request ID.
-
localOf
Creates aRequestUUID
suitable for a single-instance, non-clustered environment. In this context, thenodeUUID
isnull
, signifying that the operation is local and not associated with a specific cluster node.- Parameters:
requestId
- The local, monotonically increasing request identifier unique to this single application instance.- Returns:
- A
RequestUUID
with anull
node UUID and the provided request ID.
-
getRequestId
@ProtoField(3) public long getRequestId()- Returns:
- The
request identifier
.
-
toAddress
Returns anAddress
representing the origin of this request within the cluster.The returned
Address
is a **partial representation** of the originating node. It primarily contains the node'sunique identifier
and is intended for use in routing messages back to the origin through the network.Crucially, this
Address
does **not** contain complete topology, version, or other detailed node information. Any fields on theAddress
beyond the essential routing identifiers should not be inspected or relied upon, as their values are not guaranteed to be valid or complete.This method will return
null
if theRequestUUID
represents an operation from a single-instance, non-clustered environment (i.e., whenlocalOf
was used).- Returns:
- The partial
Address
instance of the request's originator, ornull
if the request originated from a local, non-clustered context.
-
asNodeUUID
Creates a newRequestUUID
instance by replacing this record'snode identifier
with the providedotherNodeUUID
, while retaining the originalrequest identifier
.This method is typically used when an operation, identified by its local
requestId
, is being processed or re-assigned to a different node due to a node failure. It allows tracking the same logical operation (viarequestId
) but associating it with a new originating or processing node (viaotherNodeUUID
).- Parameters:
otherNodeUUID
- TheUUID
of the node that this newRequestUUID
should represent as its originator.- Returns:
- A new
RequestUUID
with the updated node UUID and the original request ID.
-
toIdString
- Returns:
- A compact representation of this
RequestUUID
, containing only the node's logical name and the request ID.
-
equals
-
hashCode
-
toString
-