Class RequestUUID

java.lang.Object
org.infinispan.commands.RequestUUID

@ProtoTypeId(52) public final class RequestUUID extends Object
Uniquely identifies an operation or transaction within the cluster.

This identifier is composed of a node's unique identifier and a locally generated, monotonically increasing request ID.

  • Field Details

    • NO_REQUEST

      public static RequestUUID NO_REQUEST
      An empty RequestUUID 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

      public static RequestUUID of(Address address, long requestId)
      Creates a RequestUUID for the specified node Address and request ID. The RequestUUID's node identifier will be derived from the provided address.
      Parameters:
      address - The Address of the node that originated the operation. The nodeUUID 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

      public static RequestUUID localOf(long requestId)
      Creates a RequestUUID suitable for a single-instance, non-clustered environment. In this context, the nodeUUID is null, 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 a null node UUID and the provided request ID.
    • getRequestId

      @ProtoField(3) public long getRequestId()
      Returns:
      The request identifier.
    • toAddress

      public Address toAddress()
      Returns an Address 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's unique 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 the Address 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 the RequestUUID represents an operation from a single-instance, non-clustered environment (i.e., when localOf was used).

      Returns:
      The partial Address instance of the request's originator, or null if the request originated from a local, non-clustered context.
    • asNodeUUID

      public RequestUUID asNodeUUID(UUID otherNodeUUID)
      Creates a new RequestUUID instance by replacing this record's node identifier with the provided otherNodeUUID, while retaining the original request 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 (via requestId) but associating it with a new originating or processing node (via otherNodeUUID).

      Parameters:
      otherNodeUUID - The UUID of the node that this new RequestUUID should represent as its originator.
      Returns:
      A new RequestUUID with the updated node UUID and the original request ID.
    • toIdString

      public String toIdString()
      Returns:
      A compact representation of this RequestUUID, containing only the node's logical name and the request ID.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object