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 RequestUUIDAn emptyRequestUUIDused to indicate that an operation does **not** require a unique identifier. -
Method Summary
Modifier and TypeMethodDescriptionasNodeUUID(UUID otherNodeUUID) Creates a newRequestUUIDinstance by replacing this record'snode identifierwith the providedotherNodeUUID, while retaining the originalrequest identifier.booleanlonginthashCode()static RequestUUIDlocalOf(long requestId) Creates aRequestUUIDsuitable for a single-instance, non-clustered environment.static RequestUUIDCreates aRequestUUIDfor the specified nodeAddressand request ID.Returns anAddressrepresenting the origin of this request within the cluster.toString()
-
Field Details
-
NO_REQUEST
An emptyRequestUUIDused 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 aRequestUUIDfor the specified nodeAddressand request ID. TheRequestUUID's node identifier will be derived from the providedaddress.- Parameters:
address- TheAddressof the node that originated the operation. ThenodeUUIDwill be obtained from this address.requestId- The local, monotonically increasing request identifier unique to the node.- Returns:
- A
RequestUUIDrepresenting the given address and request ID.
-
localOf
Creates aRequestUUIDsuitable for a single-instance, non-clustered environment. In this context, thenodeUUIDisnull, 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
RequestUUIDwith anullnode UUID and the provided request ID.
-
getRequestId
@ProtoField(3) public long getRequestId()- Returns:
- The
request identifier.
-
toAddress
Returns anAddressrepresenting the origin of this request within the cluster.The returned
Addressis a **partial representation** of the originating node. It primarily contains the node'sunique identifierand is intended for use in routing messages back to the origin through the network.Crucially, this
Addressdoes **not** contain complete topology, version, or other detailed node information. Any fields on theAddressbeyond 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
nullif theRequestUUIDrepresents an operation from a single-instance, non-clustered environment (i.e., whenlocalOfwas used).- Returns:
- The partial
Addressinstance of the request's originator, ornullif the request originated from a local, non-clustered context.
-
asNodeUUID
Creates a newRequestUUIDinstance by replacing this record'snode identifierwith 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- TheUUIDof the node that this newRequestUUIDshould represent as its originator.- Returns:
- A new
RequestUUIDwith 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
-