J2ME/CDC1.0/PP1.0 version of JGroups


Update 2006-08-12

JGroups 2.3 cdc is ready. You can get it from CVS. Or get the tar.gz: JGroups-2.3-cdc.tar.gz, or the jars: jgroups-core-2.3-cdc.jar, jgroups-all-2.3-cdc.jar. See below for instructions on how to build.

Updated test reports are here. The naming scheme for the tests is: "testreport-" + "cdc-" if the test is run with the cdc jar, or nothing if it is run with the non-cdc jar, + "JGroups-2." + jgroups version + "-cdc" if the test is run with the cdc version, nothing if run with the standard version, + "cvm" or "jvm" depending on the jvm the test was run with (also, nothing is the same as "jvm"), + "linux" or "windows" depending on the test platform (i currently don't have access anymore to a windows computer, so there are onl linux tests). Note that I tried to run the test for the cdc version both in a j2se jvm and in cvm. There is some issues with running tests in CVM, it needs to be investigated (though i currently have not enough time to devote to it). Some tests fail causing a C assertion in the CVM, but i have the feeling that the CVM is not the most debugged software on earth, so this may not be related to jgroups. Also, there are memory issues, but i wasn't able to make CVM's heap memory bigger than 6 megabytes. Also, some tests block infinitely, and i need to kill the process manually.


Update 2006-08-08

I merged the bugfixes made to version 2.2.9.1 in the main 2.2.9.1 branch with the cdc 2.2.9.1 branch. The version with these changes is labeled "2.2.9.3" or "2.2.9.1 sp 3" in the main 2.2.9.1 branch, so i called the cdc version 2.2.9.3-cdc, though the cvs branch will still be named BRANCH_JGROUPS_2_2_9_1_CDC. Download the full package here, and the jar here: jgroups-core-2.2.9-cdc.jar and jgroups-core-2.2.9-cdc.jar. Also, you can browse the updated test reports for this version

Here is a sample command line to compile a cdc version of JGroups (with cdc environment in /somewhere/pp-1_0_1):

      ./build.sh -DCDCPPBOOTCLASSPATH=/somewhere/pp-1_0_1/btclasses.zip:/somewhere/pp-1_0_1/lib/personal.jar jar-cdc
    

To generate a html test report (such a report will be generated with the cdc lib, but the tests will be run with a j2se vm. It would be interesting to run these tests in a cdc vm. Yet to be done...):

      ./build.sh -DCDCPPBOOTCLASSPATH=/somewhere/pp-1_0_1/btclasses.zip:/somewhere/pp-1_0_1/lib/personal.jar testreport-cdc
    

Update 2006-05-23

These patches are now integrated in JGroups CVS. There are branches for CDC versions. The CDC version based on JGroups-2.2.8-jdk1.3 lives in branch BRANCH_JGROUPS_2_2_8_JDK_1_3_CDC, and the one based on JGroups-2.2.9.1 lives in branch BRANCH_JGROUPS_2_2_9_1_CDC. I wait until JGroups 2.3 final is out before including the CVS HEAD patches, and after that i'll try to keep on with HEAD. To compile get one of these branches and follow instructions below. Basically, the only thing you need is CDC jvm classes, to which you point with -DCDCPPBOOTCLASSPATH.


2006-04-10

This page is about modifications to JGroups to make it work in a J2ME environment, with CDC 1.0 (Connected Device configuration) / PP 1.0 (Personal Profile). (Actually, i think it could also work with a more limited profile (Foundation Profile or Personal Basis Profile) but i did not tested it).

This version is different from the JGroupsME version from Mandar Shinde and Dino, because JGroupsME targets the CLDC J2ME configuration (Connected Limited Device Configuration), which is much more lightweight than CDC. Basically, CLDC is for mobile phones, while CDC is for more powerfull devices like PDAs. Note that CDC enabled phones are beginning to appear (like Sony Ericsson P990 and M600). CLDC is a very stripped-down version of Java, incompatible with J2SE, while CDC is in great part compatible with J2SE. CDC/PP 1.0 is based on jdk 1.3, and the newer CDC/PP 1.1 is based on jdk 1.4. See the CDC faq.

I currently only prepared a CDC/PP 1.0 version because as far as i know, there are not a lot of jvm compatibles with CDC/PP 1.0 (as of April 2006, only the latests version of j9, which only work on Windows Mobile 5.0 devices, i think). I only have access to devices with a CDC/PP 1.0 jvm.

I initially planned to integrate these modifications into the mainstream JGroups cvs, because i thought that it was possible to make JGroups CDC/PP 1.0 compatible without modifying it too much. This is true as long as JGroups uses only some jdk 1.3 api, but starting with version 2.2.9.1, JGroups starts to use heavily the jdk 1.4 api, so i had to backport some portions of the code to the 1.3 api. Thus, i think that this work will remain in the form of patches. But i tried to keep these patch as light as possible, so that the JGroups api does not change. The only differences are that a few protocols, classes, options are not available. A standard JGroups and a CDC/PP version should be able to communicate as long as the standard version does not use unsuported protocols (ENCRYPT for example, though in the future, ENCRYPT could also be supported on CDC if the Java Cryptographic Extensions optional package is available (see Foundation Profile 1.1, JSR 219)).

To get JGroups to work in a CDC/PP jvm, i first had to make CDC/PP version of the libraries used by JGroups. Then, there are actually two set of patches for the CDC/PP version of jgroups:

Here are the main modifications that have been done to JGroups to make it work in CDC/PP:

Also, as i sometimes use JGroups in applets, i included some bug fixes not directly related to CDC

JGroups dependencies

The libraries used by JGroups need to be ported to CDC/PP as well. The libraries needed are:

patches against all these code trees:

tar.gz of the original version of these libraries:

tar.gz of the patched version of these libraries

final Jars of the cdc version of these libraries:

JGroups-2.2.8-jdk1.3-cdc

This version is based on the tag JGROUPS_2_2_8_JDK_1_3 in JGroup's CVS. This was the first and easiest version to do, as this version is already working in jdk 1.3, i only had to add CDC/PP specific ant targets and make very slight modifications to source code.

Get this version of JGroups with cvs:
cvs -z3 -d:pserver:anonymous@cvs-pserver.sourceforge.net:80/cvsroot/javagroups co -r JGROUPS_2_2_8_JDK_1_3 -d JGroups-2.2.8-jdk1.3 -P JGroups

patch: JGroups-2.2.8-jdk1.3-cdc.diff

tar.gz of the original version: JGroups-2.2.8-jdk1.3.tar.gz

tar.gz of the patched version: JGroups-2.2.8-jdk1.3-cdc.tar.gz

final jar of the cdc version: jgroups-2.2.8-jdk1.3-cdc.jar

junit test results here

JGroups-2.2.9.1-cdc
(THIS VERSION IS OBSOLETE, GET THE 2.2.9.3 INSTEAD)

Get this version of JGroups with cvs:
cvs -z3 -d:pserver:anonymous@cvs-pserver.sourceforge.net:80/cvsroot/javagroups co -r JGROUPS_2_2_9_1 -d JGroups-2.2.9.1 -P JGroups

patch: JGroups-2.2.9.1-cdc.diff

tar.gz of the original version: JGroups-2.2.9.1.tar.gz

tar.gz of the patched version: JGroups-2.2.9.1-cdc.tar.gz

final jar of the cdc version: jgroups-core-2.2.9.1-cdc.jar and jgroups-all-2.2.9.1-cdc.jar

junit test results here

Additional informations

To run the test on firewalled linux, multicast need to be allowed with a rule like: iptables -t filter -i eth0 -d 224.0.0.0/4 -j ACCEPT

Also, on linux, don't forget to add a -Djava.net.preferIPv4Stack=true argument to the jvm command line.

The test results are not 100% success, but i don't think it is related to the CDC/PP modifications, since it is the same with the unpatched versions. I noticed that some of the test sometimes fail. Also a few test sometimes consume too much memory.

To be able to compile all the code with a CDC/PP environment, you need to have one! You can use commercial ones (like IBM J9), or you can also use the reference implementation from Sun. This reference implementation has a CVM binary that works only under linux, but the system classes can be used to compile code on any platform. There are two versions of Sun's reference implementation: CDC/PP 1.1, which is only available in binary form, or CDC/PP 1.0, which is only available in source form. The later is quite painfull to compile (i had to install a red hat 7.2 specially to compile it) but it is the only version that allows to debug java code. This is the version that i use, and it allows me to emulate cdc devices on a linux box, and to compile my code on windows as well. I also runned and tested this libraries on an ipaq 5550 pda (windows 2003) with J9.

Links


Matthieu Imbert