[infinispan-dev] SingleJoinTest#testTransactional failure
Manik Surtani
manik at jboss.org
Mon Nov 29 10:14:39 EST 2010
On 29 Nov 2010, at 14:57, Vladimir Blagojevic wrote:
> On 10-11-27 12:29 AM, Manik Surtani wrote:
>> Nope, no such mechanism. This needs to be written.
>
> What if we add a new lockAndRecord method in LockManager with signature:
>
> LockingResult lockAndRecord(Object key, InvocationContext ctx, boolean force) throws InterruptedException;
>
> and LockingResult is enum or a simple class with fields:
>
> boolean acquired;
> Object owner;
Why do you need to return the owner?
> In case of force, I believe we can atomically change ownership of a lock, assign owner to previous owner of a lock and thus provide callers of lockAndRecord with a mechanism to issue a rollback on a correct global tx in case global tx was previous owner. In normal cases, just as it is now, we assign value of acquired and in case !acquired owner is current lock owner.
>
> Questions:
>
> 1) If an owner was a thread, not a global tx, what are the consequences for that thread - is it subsequently going to be prevented from writing to value key by the locked key?
I think we can only safely do this if the existing owner is in a transaction. In any case, this is only likely to be a problem with transactions/long-lived locks.
Cheers
--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org
More information about the infinispan-dev
mailing list