9 Replies Latest reply on Jun 12, 2007 7:23 AM by fredrikj

    Exclusive lock on bottom (leaf) node only?

    atijms

      Hi,

      I'm in a situation where I would like to have an exclusive lock on only the leaf node in a tree.

      E.g. suppose I have a tree with entries "/a/b/n1" and "/a/b/n2". When Tx1 accesses "/a/b/n1", Tx2 should not be able to also access (either read or write) "/a/b/n1" until Tx1 has completed and released its locks. However, meanwhile Tx3 should be able to access "/a/b/n2".

      With isolation level SERIALIZABLE, the entire tree is exclusively locked. E.g. when Tx1 in the above example accesses "/a/b/n1" and writes to n1, it has a read lock on a and b and a write lock on n1. If meanwhile Tx3 wants to access "/a/b/n2", it already fails to acquire the read lock on "/a", making it impossible to reach "/a/b" and "a/b/n2"

      The lower isolation levels also don't work for my usecase. E.g. when Tx1 accesses "/a/b/n1" and reads n1, Tx2 is also able to read n1 at the same time, which is what should not be allowed.

      In short, I would like to be able to have SERIALIZABLE semantics per specific sub-tree instead of the whole tree.

      Is something like that possible with JbossCache?