Class LedgerEntriesImpl
- java.lang.Object
-
- org.apache.bookkeeper.client.impl.LedgerEntriesImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.lang.Iterable<LedgerEntry>
,LedgerEntries
public class LedgerEntriesImpl extends java.lang.Object implements LedgerEntries
Ledger entries implementation. It is a simple wrap of a list of ledger entries.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close to release the resources held by this instance.static LedgerEntriesImpl
create(java.util.List<LedgerEntry> entries)
Create ledger entries.LedgerEntry
getEntry(long entryId)
Gets a specific LedgerEntry by entryId.java.util.Iterator<LedgerEntry>
iterator()
Get an iterator over all the ledger entries contained in the LedgerEntries object.
-
-
-
Method Detail
-
create
public static LedgerEntriesImpl create(java.util.List<LedgerEntry> entries)
Create ledger entries.- Parameters:
entries
- the entries with ordering- Returns:
- the LedgerEntriesImpl
-
getEntry
public LedgerEntry getEntry(long entryId)
Gets a specific LedgerEntry by entryId.- Specified by:
getEntry
in interfaceLedgerEntries
- Parameters:
entryId
- the LedgerEntry id- Returns:
- the LedgerEntry, null if no LedgerEntry with such entryId
-
iterator
public java.util.Iterator<LedgerEntry> iterator()
Get an iterator over all the ledger entries contained in the LedgerEntries object.Calling this method does not modify the reference count of the ByteBuf in the returned LedgerEntry objects. The caller who calls
LedgerEntries.iterator()
should make sure that they do not call ByteBuf.release() on the LedgerEntry objects to avoid a double free. All reference counts will be decremented when the containing LedgerEntries object is closed viaLedgerEntries.close()
.- Specified by:
iterator
in interfacejava.lang.Iterable<LedgerEntry>
- Specified by:
iterator
in interfaceLedgerEntries
- Returns:
- an iterator of LedgerEntry objects
-
close
public void close()
Description copied from interface:LedgerEntries
Close to release the resources held by this instance.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceLedgerEntries
-
-