Another way to create a
Channel is via
This looks like a constructor, but
Channel is an interface, not a class.
Channel() is simply a top-level factory function, sharing a name with the interface.
It takes a parameter indicating how
send() should work:
send()should block until the consumer of the channel is able to receive the object
send()always returns immediately, and the channel will buffer objects up until the limit of available memory
send()always returns immediately, but only the last object sent is buffered — all previous objects are lost
Any other positive
Intvalue (but less than
Channel.UNLIMITED) means that the channel will buffer that number of elements, and
send()might block until a consumer can receive objects if that buffer is full (
Channel.BUFFEREDuses a default capacity of 64 elements)