[infinispan-dev] [jgroups-dev] Incompatible change in 3.1.0

Galder Zamarreño galder at redhat.com
Tue Nov 29 07:58:45 EST 2011


On Nov 29, 2011, at 10:50 AM, Bela Ban wrote:

> 
> 
> On 11/29/11 10:20 AM, Galder Zamarreño wrote:
>> Hmmm, why do you need to break API here?
>> 
>> Couldn't you maintain the current API and add?:
>> void Message.setMsgFlag(short flag)
>> void Message.clearMsgFlag(short flag)
>> boolean Message.isMsgFlagSet(short flag)
> 
> 
> The problem here is that if you call Message.setFlag(byte flag) with 
> Message.OOB, you'll have to change your code anyway, namely narrow the 
> short to a byte.

Right, that's assuming that you change to a short for Message.OOB.

You could leave it as it is and have Message2.OOB which is a short.

Then Message.setFlag(Message.OOB) would convert into Message.setMsgFlag(Message2.OOB)

Mapping a byte to a short would be v simple todo.

> 
> 
>> Any new flags you add could be added to Message or a different interface and define them as short?
>> 
>> I think you can avoid breaking old clients here. Also, I don't think it's good to break such API in 3.1, should have been done in 3.0 :)
> 
> 
> No shit ? That's why I sent this email !$%#$ :-)

LOL

> 
> 
> 
>> On Nov 28, 2011, at 5:38 PM, Bela Ban wrote:
>> 
>>> FYI
>>> 
>>> -------- Original Message --------
>>> Subject: [jgroups-dev] Incompatible change in 3.1.0
>>> Date: Mon, 28 Nov 2011 17:36:49 +0100
>>> From: Bela Ban<belaban at yahoo.com>
>>> To: jg-users<javagroups-users at lists.sourceforge.net>,	jg-dev
>>> <javagroups-development at lists.sourceforge.net>
>>> 
>>> I'm working on an issue that requires a change in Message and
>>> RequestOptions: I want to change the 'flags' field from a byte to a
>>> short. I'd changethe follwoing methods and fields:
>>> 
>>> - Message.OOB, DONT_BUNDLE, NO_FC, SCOPED, NO_RELIABILITY,
>>> NO_TOTAL_ORDER, NO_RELAY would become a short from a byte
>>> 
>>> - void Message.setFlag(byte flag) -->  void Message.setFlag(short flag);
>>> - void Message.clearFlag(byte flag) -->  void Message.clearFlag(short flag)
>>> - boolean Message.isFlagSet(byte flag) -->  boolean
>>> Message.isFlagSet(short flag)
>>> 
>>> A typical use case such as:
>>> 
>>> Message msg=new Message(...);
>>> msg.setFlag(Message.OOB);
>>> 
>>> would *not* require any change at all.
>>> 
>>> However, if you have:
>>> 
>>> byte flags=Message.OOB;
>>> msg.setFlag(flags);
>>> 
>>> This wouldn't work as 'flags' would have to be a short (or downcast to a
>>> byte).
>>> 
>>> Also, in RequestOptions, the 'flags' field would have to be changed to a
>>> short (from a byte). RequestOptions.setFlags()/getFlags()/clearFlags()
>>> would be affected. Again, typical code like this:
>>> RequestOptions opts=new RequestOptions(ResponseMode.GET_ALL, 5000,
>>> false).setFlags(Message.OOB)
>>> 
>>> would not have to be changed at all.
>>> 
>>> 
>>> What do people think ? I know this is an API change, although a minor
>>> one, and I wanted to see if anyone's code would break.
>>> 
>>> I checked Infinispan (master) and this doesn't cause any code breakage.
>>> 
>>> 
>>> [1] https://issues.jboss.org/browse/JGRP-1250
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> infinispan-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>> 
>> --
>> Galder Zamarreño
>> Sr. Software Engineer
>> Infinispan, JBoss Cache
>> 
>> 
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
> 
> -- 
> Bela Ban
> Lead JGroups (http://www.jgroups.org)
> JBoss / Red Hat
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache




More information about the infinispan-dev mailing list