[concurrency-interest] draft Carrier API

Doug Lea dl at cs.oswego.edu
Mon Mar 9 08:45:51 EDT 2020


On 3/8/20 12:36 PM, Alex Otenko wrote:
> I am familiar with half closed states, but in the socket world. The use
> of the same term is lost on me.

Sorry for the mysterious-sounding answer. "Half-closed" is a design
pattern that might never have been written up well but is encountered
all the time in concurrent settings under different names. Which makes
the naming challenging here. On a little more thought, probably the best
choice of terms here are based on those used in ExecutorService, which
most people are more familiar with, and where shutdownNow() is a full
close; and shutdown() disables submissions and triggers full close when
tasks are completed. So:

interface CarrierSender<T> extends Carriable<T> {
  void shutdownSending(); // disable further sending; close when empty
  // ...
}
interface Carriable<T> extends AutoCloseable {
  boolean isClosed();
  boolean isShutdownSending(); // true after shutdownSending or close
  // ...
}




More information about the Concurrency-interest mailing list