Class DBCThreadedIterator<E>
- java.lang.Object
-
- de.julielab.costosys.dbconnection.DBCIterator<E>
-
- de.julielab.costosys.dbconnection.DBCThreadedIterator<E>
-
- Type Parameters:
E-
- All Implemented Interfaces:
Iterator<E>
- Direct Known Subclasses:
ThreadedColumnsIterator,ThreadedColumnsToRetrieveIterator
public abstract class DBCThreadedIterator<E> extends DBCIterator<E>
This iterator class employs multiple Threads for database queries. While the iterator offers access to retrieved values, additional values are concurrently retrieved from the database by another thread.
The iterator uses the
Exchangerclass to communicate between threads.- Author:
- hellrich/faessler
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectionClosablebackgroundThreadprotected Exchanger<List<E>>listExchanger
-
Constructor Summary
Constructors Constructor Description DBCThreadedIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclose()Frees resources occupied by this iterator (e.g.booleanhasNext()abstract voidjoin()Enext()voidremove()unsupportedprotected voidupdate()-
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
-
-
-
-
Field Detail
-
backgroundThread
protected ConnectionClosable backgroundThread
-
-
Method Detail
-
hasNext
public boolean hasNext()
-
next
public E next()
-
remove
public void remove()
unsupported
-
update
protected void update()
-
close
public abstract void close()
Description copied from class:DBCIteratorFrees resources occupied by this iterator (e.g. database connections).- Specified by:
closein classDBCIterator<E>
-
join
public abstract void join() throws InterruptedException- Throws:
InterruptedException
-
-