Dela via


MappingLockToken Class

  • java.lang.Object
    • com.microsoft.azure.elasticdb.shard.base.MappingLockToken

public class MappingLockToken

Public type that represents the owner of a lock held on a mapping. This class is immutable.

Field Summary

Modifier and Type Field and Description
final MappingLockToken ForceUnlock

Token that can be used to force an unlock on any locked mapping.

final MappingLockToken NoLock

Token representing the default state where the mapping isn't locked.

Constructor Summary

Constructor Description
MappingLockToken(UUID lockOwnerId)

Instantiates an instance of MappingLockToken with the given lock owner id.

Method Summary

Modifier and Type Method and Description
MappingLockToken create()

Creates an instance of MappingLockToken.

boolean equals(MappingLockToken other)

Compares two instances of MappingLockToken to see if they have the same owner.

boolean equals(Object obj)

Determines whether the specified object is equal to the current object.

UUID getLockOwnerId()
int hashCode()

Calculates the hash code for this instance.

boolean opEquality(MappingLockToken leftMappingLockToken, MappingLockToken rightMappingLockToken)

Equality operator.

boolean opInequality(MappingLockToken leftMappingLockToken, MappingLockToken rightMappingLockToken)

Inequality operator.

void setLockOwnerId(UUID value)

Field Details

ForceUnlock

public static final MappingLockToken ForceUnlock= new MappingLockToken(UUID.fromString("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"))

Token that can be used to force an unlock on any locked mapping.

NoLock

public static final MappingLockToken NoLock= new MappingLockToken(new UUID(0L, 0L))

Token representing the default state where the mapping isn't locked.

Constructor Details

MappingLockToken

public MappingLockToken(UUID lockOwnerId)

Instantiates an instance of MappingLockToken with the given lock owner id.

Parameters:

lockOwnerId - The lock owner id

Method Details

create

public static MappingLockToken create()

Creates an instance of MappingLockToken.

Returns:

An instance of MappingLockToken

equals

public boolean equals(MappingLockToken other)

Compares two instances of MappingLockToken to see if they have the same owner.

Parameters:

other

Returns:

True if they both belong to the same lock owner

equals

public boolean equals(Object obj)

Determines whether the specified object is equal to the current object.

Parameters:

obj - The object to compare with the current object.

Returns:

True if the specified object is equal to the current object; otherwise, false.

getLockOwnerId

public UUID getLockOwnerId()

hashCode

public int hashCode()

Calculates the hash code for this instance.

Returns:

Hash code for the object.

opEquality

public static boolean opEquality(MappingLockToken leftMappingLockToken, MappingLockToken rightMappingLockToken)

Equality operator.

Parameters:

leftMappingLockToken - An instance of MappingLockToken
rightMappingLockToken - An instance of MappingLockToken

Returns:

True if both belong to the same lock owner

opInequality

public static boolean opInequality(MappingLockToken leftMappingLockToken, MappingLockToken rightMappingLockToken)

Inequality operator.

Parameters:

leftMappingLockToken - An instance of MappingLockToken
rightMappingLockToken - An instance of MappingLockToken

Returns:

True if both belong to the same lock owner

setLockOwnerId

public void setLockOwnerId(UUID value)

Parameters:

value

Applies to