Cancelable streams
Brian Goetz
brian.goetz at oracle.com
Sun Nov 4 05:01:13 PST 2012
> I'm familiar with infinite streams (I was a tech. reviewer for the original Wizard Book) but I'm not familiar with your approach to cancellation. Is there any precedent for it?
This is a use case that shows up in real-time analytics. There's a stream of data, and you want to chew on it for as long as you have cycles, but want to shut down gracefully when asked to.
> To handle cancellation, I would signal the generator to stop returning elements, or to generate a (null) marker to signal end of stream.
>
> In other words, cancellation should be handled at the generator, not by Streams in general.
And this discussion is basically over the use of the word "should" in the above sentence. There are lots of places it *could* be handled, including just telling the user to cut the the power to the box when they're done.
More information about the lambda-libs-spec-observers
mailing list