Class ThreadedColumnsToRetrieveIterator
- java.lang.Object
-
- de.julielab.costosys.dbconnection.DBCIterator<E>
-
- de.julielab.costosys.dbconnection.DBCThreadedIterator<byte[][]>
-
- de.julielab.costosys.dbconnection.ThreadedColumnsToRetrieveIterator
-
- All Implemented Interfaces:
Iterator<byte[][]>
public class ThreadedColumnsToRetrieveIterator extends DBCThreadedIterator<byte[][]>
An iterator that returns documents stored in the database identified by the primary keys delivered in a list upon creation of the iterator. The returned data corresponds to the columns marked to be retrieved in the table schema also given at iterator creation.
The iterator employs two threads to retrieve new documents from the database while other documents, fetched before, can be processed concurrently. The idea is that the database can work in parallel to the program working with the retrieved documents.- Author:
- hellrich
-
-
Field Summary
-
Fields inherited from class de.julielab.costosys.dbconnection.DBCThreadedIterator
backgroundThread, listExchanger
-
-
Constructor Summary
Constructors Constructor Description ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, CoStoSysConnection conn, List<Object[]> ids, String[] tables, String[] schemaNames)Retrieves data from the database over multiple tables.ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, CoStoSysConnection conn, List<Object[]> ids, String table, String schemaName)ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, CoStoSysConnection conn, List<Object[]> ids, String table, String whereClause, String schemaName)ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, List<Object[]> ids, String[] tables, String[] schemaNames)ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, List<Object[]> ids, String table, String schemaName)ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, List<Object[]> ids, String table, String whereClause, String schemaName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Frees resources occupied by this iterator (e.g.voidjoin()-
Methods inherited from class de.julielab.costosys.dbconnection.DBCThreadedIterator
hasNext, next, remove, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
ThreadedColumnsToRetrieveIterator
public ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, CoStoSysConnection conn, List<Object[]> ids, String table, String schemaName)
-
ThreadedColumnsToRetrieveIterator
public ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, List<Object[]> ids, String table, String schemaName)
-
ThreadedColumnsToRetrieveIterator
public ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, List<Object[]> ids, String table, String whereClause, String schemaName)
-
ThreadedColumnsToRetrieveIterator
public ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, CoStoSysConnection conn, List<Object[]> ids, String table, String whereClause, String schemaName)
-
ThreadedColumnsToRetrieveIterator
public ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, CoStoSysConnection conn, List<Object[]> ids, String[] tables, String[] schemaNames)
Retrieves data from the database over multiple tables. All tables will be joined on the given IDs. The columns to be retrieved for each table is determined by its table schema. For this purpose, thetablesandschemaNamearrays are required to be parallel.- Parameters:
dbc- A DataBaseConnector instanceconn- An active database connectionids- A list of primary keys identifying the items to retrieve.tables- The tables from which the items should be retrieved that are identified byids.schemaNames- A parallel array totablesthas specifies the table schema name of each table.
-
ThreadedColumnsToRetrieveIterator
public ThreadedColumnsToRetrieveIterator(DataBaseConnector dbc, List<Object[]> ids, String[] tables, String[] schemaNames)
-
-
Method Detail
-
close
public void close()
Description copied from class:DBCIteratorFrees resources occupied by this iterator (e.g. database connections).- Specified by:
closein classDBCThreadedIterator<byte[][]>
-
join
public void join() throws InterruptedException- Specified by:
joinin classDBCThreadedIterator<byte[][]>- Throws:
InterruptedException
-
-