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
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 ClassesModifier and TypeClassDescriptionprotected static final classThe clean-up task for closing the wrapped result set and dropping created recursion tables.Nested classes/interfaces inherited from interface de.aristaflow.adept2.model.communication.ServerSideProxy
de.aristaflow.adept2.model.communication.ServerSideProxy.LegacySspCloser, de.aristaflow.adept2.model.communication.ServerSideProxy.ServerSideProxyRemover -
Field Summary
Fields inherited from class de.aristaflow.adept2.model.common.collection.AbstractTimeTrackingRemoteIterator
busyThreads, snapshotFields inherited from class de.aristaflow.adept2.model.common.collection.AbstractRemoteIterator
cleanup, closeables, logger, transformatorFields inherited from interface de.aristaflow.adept2.model.communication.ServerSideProxy
DEFAULT_ALIVE_TIMEFields inherited from interface de.aristaflow.adept2.model.communication.TimeTrackingSsProxy
DEFAULT_CLOSE_DEFER_TIME, MAX_ALIVE_TIME_EXTENSION -
Constructor Summary
ConstructorsConstructorDescriptionResultSetRemoteIterator(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
Modifier and TypeMethodDescriptionvoidclose()Explicitly closes this iterator which allows to release occupied memory and resources.ImplementsAbstractRemoteIterator.getAll()without the need to consider result transformation, closeable and alive time tracking.getNextImpl(int count) ImplementsAbstractRemoteIterator.getNext(int)without the need to consider result transformation, closeable and alive time tracking.getNextImpl(int count, int start) ImplementsAbstractRemoteIterator.getNext(int, int)without the need to consider result transformation, closeable and alive time tracking.protected abstract TGets the current object of the designated result set.getPreviousImpl(int count) ImplementsAbstractRemoteIterator.getPrevious(int)without the need to consider result transformation, closeable and alive time tracking.protected static intGets the type of the designated result set.protected booleanisClosed()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, setCloseTimeMethods inherited from class de.aristaflow.adept2.model.common.collection.AbstractRemoteIterator
aboutToReturn, closeOnTraversal, getAll, getNext, getNext, getPrevious, setCloseOnTraversalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.aristaflow.adept2.model.common.collection.RemoteIterator
dropMethods inherited from interface de.aristaflow.adept2.model.communication.TimeTrackingSsProxy
enter, exit
-
Constructor Details
-
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, aDataSourceExceptionwill 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.nullif there are no such tables.- Throws:
DataSourceException- If positioning the result set or retrieving the scroll behaviour of the result set fails, aDataSourceExceptionwill 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.nullif there are no such tables.- Throws:
DataSourceException- If positioning the result set or retrieving the scroll behaviour of the result set fails, aDataSourceExceptionwill 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.nullif there are no such tables.
-
-
Method Details
-
getRsType
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 correspondingSQLExceptionwill be wrapped in aDataSourceException.
-
isClosed
protected boolean isClosed()Description copied from class:AbstractRemoteIteratorGets whether this remote iterator has been closed and its data is not available any more.- Specified by:
isClosedin classAbstractRemoteIterator<T,T> - Returns:
- Whether this remote iterator has been closed and its data is not available any more.
-
getNextImpl
Description copied from class:AbstractRemoteIteratorImplementsAbstractRemoteIterator.getNext(int)without the need to consider result transformation, closeable and alive time tracking.- Specified by:
getNextImplin classAbstractRemoteIterator<T,T> - Throws:
DataSourceExceptionDataConsistencyException
-
getNextImpl
protected List<T> getNextImpl(int count, int start) throws DataSourceException, DataConsistencyException Description copied from class:AbstractRemoteIteratorImplementsAbstractRemoteIterator.getNext(int, int)without the need to consider result transformation, closeable and alive time tracking.- Specified by:
getNextImplin classAbstractRemoteIterator<T,T> - Throws:
DataSourceExceptionDataConsistencyException
-
getPreviousImpl
Description copied from class:AbstractRemoteIteratorImplementsAbstractRemoteIterator.getPrevious(int)without the need to consider result transformation, closeable and alive time tracking.- Specified by:
getPreviousImplin classAbstractRemoteIterator<T,T> - Throws:
DataSourceExceptionDataConsistencyException
-
getAllImpl
Description copied from class:AbstractRemoteIteratorImplementsAbstractRemoteIterator.getAll()without the need to consider result transformation, closeable and alive time tracking.- Specified by:
getAllImplin classAbstractRemoteIterator<T,T> - Throws:
DataSourceExceptionDataConsistencyException
-
close
Description copied from interface:RemoteIteratorExplicitly 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceRemoteIterator<T>- Specified by:
closein interfacede.aristaflow.adept2.model.communication.ServerSideProxy- Overrides:
closein classAbstractRemoteIterator<T,T> - Throws:
IOException- If there are problems accessing the underlying data source, anIOExceptionwill be thrown.
-
getObject
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, aSQLExceptionwill be thrown.DataSourceException- If there are other problems when accessing the result set or retrieving additional information, aDataSourceExceptionwill be thrown.
-
ResultSetRemoteIterator(ManagedResultSet, long, long, Logger, String...)instead.