Compartir vía


ActorId Class

  • java.lang.Object
    • Comparable<ActorId>
      • microsoft.servicefabric.actors.ActorId

public class ActorId

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

Constructor Summary

Constructor Description
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

Method Summary

Modifier and Type Method and Description
int 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.

boolean equals(Object obj)

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

ActorIdKind getKind()

Gets the ActorIdKind for the ActorId.

long getLongId()

Gets id for ActorId whose ActorIdKind is Long.

long getPartitionKey()

Gets partition key for the ActorId.

Remarks:

    <li>
    
      <p>The actor service is always partitioned using uniform Integer64 partition scheme. Therefore the partition key is of long type. </p>
    
    </li>
    
    <li>
    
      <p>The partition key is generated based on the <xref uid="microsoft.servicefabric.actors.ActorIdKind" data-throw-if-not-resolved="false" data-raw-source="ActorIdKind"></xref> and the id value as follows: <ul><li><p>a. ActorIdKind.String : CRC64 hash of the UTF8 bytes of the string id. </p></li><li><p>ActorIdKind.Guid: CRC64 hash of the bytes of the guid id. </p></li><li><p>ActorIdKind.Long: Actual value of the long id. </p></li></ul></p>
    
    </li>
    

String getStringId()

Gets id for ActorId whose ActorIdKind is String.

UUID getUUIDId()

Gets id for ActorId whose ActorIdKind is UUID.

int hashCode()
ActorId newId()

creates a random actor Id.

String toString()

Constructor Details

ActorId

public ActorId(long id)

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

Parameters:

id - Value for actor id.

ActorId

public ActorId(String id)

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

Parameters:

id - Value for actor id.

ActorId

public ActorId(UUID id)

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

Parameters:

id - Value for actor id.

Method Details

compareTo

public int 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.

Parameters:

o - The actorId to compare with this instance.

Returns:

A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the other parameter.

equals

public boolean equals(Object obj)

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

Parameters:

obj - The actorId to compare to this instance.

Returns:

true if obj is a ActorId and its value is the same as this instance; otherwise, false. If obj is null, the method returns false.

getKind

public ActorIdKind getKind()

Gets the ActorIdKind for the ActorId.

Returns:

ActorIdKind for the ActorId.

getLongId

public long getLongId()

Gets id for ActorId whose ActorIdKind is Long.

Returns:

long id value for AcotrId.

getPartitionKey

public long getPartitionKey()

Gets partition key for the ActorId.

Remarks:

    <li>
    
      <p>The actor service is always partitioned using uniform Integer64 partition scheme. Therefore the partition key is of long type. </p>
    
    </li>
    
    <li>
    
      <p>The partition key is generated based on the <xref uid="microsoft.servicefabric.actors.ActorIdKind" data-throw-if-not-resolved="false" data-raw-source="ActorIdKind"></xref> and the id value as follows: <ul><li><p>a. ActorIdKind.String : CRC64 hash of the UTF8 bytes of the string id. </p></li><li><p>ActorIdKind.Guid: CRC64 hash of the bytes of the guid id. </p></li><li><p>ActorIdKind.Long: Actual value of the long id. </p></li></ul></p>
    
    </li>
    

Returns:

The key for locating the partition of the actor service that is responsible for this ActorId.

getStringId

public String getStringId()

Gets id for ActorId whose ActorIdKind is String.

Returns:

String id value for AcotrId.

getUUIDId

public UUID getUUIDId()

Gets id for ActorId whose ActorIdKind is UUID.

Returns:

java.util.UUID id value for ActorId.

hashCode

public int hashCode()

Returns:

Hash code for the current object.

newId

public static ActorId newId()

creates a random actor Id.

Returns:

new actor Id.

toString

public String toString()

Returns:

Returns a string that represents the current object.

Applies to