Class DBCThreadedIterator<E>
- java.lang.Object
-
- de.julielab.costosys.dbconnection.DBCIterator<E>
-
- de.julielab.costosys.dbconnection.DBCThreadedIterator<E>
-
- Type Parameters:
E-
- All Implemented Interfaces:
java.util.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 java.util.concurrent.Exchanger<java.util.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()
-
-
-
Field Detail
-
listExchanger
protected java.util.concurrent.Exchanger<java.util.List<E>> listExchanger
-
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 java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
-