java.lang.Object
dev.getelements.elements.sdk.cluster.id.TaskId
All Implemented Interfaces:
HasNodeId, Serializable, Comparable<dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId>>

public class TaskId extends Object implements Serializable, HasNodeId
Represents a globally-unique id of a task, associated with a resource. This is currently backed by an instance of UUID, but the string representation should be considered opaque by users of this type. Though the ResourceId is may be globally represented by a single UUID, for addressment we represent a TaskId with a 4-tuple of UUIDs: (InstanceUuid, ApplicationUuid, ResourceUuid, TaskUuid). I.e. there may multiple Tasks for a Resource, multiple Resources for an Application, multiple Applications for an Instance, and multiple Instances in a deployment. By convention, we may represent the TaskId as a compound Id string, combining the string representation of the ResourceId with the string representation of the TaskId's UUID, separated by the ID_SEPARATOR. Such a string will take the form "{instance_uuid}.{app_uuid}+{resource_uuid}:{task_uuid}".
See Also:
  • Constructor Details

    • TaskId

      public TaskId(ResourceId resourceId)
      Creates a new unique TaskId.
    • TaskId

      public TaskId(String stringRepresentation)
      Creates the TaskId from the provided string representation, as obtained from asString().
      Parameters:
      stringRepresentation - the string representation
    • TaskId

      public TaskId(byte[] byteRepresentation)
      Creates the TaskId from the provided string representation, as obtained from asBytes().
      Parameters:
      byteRepresentation - the string representation
  • Method Details

    • getId

      public dev.getelements.elements.sdk.cluster.id.V1CompoundId getId()
    • getNodeId

      public NodeId getNodeId()
      Returns the NodeId attached to this TaskId.
      Specified by:
      getNodeId in interface HasNodeId
      Returns:
      the NodeId
    • getResourceId

      public ResourceId getResourceId()
      Returns the ResourceId attached to this TaskId
      Returns:
      the ResourceId attached to this TaskId
    • asBytes

      public byte[] asBytes()
      Returns the
      invalid reference
      byte[]
      representation of this TaskId
      Returns:
    • asString

      public String asString()
      Returns the string representation of this TaskId
      Returns:
      the string representation
    • toByteBuffer

      public void toByteBuffer(ByteBuffer byteBuffer)
      Writes this TaskId to the supplied ByteBuffer.
      Parameters:
      byteBuffer - the ByteBuffer to receive the TaskId
    • toByteBuffer

      public void toByteBuffer(ByteBuffer byteBuffer, int position)
      Writes this TaskId to a ByteBuffer at the supplied position. As the position is specified, this does not affect the buffer's mark, limit, position.
      Parameters:
      byteBuffer - the byteBuffer to receive the TaskId
      position - the position at which to write the byte buffer
    • taskIdFromByteBuffer

      public static TaskId taskIdFromByteBuffer(ByteBuffer byteBufferRepresentation, int byteBufferPosition)
      Reads a TaskId from the supplied ByteBuffer and position, ensuring that the buffer's mark, limit, and position are unaffected.
      Parameters:
      byteBufferRepresentation - the byte buffer to read
      byteBufferPosition - the position of the node id within the byte buffer
      Returns:
      the TaskId instance
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object
    • getSizeInBytes

      public static int getSizeInBytes()
      Gets the size of the TaskId in bytes.
      Returns:
      the size, in bytes
    • compareTo

      default int compareTo(dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId> o)
      Compares this instance with the other instance.
      Specified by:
      compareTo in interface Comparable<CompoundIdT extends Comparable<CompoundIdT>>
      Parameters:
      o - the instance
      Returns: