[concurrency-interest] draft Carrier API

Doug Lea dl at cs.oswego.edu
Sun Mar 8 07:54:24 EDT 2020


On 3/7/20 6:25 PM, Alex Otenko wrote:
> Send is declared to throw when is closed for sending. Is there a good
> reason to not throw when is closed for receiving? Or what is the
> intended behavior in this case, given that it may block if full?
> 

Normally, a completed receiver should invoke (bidirectional) close.
Calling closeForReceiving provides more flexibility, but with more cases
for users to consider (like stuck senders).

But this question invites considering whether even having
closeForReceiving would lead to more errors than correct usages.
Considering that some of the motivation for Carrier is to reduce
opportunities for errors people encounter with hand-made components
built from BlockingQueues etc, I think we could remove it.

-Doug




More information about the Concurrency-interest mailing list