Package org.apache.bookkeeper.client.api
Interface Handle
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Subinterfaces:
ReadHandle,WriteAdvHandle,WriteHandle
- All Known Implementing Classes:
LedgerHandle,LedgerHandleAdv,ReadOnlyLedgerHandle
@Public @Unstable public interface Handle extends java.lang.AutoCloseable
Handle to manage an open ledger.- Since:
- 4.6
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Close this handle synchronously.java.util.concurrent.CompletableFuture<java.lang.Void>closeAsync()Asynchronous close the handle.longgetId()Get the id of the current ledger.LedgerMetadatagetLedgerMetadata()Returns the metadata of this ledger.
-
-
-
Method Detail
-
getId
long getId()
Get the id of the current ledger.- Returns:
- the id of the ledger
-
close
default void close() throws BKException, java.lang.InterruptedExceptionClose this handle synchronously.- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
BKExceptionjava.lang.InterruptedException- See Also:
closeAsync()
-
closeAsync
java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
Asynchronous close the handle.- Returns:
- an handle to access the result of the operation
-
getLedgerMetadata
LedgerMetadata getLedgerMetadata()
Returns the metadata of this ledger.This call only retrieves the metadata cached locally. If there is any metadata updated, the read handle will receive the metadata updates and update the metadata locally. The metadata notification can be deplayed, so it is possible you can receive a stale copy of ledger metadata from this call.
- Returns:
- the metadata of this ledger.
-
-