Class MemoryBasedCopyingRemoteIterator<T>
java.lang.Object
de.aristaflow.adept2.model.common.collection.AbstractRemoteIterator<T,T>
de.aristaflow.adept2.model.common.collection.AbstractTimeTrackingRemoteIterator<T>
de.aristaflow.adept2.model.common.collection.MemoryBasedCopyingRemoteIterator<T>
- Type Parameters:
T- The type of the elements that are iterated.
- All Implemented Interfaces:
RemoteIterator<List<T>>,de.aristaflow.adept2.model.communication.ServerSideProxy,de.aristaflow.adept2.model.communication.TimeTrackingSsProxy,Closeable,AutoCloseable
A remote iterator based on a list of elements that are completely in memory. This is only useful
for memory-based storages which are unable to provide a result partially.
Since all elements are copied when creating this iterator, it is a snapshot and always consistent. It has an expiring alive time thus allowing to release the occupied memory even if no explicit
Since all elements are copied when creating this iterator, it is a snapshot and always consistent. It has an expiring alive time thus allowing to release the occupied memory even if no explicit
close() occurs.
close() closes AutoCloseable elements and resets the class fields.
-
Nested Class Summary
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
FieldsModifier and TypeFieldDescriptionprotected intThe reference to the current element which is to be retrieved next.The elements of this memory based iterator.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
ConstructorsConstructorDescriptionMemoryBasedCopyingRemoteIterator(Collection<T> elements) Deprecated, for removal: This API element is subject to removal in a future version.MemoryBasedCopyingRemoteIterator(Collection<T> elements, long aliveTime, long aliveTimeExtension, Logger logger) Creates a new remote iterator keeping (a copy of) the designated collection in main memory. -
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.getPreviousImpl(int count) ImplementsAbstractRemoteIterator.getPrevious(int)without the need to consider result transformation, closeable and alive time tracking.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
-
Field Details
-
elements
The elements of this memory based iterator. -
current
protected int currentThe reference to the current element which is to be retrieved next.
-
-
Constructor Details
-
MemoryBasedCopyingRemoteIterator
@Deprecated(since="15.0.0", forRemoval=true) public MemoryBasedCopyingRemoteIterator(Collection<T> elements) Deprecated, for removal: This API element is subject to removal in a future version.Creates a new remote iterator keeping (a copy of) the designated collection in main memory. The alive will beLong.MAX_VALUEuntil explicitly closed. Then the alive time will beLong.MIN_VALUE.- Parameters:
elements- The elements of this iterator.
-
MemoryBasedCopyingRemoteIterator
public MemoryBasedCopyingRemoteIterator(Collection<T> elements, long aliveTime, long aliveTimeExtension, Logger logger) Creates a new remote iterator keeping (a copy of) the designated collection in main memory. The alive will beLong.MAX_VALUEuntil explicitly closed. Then the alive time will beLong.MIN_VALUE.- Parameters:
elements- The elements of this iterator.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.
-
-
Method Details
-
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:
DataConsistencyException
-
getNextImpl
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:
DataConsistencyException
-
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:
DataConsistencyException
-
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:
DataConsistencyException
-
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.
-
MemoryBasedCopyingRemoteIterator(Collection, long, long, Logger)instead.