acquire Or Null
Attempts to acquire an AutoCloseableLease.
Use like
leaseManager.acquireOrNull("some-lease")?.use { lease ->
// Do something with the lease.
}Content copied to clipboard
Optionally, the lease can be released lazily (if possible)
fun LeaseManager.acquireOrNull(name: String, options: AcquireOptions, lazy: Boolean = false): AutoCloseableLease?
Attempts to acquire an AutoCloseableLease with options.
Optionally, the lease can be released lazily (if possible).