ActorId Class

定义

ActorId represents identity of an actor within an actor service. The actors can be identified by java.lang.String, java.util.UUID or long.

public class ActorId
继承
java.lang.Object
Comparable<ActorId>
ActorId

构造函数

ActorId(long id)

Initializes a new instance of ActorId class with Id value of type long

ActorId(String id)

Initializes a new instance of ActorId class with Id value of type java.lang.String.

ActorId(UUID id)

Initializes a new instance of ActorId class with Id value of type java.util.UUID

方法

compareTo(ActorId o)

Compares this instance with a specified ActorId object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified actorId.

Remarks:The comparison is done based on the id if both the instances have same ActorIdKind. If ActorIdKind is different, then comparison is done based on string representation of the actor id.

equals(Object obj)

Determines whether this instance and a specified object, which must also be a ActorId object, have the same value.

getKind()

Gets the ActorIdKind for the ActorId.

getLongId()

Gets id for ActorId whose ActorIdKind is ActorIdKind#Long.

getPartitionKey()

Gets partition key for the ActorId.

Remarks:

  • The actor service is always partitioned using uniform Integer64 partition scheme. Therefore the partition key is of long type.

  • The partition key is generated based on the ActorIdKind and the id value as follows:

    • a. ActorIdKind.String : CRC64 hash of the UTF8 bytes of the string id.

    • ActorIdKind.Guid: CRC64 hash of the bytes of the guid id.

    • ActorIdKind.Long: Actual value of the long id.

getStringId()

Gets id for ActorId whose ActorIdKind is ActorIdKind#String.

getUUIDId()

Gets id for ActorId whose ActorIdKind is ActorIdKind#UUID.

hashCode()
newId()

creates a random actor Id.

toString()

适用于