BaseLease Class
- java.
lang. Object - Comparable<BaseLease>
- com.
microsoft. azure. eventprocessorhost. BaseLease
- com.
public class BaseLease
BaseLease class is public so that advanced users can implement an ILeaseManager. Unless you are implementing ILeaseManager you should not have to deal with objects of this class or derived classes directly.
This lightweight base exists to allow ILeaseManager.getAllLeases to operate as quickly as possible for some lease manager implementations, loading the entire contents of a lease form the store may be expensive. BaseLease contains only the minimum amount of information required to allow PartitionScanner to operate.
Note that a Lease object just carries information about a partition lease. The APIs to acquire/renew/release a lease are all on ILeaseManager.
Constructor Summary
Constructor | Description |
---|---|
BaseLease() |
Do not use; added only for GSon deserializer |
BaseLease(BaseLease source) |
Create a BaseLease by duplicating the given Lease. |
BaseLease(String partitionId) |
Create a BaseLease for the given partition. |
BaseLease(String partitionId, String owner, boolean isOwned) |
Create and populate a BaseLease for the given partition. |
Method Summary
Modifier and Type | Method and Description |
---|---|
int | compareTo(BaseLease other) |
boolean |
getIsOwned()
Get the owned state of the lease. |
String |
getOwner()
The owner of a lease is the name of the EventProcessorHost instance which currently holds the lease. |
String |
getPartitionId()
Returns the id of the partition that this Lease is for. Immutable so there is no corresponding setter. |
boolean |
isOwnedBy(String possibleOwner)
Convenience function for comparing possibleOwner against this.owner |
void |
setIsOwned(boolean newState)
Set the owned state of the lease. |
void |
setOwner(String owner)
Set the owner string. Used when a host steals a lease. |
Constructor Details
BaseLease
protected BaseLease()
Do not use; added only for GSon deserializer
BaseLease
public BaseLease(BaseLease source)
Create a BaseLease by duplicating the given Lease.
Parameters:
BaseLease
public BaseLease(String partitionId)
Create a BaseLease for the given partition.
Parameters:
BaseLease
public BaseLease(String partitionId, String owner, boolean isOwned)
Create and populate a BaseLease for the given partition.
Parameters:
Method Details
compareTo
public int compareTo(BaseLease other)
Parameters:
getIsOwned
public boolean getIsOwned()
Get the owned state of the lease.
Returns:
getOwner
public String getOwner()
The owner of a lease is the name of the EventProcessorHost instance which currently holds the lease.
Returns:
getPartitionId
public String getPartitionId()
Returns the id of the partition that this Lease is for. Immutable so there is no corresponding setter.
Returns:
isOwnedBy
public boolean isOwnedBy(String possibleOwner)
Convenience function for comparing possibleOwner against this.owner
Parameters:
Returns:
setIsOwned
public void setIsOwned(boolean newState)
Set the owned state of the lease.
Parameters:
setOwner
public void setOwner(String owner)
Set the owner string. Used when a host steals a lease.
Parameters:
Applies to
Azure SDK for Java
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for