Search in sources :

Example 11 with ICloseableIterator

use of de.invesdwin.util.collections.iterable.ICloseableIterator in project invesdwin-context-persistence by subes.

the class FileBufferCache method resultCache_load.

private static ArrayFileBufferCacheResult resultCache_load(final ResultCacheKey key) throws Exception {
    final ICloseableIterable values = key.getSource().getSource();
    key.setSource(null);
    final ArrayList list = LIST_POOL.borrowObject();
    try (ICloseableIterator it = values.iterator()) {
        while (true) {
            list.add(it.next());
        }
    } catch (final NoSuchElementException e) {
    // end reached
    }
    return new ArrayFileBufferCacheResult(list);
}
Also used : ICloseableIterable(de.invesdwin.util.collections.iterable.ICloseableIterable) ArrayList(java.util.ArrayList) ICloseableIterator(de.invesdwin.util.collections.iterable.ICloseableIterator) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

ICloseableIterator (de.invesdwin.util.collections.iterable.ICloseableIterator)11 ICloseableIterable (de.invesdwin.util.collections.iterable.ICloseableIterable)7 FastNoSuchElementException (de.invesdwin.util.error.FastNoSuchElementException)6 FDate (de.invesdwin.util.time.date.FDate)5 FDate (de.invesdwin.util.time.fdate.FDate)5 ACloseableIterator (de.invesdwin.util.collections.iterable.ACloseableIterator)4 ASkippingIterator (de.invesdwin.util.collections.iterable.ASkippingIterator)4 File (java.io.File)4 MemoryFileSummary (de.invesdwin.context.persistence.timeseriesdb.storage.MemoryFileSummary)2 ATransformingCloseableIterator (de.invesdwin.util.collections.iterable.ATransformingCloseableIterator)2 FlatteningIterable (de.invesdwin.util.collections.iterable.FlatteningIterable)2 FlatteningIterator (de.invesdwin.util.collections.iterable.FlatteningIterator)2 ASkippingIterable (de.invesdwin.util.collections.iterable.skip.ASkippingIterable)2 ASkippingIterator (de.invesdwin.util.collections.iterable.skip.ASkippingIterator)2 TextDescription (de.invesdwin.util.lang.description.TextDescription)2 TimeRange (de.invesdwin.util.time.range.TimeRange)2 RangeTableRow (ezdb.table.RangeTableRow)2 ArrayList (java.util.ArrayList)2 NoSuchElementException (java.util.NoSuchElementException)2 AParallelChunkConsumerIterator (de.invesdwin.util.collections.iterable.concurrent.AParallelChunkConsumerIterator)1