Class TaskId
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>>
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 Summary
ConstructorsConstructorDescriptionTaskId(byte[] byteRepresentation) TaskId(ResourceId resourceId) Creates a new uniqueTaskId.Creates theTaskIdfrom the provided string representation, as obtained fromasString(). -
Method Summary
Modifier and TypeMethodDescriptionbyte[]asBytes()Returns therepresentation of thisinvalid reference
byte[]TaskIdasString()Returns the string representation of thisTaskIddefault intcompareTo(dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId> o) Compares this instance with the other instance.booleandev.getelements.elements.sdk.cluster.id.V1CompoundIdgetId()Returns theResourceIdattached to thisTaskIdstatic intGets the size of theTaskIdin bytes.inthashCode()static TaskIdtaskIdFromByteBuffer(ByteBuffer byteBufferRepresentation, int byteBufferPosition) Reads aTaskIdfrom the suppliedByteBufferand position, ensuring that the buffer's mark, limit, and position are unaffected.voidtoByteBuffer(ByteBuffer byteBuffer) Writes thisTaskIdto the suppliedByteBuffer.voidtoByteBuffer(ByteBuffer byteBuffer, int position) Writes thisTaskIdto aByteBufferat the supplied position.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.getelements.elements.sdk.cluster.id.HasNodeId
getOptionalNodeId
-
Constructor Details
-
TaskId
Creates a new uniqueTaskId. -
TaskId
Creates theTaskIdfrom the provided string representation, as obtained fromasString().- Parameters:
stringRepresentation- the string representation
-
TaskId
public TaskId(byte[] byteRepresentation) - Parameters:
byteRepresentation- the string representation
-
-
Method Details
-
getId
public dev.getelements.elements.sdk.cluster.id.V1CompoundId getId() -
getNodeId
-
getResourceId
Returns theResourceIdattached to thisTaskId- Returns:
- the
ResourceIdattached to thisTaskId
-
asBytes
public byte[] asBytes()Returns therepresentation of thisinvalid reference
byte[]TaskId- Returns:
-
asString
Returns the string representation of thisTaskId- Returns:
- the string representation
-
toByteBuffer
Writes thisTaskIdto the suppliedByteBuffer.- Parameters:
byteBuffer- theByteBufferto receive theTaskId
-
toByteBuffer
Writes thisTaskIdto aByteBufferat the supplied position. As the position is specified, this does not affect the buffer's mark, limit, position.- Parameters:
byteBuffer- the byteBuffer to receive theTaskIdposition- the position at which to write the byte buffer
-
taskIdFromByteBuffer
public static TaskId taskIdFromByteBuffer(ByteBuffer byteBufferRepresentation, int byteBufferPosition) Reads aTaskIdfrom the suppliedByteBufferand position, ensuring that the buffer's mark, limit, and position are unaffected.- Parameters:
byteBufferRepresentation- the byte buffer to readbyteBufferPosition- the position of the node id within the byte buffer- Returns:
- the
TaskIdinstance
-
equals
-
hashCode
public int hashCode() -
toString
-
getSizeInBytes
public static int getSizeInBytes()Gets the size of theTaskIdin 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:
compareToin interfaceComparable<CompoundIdT extends Comparable<CompoundIdT>>- Parameters:
o- the instance- Returns:
-