A channel represents a group communication endpoint (like BSD datagram sockets). A client joins a group by connecting the channel to a group address and leaves it by disconnecting. Messages sent over the channel are received by all group members that are connected to the same group (that is, all members that have the same group address).
The FSM for a channel is roughly as follows: a channel is created (unconnected). The channel is connected to a group (connected). Messages can now be sent and received. The channel is disconnected from the group (unconnected). The channel could now be connected to a different group again. The channel is closed (closed).
Only a single sender is allowed to be connected to a channel at a time, but there can be more than one channel in an application.
Messages can be sent to the group members using the send method and messages can be received using receive (pull approach).
A channel instance is created using either a ChannelFactory or the public constructor. Each implementation of a channel must provide a subclass of Channel
and an implementation of ChannelFactory
.
Various degrees of sophistication in message exchange can be achieved using building blocks on top of channels; e.g., light-weight groups, synchronous message invocation, or remote method calls. Channels are on the same abstraction level as sockets, and should really be simple to use. Higher-level abstractions are all built on top of channels.
@author Bela Ban
@see java.net.DatagramPacket
@see java.net.MulticastSocket