Jim Strasenburgh, MetroSource wrote:
> Starting from the beginning, I scanned through your demos directory and
> based upon some of the examples I wrote a simple program to create a
> message and then receive the message. However when compiling the code
> the channel.receive() method appears to have been deprecated. Going
> through the source code a bit I see that the @deprecated annotation
> indicates to use "Receiver" which is an interface and I see the
> ReceiverAdapter which implements this - rather than calling the
> channel.receive() method.
Yes, I will remove the receive() method, probably in 3.0. The reason is
(1) one you stated below: no need for instanceof, and (2) the ability to
apply back pressure (e.g. in flow control) towards a member sending
messages, from the sender all the way up the receiver's stack. The
receivers used to have an unbounded queue, into which messages were
placed, pretty bad as messages could accumulate faster than the receiver
could process them, possibly leading to OOMEs.
There's some smaller reasons why I chose to deprecate receive(), too.
> So as an initial user I'm looking for the right way to structure my
> code. Some of your examples use channel.receive() but now it seems that
> users should write a wrapper class and implement methods as the
> preferred way to process JGroup messages. Is that because you return
> different objects and we can remove the instanceof if statements when
> receiving messages?
> Well, the code works, but believe that I should be writing a class that
> implements Receiver rather than using channel.receive().
> Is there a way to write pull-style channels anymore?
Not directly. You can still implement a bridge that converts between
push and pull style of receiving messages, but I don't see the need for
that. If you do, at least make the queue bounded.
> I see documentation (section
> 3.7.8) on how to receive a message, however, am uncertain whether JGroup
> will continue to support pull-style channels now that it's marked
> deprecated - should we update the documentation to reflect that pull-
> style programming is deprecated?
Yes, we should. I'm a lazy bum :-) This is all in docbook, if you send
me the patch, I'll apply it...
> Finally, there's been alot of improvements and features that I can see
> to JGroups and am willing to contribute time to improving documentation,
> especially since it looks like I'll be asking alot of newbie questions
> anyways - and I do have a real need to understand all this thoroughly.
> Can anyone suggest how I can assist in the project as a newbie? I'd
> like to see this project flourish.
Well, send patches. If you send me some good ones, I'll give you CVS
Lead JGroups / JBoss Clustering team
JBoss - a division of Red Hat