java - Extending DefaultChannelGroup -
i create class works defaultchannelgroup, 1 difference message being written belongs connection , channel associated not have message written it.
think of chat application should write other channels other 1 belonging user wrote message.
looking @ implementation of defaultchannelgroup seems add new method named write expects given channel , message, , iterate non-server channels , skip channel equals given channel.
you extend defaultchannelgroup outlined, channel group iterator , set of channels already. if have channel, can perform ther write directly (i.e. don't need channelgroup), or, if reason, wanted channel group, call channelgroup.find(channel.getid()).
i guess if doing pruposes of narrowing down single channel, it's issue of cosmetics. not pannning it.... personal preference ! if makes better you, go it.
the more interesting scenario, useful extension defautchannelgroup, assign individual channels group of attributes encoded bit-mask. might able tell bitmaskchannelgroup write message channels provided bit-mask argument, might encoding all chat-room users on age of 21 living in new jersey, or all routing devices manufacturer cisco.
Comments
Post a Comment