Class ResultSetRemoteIterator<T>
- java.lang.Object
-
- de.aristaflow.adept2.model.common.collection.AbstractRemoteIterator<T,T>
-
- de.aristaflow.adept2.model.common.collection.AbstractTimeTrackingRemoteIterator<T>
-
- de.aristaflow.adept2.core.transactionmanager.ResultSetRemoteIterator<T>
-
- Type Parameters:
T
- The type of the elements that are retrieved from the encapsulated result set.
- All Implemented Interfaces:
RemoteIterator<List<T>>
,de.aristaflow.adept2.model.communication.ServerSideProxy
,de.aristaflow.adept2.model.communication.TimeTrackingSsProxy
,Closeable
,AutoCloseable
public abstract class ResultSetRemoteIterator<T> extends AbstractTimeTrackingRemoteIterator<T>
This remote iterator encapsulates a result set. It just access the result set when iterating but does not cache anything internally. Therefore no real consistency checking can take place. Since the elements of a result set are specific, retrieving one element from the result set has to be provided by subclasses.The cursor of the underlying result set is positioned at the first element to be retrieved next in forward-only mode. Therefore in forward direction (the only possible direction) retrieve the element before advancing. In scrollable mode (non forward-only) the result set is positioned at the last element which has been retrieved (except the first element).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ResultSetRemoteIterator.ResultSetRemoteIteratorCloseTask
The clean-up task for closing the wrapped result set and dropping created recursion tables.
-
Field Summary
-
Fields inherited from class de.aristaflow.adept2.model.common.collection.AbstractTimeTrackingRemoteIterator
busyThreads, snapshot
-
Fields inherited from class de.aristaflow.adept2.model.common.collection.AbstractRemoteIterator
cleanup, closeables, logger, transformator
-
-
Constructor Summary
Constructors Constructor Description ResultSetRemoteIterator(ManagedResultSet resultSet, int resType, long aliveTime, long aliveTimeExtension, Logger logger, String... recTables)
Creates a new remote iterator for the designated result set to be alive for the designated time and extending the alive time for each access by the designated amount.ResultSetRemoteIterator(ManagedResultSet resultSet, long aliveTime)
Deprecated, for removal: This API element is subject to removal in a future version.ResultSetRemoteIterator(ManagedResultSet resultSet, long aliveTime, long aliveTimeExtension, Logger logger, String... recTables)
Creates a new remote iterator for the designated result set to be alive for the designated time and extending the alive time for each access by the designated amount.ResultSetRemoteIterator(ManagedResultSet resultSet, long aliveTime, String[] recTables)
Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Explicitly closes this iterator which allows to release occupied memory and resources.protected List<T>
getAllImpl()
ImplementsAbstractRemoteIterator.getAll()
without the need to consider result transformation, closeable and alive time tracking.protected List<T>
getNextImpl(int count)
ImplementsAbstractRemoteIterator.getNext(int)
without the need to consider result transformation, closeable and alive time tracking.protected List<T>
getNextImpl(int count, int start)
ImplementsAbstractRemoteIterator.getNext(int, int)
without the need to consider result transformation, closeable and alive time tracking.protected abstract T
getObject(ResultSet resSet)
Gets the current object of the designated result set.protected List<T>
getPreviousImpl(int count)
ImplementsAbstractRemoteIterator.getPrevious(int)
without the need to consider result transformation, closeable and alive time tracking.protected static int
getRsType(ResultSet resultSet)
Gets the type of the designated result set.protected boolean
isClosed()
Gets whether this remote iterator has been closed and its data is not available any more.-
Methods inherited from class de.aristaflow.adept2.model.common.collection.AbstractTimeTrackingRemoteIterator
enter, exit, getCloseTime, getRemainingAliveTime, getSnapshotImpl, isBusy, isForwardOnly, isSnapshot, keepAlive, setCloseTime
-
Methods inherited from class de.aristaflow.adept2.model.common.collection.AbstractRemoteIterator
aboutToReturn, closeOnTraversal, getAll, getNext, getNext, getPrevious, setCloseOnTraversal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.model.common.collection.RemoteIterator
drop
-
-
-
-
Constructor Detail
-
ResultSetRemoteIterator
@Deprecated(since="15.0.0", forRemoval=true) public ResultSetRemoteIterator(ManagedResultSet resultSet, long aliveTime) throws DataSourceException
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new remote iterator for the designated result set to be alive for the designated time.- Parameters:
resultSet
- The result set for which to create a remote iterator. This must not be null. The result set has to be managed by aTxManager
.aliveTime
- The time in milliseconds the created remote iterator is alive.- Throws:
DataSourceException
- If positioning the result set or retrieving the scroll behaviour of the result set fails, aDataSourceException
will be thrown.
-
ResultSetRemoteIterator
@Deprecated(since="15.0.0", forRemoval=true) public ResultSetRemoteIterator(ManagedResultSet resultSet, long aliveTime, String[] recTables) throws DataSourceException
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new remote iterator for the designated result set to be alive for the designated time dropping the designated recursion tables when closing this iterator.- Parameters:
resultSet
- The result set for which to create a remote iterator. This must not be null. The result set has to be managed by aTxManager
.aliveTime
- The time in milliseconds the created remote iterator is alive.recTables
- The recursion tables to drop together with this iterator.null
if there are no such tables.- Throws:
DataSourceException
- If positioning the result set or retrieving the scroll behaviour of the result set fails, aDataSourceException
will be thrown.
-
ResultSetRemoteIterator
public ResultSetRemoteIterator(ManagedResultSet resultSet, long aliveTime, long aliveTimeExtension, Logger logger, String... recTables) throws DataSourceException
Creates a new remote iterator for the designated result set to be alive for the designated time and extending the alive time for each access by the designated amount. The designated recursion tables will be dropped when closing this iterator.- Parameters:
resultSet
- The result set for which to create a remote iterator. This must not be null. The result set has to be managed by aTxManager
.aliveTime
- The time in milliseconds this remote iterator is alive.aliveTimeExtension
- The time in milliseconds to extend the alive time when accessing this remote iterator.logger
- The logger for logging messages instead of throwing exceptions.recTables
- The recursion tables to drop together with this iterator.null
if there are no such tables.- Throws:
DataSourceException
- If positioning the result set or retrieving the scroll behaviour of the result set fails, aDataSourceException
will be thrown.
-
ResultSetRemoteIterator
public ResultSetRemoteIterator(ManagedResultSet resultSet, int resType, long aliveTime, long aliveTimeExtension, Logger logger, String... recTables)
Creates a new remote iterator for the designated result set to be alive for the designated time and extending the alive time for each access by the designated amount. The designated recursion tables will be dropped when closing this iterator.- Parameters:
resultSet
- The result set for which to create a remote iterator. This must not be null. The result set has to be managed by aTxManager
.resType
- The type of the designated result set.aliveTime
- The time in milliseconds this remote iterator is alive.aliveTimeExtension
- The time in milliseconds to extend the alive time when accessing this remote iterator.logger
- The logger for logging messages instead of throwing exceptions.recTables
- The recursion tables to drop together with this iterator.null
if there are no such tables.
-
-
Method Detail
-
getRsType
protected static int getRsType(ResultSet resultSet) throws DataSourceException
Gets the type of the designated result set. This allows to determineAbstractTimeTrackingRemoteIterator.isSnapshot()
andAbstractTimeTrackingRemoteIterator.isForwardOnly()
.- Parameters:
resultSet
- The result set of which to determine the type. This must not benull
.- Returns:
- type of the designated result set
- Throws:
DataSourceException
- If there are problems determining the type, the correspondingSQLException
will be wrapped in aDataSourceException
.
-
isClosed
protected boolean isClosed()
Description copied from class:AbstractRemoteIterator
Gets whether this remote iterator has been closed and its data is not available any more.- Specified by:
isClosed
in classAbstractRemoteIterator<T,T>
- Returns:
- Whether this remote iterator has been closed and its data is not available any more.
-
getNextImpl
protected List<T> getNextImpl(int count) throws DataSourceException, DataConsistencyException
Description copied from class:AbstractRemoteIterator
ImplementsAbstractRemoteIterator.getNext(int)
without the need to consider result transformation, closeable and alive time tracking.- Specified by:
getNextImpl
in classAbstractRemoteIterator<T,T>
- Throws:
DataSourceException
DataConsistencyException
-
getNextImpl
protected List<T> getNextImpl(int count, int start) throws DataSourceException, DataConsistencyException
Description copied from class:AbstractRemoteIterator
ImplementsAbstractRemoteIterator.getNext(int, int)
without the need to consider result transformation, closeable and alive time tracking.- Specified by:
getNextImpl
in classAbstractRemoteIterator<T,T>
- Throws:
DataSourceException
DataConsistencyException
-
getPreviousImpl
protected List<T> getPreviousImpl(int count) throws DataSourceException, DataConsistencyException
Description copied from class:AbstractRemoteIterator
ImplementsAbstractRemoteIterator.getPrevious(int)
without the need to consider result transformation, closeable and alive time tracking.- Specified by:
getPreviousImpl
in classAbstractRemoteIterator<T,T>
- Throws:
DataSourceException
DataConsistencyException
-
getAllImpl
protected List<T> getAllImpl() throws DataSourceException, DataConsistencyException
Description copied from class:AbstractRemoteIterator
ImplementsAbstractRemoteIterator.getAll()
without the need to consider result transformation, closeable and alive time tracking.- Specified by:
getAllImpl
in classAbstractRemoteIterator<T,T>
- Throws:
DataSourceException
DataConsistencyException
-
close
public void close() throws IOException
Description copied from interface:RemoteIterator
Explicitly closes this iterator which allows to release occupied memory and resources. Closing will be done implicitly after the alive time has elapsed.
This method may be called several times. Implementors have to take care of this.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceRemoteIterator<T>
- Specified by:
close
in interfacede.aristaflow.adept2.model.communication.ServerSideProxy
- Overrides:
close
in classAbstractRemoteIterator<T,T>
- Throws:
IOException
- If there are problems accessing the underlying data source, anIOException
will be thrown.
-
getObject
protected abstract T getObject(ResultSet resSet) throws SQLException, DataSourceException
Gets the current object of the designated result set. The result set must not be manipulated and the cursor must not be moved.- Parameters:
resSet
- The result set to retrieve the current position as Java object.- Returns:
- The Java object representing the contents of the result set at the current position.
- Throws:
SQLException
- If there are problems retrieving the current element from the result set, aSQLException
will be thrown.DataSourceException
- If there are other problems when accessing the result set or retrieving additional information, aDataSourceException
will be thrown.
-
-