Thread: [jgroups-users] Porting-Guide/Release-Notes between 3.6.14 and 4.0.15
Brought to you by:
belaban
|
From: Questions/problems r. to u. J. <jav...@li...> - 2020-01-27 14:50:11
|
Hi: Can someone point me to a porting guide - trying to port code between 3.6.14 and 4.0.15. (e.g. things that will break and must be chagned between 3 and 4?) We use the jgroups library in a "deployed" application on the JBoss EAP7 platform, currently trying to upgrade between EAP7.1.x and 7.2.X, the JBoss upgrade changes jgroups between 3.6.14 and 4.0.15. Some of the inital issues was are facing include, any hints/suggestions would be greatly appreciated. a) Issue related to: https://issues.redhat.com/browse/JGRP-1860 Bela already provided an inital answer. See [1] below for more details. b) org.jgroups.util.UUID is NOT backwards compatibile See [2] for more details. c) Channel deprecated. Can we just change all uses of "Channel" to "JChannel" and all will be OK? d) org.jgroups.timeoutexception was removed. Can I simply import java.util.concurrent.timeoutexception in place of org.jgroups.timeoutexception? e) ... tbd Cheers [1] In jgroups-3.6.14.Final-redhat-1.jar (EAP7.1.4) org.jgroups.blocks.RpcDispatcher had a static interface defined. public static interface Marshaller { public Buffer objectToBuffer(Object var1) throws Exception; public Object objectFromBuffer(byte[] var1, int var2, int var3) throws Exception; } In 4.0.15 there is now a Interface Marshaller with completely different methods/parameters. Any suggestions? [2] With jgroups jgroups-3.6.14.Final-redhat-1.jar (EAP7.1.4) we extended org.jgroups.util.UUID to create our ToddsPayloadUUID and add String(s) ipAddress, port and hostname (which are used by our application). Unfortunately in 4.0.15 org.jgroups.util.UUID is missing some methods we used, including: size(), readExternal(), writeExternal(), writeTo(), readFrom() When we create a JChannel, we add the class to the ClassConfigurator with: org.jgroups.conf.ClassConfigurator.add(1025, ToddsPayloadUUID.class); We then call the create/add and AddressGenerator to the channel - code snippet: private static Channel createSamChannel (String aInProps) { ... try { myC = new JChannel(aInProps); createSamChannelLogger.logActivity("Create JChannel with config=" + aInProps); System.out.println("Create JChannel with config=" + aInProps); myC.addAddressGenerator(new AddressGenerator() { // Set Address Generator to SamPayloadUUID and set IpAddress and port to be what is //configured in the jgroup configuration public Address generateAddress() { Map lTcpMap=com.timetra.nms.server.multiserver.core.common.Util.getJGroupElement("TCP"); String ipAddress =(String) lTcpMap.get("bind_addr"); String port = (String) lTcpMap.get("bind_port"); String hostname; try { hostname = InetAddress.getByName(ipAddress).getHostName(); } catch (UnknownHostException e) { hostname = ipAddress; } return (Address)SamPayloadUUID.randomUUID(ipAddress, port, hostname); } }); } |
|
From: Questions/problems r. to u. J. <jav...@li...> - 2020-01-29 10:26:07
|
On 27.01.20 15:49, Questions/problems related to using JGroups wrote: > Hi: > Can someone point me to a porting guide - trying to port code between > 3.6.14 and 4.0.15. (e.g. things that will break and must be chagned between 3 and 4?) There is not porting guide. I suggest recompile your app against 4.x and fix the compilation errors - it's as simple as that. > We use the jgroups library in a "deployed" application on the JBoss > EAP7 platform, currently trying to > upgrade between EAP7.1.x and 7.2.X, the JBoss upgrade changes jgroups > between 3.6.14 and 4.0.15. > > Some of the inital issues was are facing include, any > hints/suggestions would be greatly appreciated. > > a) Issue related to: > https://issues.redhat.com/browse/JGRP-1860 > > Bela already provided an inital answer. See [1] below for more details. > > b) org.jgroups.util.UUID is NOT backwards compatibile > See [2] for more details. > > c) Channel deprecated. Can we just change all uses of "Channel" to > "JChannel" and all will be OK? Yes. Note that I'll probably re-activate Channel in 5.0: https://issues.redhat.com/browse/JGRP-2405 > d) org.jgroups.timeoutexception was removed. Can I simply import > java.util.concurrent.timeoutexception in > place of org.jgroups.timeoutexception? Yes. > [1] In jgroups-3.6.14.Final-redhat-1.jar (EAP7.1.4) > org.jgroups.blocks.RpcDispatcher had a static interface defined. > > public static interface Marshaller { > public Buffer objectToBuffer(Object var1) throws Exception; > > public Object objectFromBuffer(byte[] var1, int var2, int var3) > throws Exception; > } > > In 4.0.15 there is now a Interface Marshaller with completely different > methods/parameters. > Any suggestions? objectToBuffer(obj) used to return a byte array (Buffer), now it needs to write obj to an output stream. The reason this was done is that we can eliminate one memory allocation. You could use Util.objectToStream() to implement this but since you know your application, perhaps the (de-)serialization can be optimized. objectFromStream can also used Util.objectFromStream(). > [2] With jgroups jgroups-3.6.14.Final-redhat-1.jar (EAP7.1.4) we > extended org.jgroups.util.UUID to > create our ToddsPayloadUUID and add > String(s) ipAddress, port and hostname (which are used by our application). > > Unfortunately in 4.0.15 org.jgroups.util.UUID is missing some methods we > used, including: > size(), readExternal(), writeExternal(), writeTo(), readFrom() Not true! UUID extends Address implements SizeStreamable extends Streamable. * size() is now serializedSize() * writeTo() and readFrom() are also defined in UUID * readExternal() and writeExternal() have been removed as UUID does not implement Serializable. But why do you need them? Use readFrom() and writeTo(); these are more efficient anyway! -- Bela Ban | http://www.jgroups.org |
|
From: Questions/problems r. to u. J. <jav...@li...> - 2020-01-29 17:08:24
|
> > > On 27.01.20 15:49, Questions/problems related to using JGroups wrote: > > Hi: > > Can someone point me to a porting guide - trying to port code between > > 3.6.14 and 4.0.15. (e.g. things that will break and must be chagned > between 3 and 4?) > > There is not porting guide. I suggest recompile your app against 4.x and > fix the compilation errors - it's as simple as that. > We ran into some issues, but I don't remember the details now *except* our main class, defined with: extends ReceiverAdapter implements RequestHandler ...used to be able to implement receive() (for simpler messages) and handle() (for things that needed to return info). With 4.x none of the receive calls worked any more. It had something to do with us using a MessageDispatcher, but I don't recall the details. We had to pull out receive/cast message and move all those things. The questions I had are in the users archive back around Nov 2017 and have "v3->v4" in the subject if it helps. There was also a change that our objects needed to move to streamable instead of serializable, which wasn't hard, but I don't remember it being obvious. I can go back and try to find all my commits to see if there's anything useful there, but anything I couldn't figure out easily is in the users list already with that string in the subject. Cheers, Bobby |