Arun K S
Arun K S

Reputation: 11

What is the difference between channelpool and channelgroupl

What is the difference between channelpool and channelgroup? Could someone provide an example or usecase showcasing this difference?

Upvotes: 1

Views: 426

Answers (2)

spinlok
spinlok

Reputation: 3661

To add to Nicholas' answer, their use cases are different.

A ChannelPool is used to implement connection-pooling (usually) in a database or HTTP client.

A ChannelGroup is used to implement broadcast functionality and other bulk operations. For example, you can disconnect all channels in the group at once, or send a message to all channels in the group.

Upvotes: 1

Nicholas
Nicholas

Reputation: 16056

A ChannelPool is a pool of "borrowable" Channels to constrain the number of connections and lower the cost of acquiring a connected Channel. Analogous to a JEE DataSource.

A ChannelGroup offers lifecycle controlled state control for established Channels, normally setup so that a close event on an inserted channel will eject the channel from the group. Loosely analogous (in some cases) to a HttpSession, except more generalized for various protocols/transports.

Not sure of those analogies are familiar to you.....

Upvotes: 1

Related Questions