On 30 Nov 2010, at 14:30, Vladimir Blagojevic wrote:
On 10-11-30 10:49 AM, Vladimir Blagojevic wrote:
> I like your solution. It seems to be less disruptive to ongoing
> transactions then the other two solutions.
>
> How would you safely detect that K is locked by another tx and thus skip
> locking?
I do *not* think I can do the following in LockingInterceptor:
public Object visitInvalidateCommand(InvocationContext ctx, InvalidateCommand command)
throws Throwable {
try {
if (command.getKeys() != null) {
for (Object key : command.getKeys()) {
if(!lockManager.isLocked(key))
entryFactory.wrapEntryForWriting(ctx, key, false, true, false, false,
false);
}
}
return invokeNextInterceptor(ctx, command);
Perhaps you only want to run
invokeNext for the keys for which you acquired locks?
} catch (Throwable te) {
return cleanLocksAndRethrow(ctx, te);
}
finally {
doAfterCall(ctx);
}
}