private static stream_response newTscStream ( Stream < TimeSeriesCollection > tsc , int fetch ) { final BufferedIterator < TimeSeriesCollection > iter = new BufferedIterator ( tsc . iterator ( ) , TSC_QUEUE_SIZE ) ; final long idx = TSC_ITERS_ALLOC . getAndIncrement ( ) ; final IteratorAndCookie < TimeSeriesCollection > iterAndCookie = new IteratorAndCookie <> ( iter ) ; TSC_ITERS . put ( idx , iterAndCookie ) ; final List < TimeSeriesCollection > result = fetchFromIter ( iter , fetch , MAX_TSC_FETCH ) ; EncDec . NewIterResponse < TimeSeriesCollection > responseObj = new EncDec . NewIterResponse <> ( idx , result , iter . atEnd ( ) , iterAndCookie . getCookie ( ) ) ; LOG . log ( Level . FINE , "responseObj = {0}" , responseObj ) ; return EncDec . encodeStreamResponse ( responseObj ) ; }
Create a new TimeSeriesCollection iterator from the given stream .