Distributed Hierarchy locking

102 views Asked by At

I have a need to use distributed locking in my project. I am considering Zookeeper + Curator for this. During my investigations, I found that these two frameworks can solve for most of my project needs. But I have two use cases which I am not clear how to solve them by Zookeeper+Curator.

  1. Resource hierarchy in locking: We have notion of hierarchy in resources, such that if a resource (eg: DB table) is locked, other requests for that object and all sub-ordinate resources(eg: rows) should be blocked. Similarly, if sub-ordinates of a resource is locked then the lock request for the resource should block on that. Is there a way to configure curator to serve the above need?

  2. Actor based reentrancy: User U1 logged into the system from node N1. During the system operations he acquires locks on the shared resources. If he requests the same resource again, it will be granted by curator because the reentrancy check is based on UUID of the thread. If the same user U1 login to the system again from node N2, his requests will be queued because UUIDs won’t match. My requirement is that if any user logins simultaneously from different nodes(multiple jvms), all his requests has to be dealt as if he logged in from a single node. Can this be done by replacing UUID with UserID( in general any actor/application based ID) in curator? If not please help by noting the correct method.

Please let me know any mechanism or framework that has Distributed locking framework and that can meet above requirements.

thanks, Naresh

0

There are 0 answers