Tuesday, July 26, 2011

It's time for a change: JGroups 3.0

I'm happy to anounce that I just released a first beta of JGroups 3.0 !

It's been a long time since I released version 2.0 (Feb 2002); over 11 years and 77 2.x releases !

We've pushed a lot of API changes into 3.x, in order to provide more features, bug fixes and optimizations in 2.x releases, which were always (API) backwards compatible to previous 2.x releases.

However, now it was time to take that step and make all the changes we've accumulated over the years.

The bad thing is that 3.x will require code changes if you port your 2.x app to it... however I anticipate that those changes will be trivial. Please ask questions regarding porting on the JGroups mailing list (or forums), and also post suggestions for improvements !

The good thing is that I was able to remove a lot of code (ca. 25'000 lines compared to 2.12.1) and simplify JGroups significantly.

Just one example: the getState(OutputStream) callback in 2.x didn't have an exception in its signature, so an implementation would typically look like this:

public void getState(OutputStream output) {
    try {
        marshalStateToStream(output);
    }
    catch(Exception ex) {
         log.error(ex);
    }
}

In 3.x, getState() is allowed to throw an exception, so the code looks like this now:

public void getState(OutputStream output) throws Exception {
    marshalStateToStream(output);
}

First of all, we don't need to catch (and swallow !) the exception. Secondly, a possible exception will now actually be passed to the state requester, so that we know *why* a state transfer failed when we call JChannel.getState().

There are many small (or bigger) changes like this, which I hope will make using JGroups simpler. A list of all API changes can be found at [2].

The stability of 3 beta1 is about the same as 2.12.1 (very high), because there were mainly API changes, and only a few bug fixes or optimizations.

I've also created a new 3.x specific set of documentation (manual, tutorial, javadocs), for example see the 3.x manual at [3].

JGroups 3 beta1 can be downloaded from [1]. Please try it out and send me your feedback (mailing lists preferred) !

Enjoy !



[1] https://sourceforge.net/projects/javagroups/files/JGroups/3.0.0.Beta1

[2] https://github.com/belaban/JGroups/blob/JGroups_3_0_16_Final/doc/API_Changes.txt

[3] http://www.jgroups.org/manual-3.x/html/index.html

8 comments:

  1. Hey Bela,

    I use partial state tranfer!! Will there be any away to preserve that behavior? If you want to know my successful JGroups driven database replication mechanism I can explain how it works ;) (I must admit I use the partial state transfer in an unintended way)

    Besides that great work btw :)

    ReplyDelete
  2. Hi Nicolas,

    partial state transfer is gone for good; it was never correct, see [1] for details.

    If you describe your use case, maybe we can find a replacement for it... If you do so, please use the mailing list...
    Cheers,

    [1] https://issues.jboss.org/browse/JGRP-1329

    ReplyDelete
  3. Hi Bela,
    Thanks for the great work - I've been using jGroups for a long time and I was looking into migrating from 2.x to 3.x. Any chance to get a good link to the API_Changes.txt file? (the one in this post is broken - the GIT repository does not have a blob directory anymore :-)

    Thanks and best regards,
    --bjh

    ReplyDelete
  4. The correct link is https://github.com/belaban/JGroups/blob/JGroups_3_0_16_Final/doc/API_Changes.txt.
    Cheers

    ReplyDelete
  5. Thanks for the hint, I updated the original post with the correct link.

    ReplyDelete
  6. Excellent! Thanks!

    ReplyDelete
  7. Hi Bela,

    I am unable to find API_Changes.txt. Can you please assist with that?

    ReplyDelete
  8. Hi Sarneet,

    link #2 (above) should work...

    ReplyDelete