Package codes.grow.packages.vault
Class ManagedLease
java.lang.Object
codes.grow.packages.vault.ManagedLease
- All Implemented Interfaces:
AutoCloseable
Handle of a lease kept alive by
LeaseManager.manage(Lease, RenewalOptions).-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops renewing and waits for the optional revocation.booleanexpired()Returns whetheronExpirefired.Returns the expiry of the current lease.leaseId()Returns the lease id.booleanrunning()Returns whether renewal is still active.Stops renewing (and revokes the lease whenrevokeOnStop).toString()
-
Method Details
-
leaseId
Returns the lease id.- Returns:
- the id
-
running
public boolean running()Returns whether renewal is still active.- Returns:
- true while running
-
expired
public boolean expired()Returns whetheronExpirefired.- Returns:
- true once expired
-
expiresAt
Returns the expiry of the current lease.- Returns:
- the expiry, or empty when it never expires
-
stopAsync
Stops renewing (and revokes the lease whenrevokeOnStop). Idempotent.- Returns:
- a future completed when stopped (revocation errors go to
onError)
-
close
public void close()Stops renewing and waits for the optional revocation. Idempotent.- Specified by:
closein interfaceAutoCloseable
-
toString
-