PoolLease

class PoolLease(delegateLease: Lease, poolLeaseManager: PoolLeaseManager) : Lease

Constructors

Link copied to clipboard
constructor(delegateLease: Lease, poolLeaseManager: PoolLeaseManager)

Properties

Link copied to clipboard
open override val name: String

Functions

Link copied to clipboard
open override fun acquire(): Boolean

Attempts to acquire the lock on the lease. If the lock was not already held and the lock was successfully obtained, listeners should be notified.

Link copied to clipboard
open override fun addListener(listener: Lease.StateChangeListener)

Registers a listener that is called on lease state changes.

Link copied to clipboard
open override fun checkHeld(): Boolean

Can always use the delegate's result

Link copied to clipboard
open override fun checkHeldElsewhere(): Boolean
Link copied to clipboard
open override fun release(): Boolean

Release the lock on the lease. This will return true if released. Note that it will return false if the lease was not held. Listeners should be notified before the lock is released.

open override fun release(lazy: Boolean): Boolean

Release the lock on the lease, with the option of doing it lazily if possible. This should return false if the lease was not held or if the release is lazy. Listeners should be notified before the lock is released.

Link copied to clipboard
open override fun shouldHold(): Boolean