Interface DBCursor<T>
-
- Type Parameters:
T
- type of the record being returned
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
DomainDBCursor
,ECLMultiDomainDBCursor
,MultiDomainDBCursor
@NotThreadSafe public interface DBCursor<T> extends Closeable
Generic cursor interface into the changelog database. Once it is not used anymore, a cursor must be closed to release all the resources into the database.The cursor provides a java.sql.ResultSet like API : it is positioned before the first requested record and needs to be moved forward by calling
next()
.Usage:
try (DBCursor cursor = ...) { while (cursor.next()) { Record record = cursor.getRecord(); // ... can call cursor.getRecord() again: it will return the same result } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DBCursor.CursorOptions
Options to create a cursor.static class
DBCursor.PositionStrategy
Represents a cursor key positioning strategy.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close()
Release the resources and locks used by this Iterator.T
getRecord()
Getter for the current record.boolean
next()
Skip to the next record of the database.
-
-
-
Method Detail
-
getRecord
T getRecord()
Getter for the current record.This method will always return
null
when- Returns:
- The current record. May be
null
.
-
next
boolean next() throws ChangelogException
Skip to the next record of the database.- Returns:
- true if has next, false otherwise
- Throws:
ChangelogException
- When database exception raised.
-
close
default void close()
Release the resources and locks used by this Iterator. This method must be called when the iterator is no longer used. Failure to do it could cause DB deadlock.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-