Hello,
I blocked a file with Slide API by User A (lock type = read,
not exclusive). However when user B tries to get content of this
file, I am getting exception:
org.apache.slide.lock.ObjectLockedException: Object /files/dir/test.txt is
already locked
at org.apache.slide.lock.LockImpl.checkLock(LockImpl.java:443)
at org.apache.slide.lock.LockImpl.checkLock(LockImpl.java:396)
at org.apache.slide.content.ContentImpl.retrieve(ContentImpl.java:162)
Is it right behaviour for locking? User B can still obtain the same lock on
that file, but cannot get content of it...
I checked what is going on. Method 'retrieve' of ContentImpl class calls:
lockHelper.checkLock(token, associatedObject,
namespaceConfig.getReadRevisionMetadataAction());
Then LockImpl class creates appropriate LockNode object to test possibility
of setting lock. However the created object has compatibility set to default
(EXCLUSIVE). New lock is incompatible and exception is thrown.
So I changed LockNode object compatibility to SHARED. It didn't solved
my problem because:
//LockImpl class
public boolean isCompatible(...) {
...
if (checkToken.isShared() && matchToken.isShared() && tryToLock && condition1
) {
compatible = true;
}
}
The 'tryToLock' variable is set to false (other checks are fine) because we
want to test if we can set lock instead of just setting it. Why does variable
'tryToLock' influences compatibility checking?
Thanks for any help...
Tomasz Majchrzak
--------------------------------------------------------------------
Inni sciagaja, sciagnij i Ty! Sprawdz bo warto..
>> http://link.interia.pl/f188e <<
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]