Re: draft Carrier API

Doug Lea via Concurrency-interest <[email protected]> Mon, 9 Mar 2020 08:45:51 -0400
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <[email protected]>
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
  // ...
}


_______________________________________________
Concurrency-interest mailing list
[email protected]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest