[infinispan-dev] Ideas for locking improvements

Manik Surtani manik at jboss.org
Thu Jun 9 15:10:35 EDT 2011


On 23 May 2011, at 11:49, Mircea Markus wrote:

>> 
>>>> 3.  Need to think more about this, around implications of correctness of lock acquisition is reordered.  But in terms of algorithm, sorting on identity hashcode won't work since this will be different on different requestor JVMs.  
>>> The algorithm does NOT sort on identity hash code, but on CH. For conflict resolution (i.e. two keys that have same consistent hash) it can use object's hash code (default) or allow user to specify a hash code function if needed. 
>> 
>> Hmm.  How does this work with the grouping API, where keys wrapped in a single transaction would most likely have the same group ID, which is the basis for the hashcode used in the consistent hash location.  This would render any such ordering algorithm useless... 
> That's where the callback for conflict resolution kicks in: 
> - if two object have the same consistent hash value
> - call a user function to order the keys
> - this user function, by default, would rely on object's hashcode - this only works if the key has hashcode overridden - for the JVM reason you mentioned below 

And what happens if the object's hashcode is not overridden?  Or if a user-defined hashcode is poor and returns the same value for 2 keys?

--
Manik Surtani
manik at jboss.org
twitter.com/maniksurtani

Lead, Infinispan
http://www.infinispan.org






More information about the infinispan-dev mailing list