Interface RowStreamAccumulator<R>
-
- Type Parameters:
R
- type of the result of accumulating all rows
public interface RowStreamAccumulator<R>
RowStreamAccumulator
defines an interface which should be implemented to processStream
ofRow
s retrieved from Cassandra.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
accumulateRowStream(java.util.stream.Stream<com.datastax.driver.core.Row> rowStream)
Processes each row and updates the internal state of the instance.R
result()
Should be called after all intended streams are processed.
-
-
-
Method Detail
-
accumulateRowStream
void accumulateRowStream(java.util.stream.Stream<com.datastax.driver.core.Row> rowStream)
Processes each row and updates the internal state of the instance. After each invocation of this method callingresult
should return the accumulated result of rows processed up to that moment. Implementations should not block during processing of the passed stream as that would prevent the thread from doing other work. If invoked concurrently with eitheraccumulateRowStream
orresult
the behaviour is not defined.- Parameters:
rowStream
- of available rows without blocking
-
result
R result()
Should be called after all intended streams are processed. Will return the current state of the accumulator without knowing if it is the end result. If invoked concurrently with eitheraccumulateRowStream
orresult
the behaviour is not defined.- Returns:
- accumulated result
-
-