LoadBalancedLeaseManager

A marker interface for LeaseManager implementations that provide load-balanced lease distribution across service instances (e.g. consistent hashing).

Load-balanced lease managers ensure that leases are distributed across different instances to spread load and prevent a single instance from acquiring all leases. This is useful for scenarios where multiple leases need to be processed in parallel across a cluster.

Implementations should ensure that:

  • Leases are distributed fairly across instances

  • No single instance is overwhelmed with too many leases

  • The distribution adapts to instance availability changes

Functions

Link copied to clipboard
Link copied to clipboard
open fun releaseAll()
Link copied to clipboard
abstract fun requestLease(name: String): Lease

Registers interest in the lease with the given name. Service instances should register their interest in leases as soon as they know about them; this gives the process an opportunity to notify the underlying cluster system that it is interested in the lease, or to setup other background tasks to acquire the lease if necessary. Note that registering interest in a lease doesn't necessarily mean that this service instance will attempt to acquire the lease; many clustering systems will only try to acquire leases for resources that they think they should own based on some consistent hashing system