[concurrency-interest] Lock Manager

Oliver Zeigermann oliver@zeigermann.de
Wed, 05 Nov 2003 00:32:22 +0100


I tried something generic at

http://cvs.apache.org/viewcvs.cgi/jakarta-slide/src/stores/org/apache/slide/store/txfile/rm/impl/GenericLock.java?rev=1.1&only_with_tag=MAIN&content-type=text/vnd.viewcvs-markup

and

http://cvs.apache.org/viewcvs.cgi/jakarta-slide/src/stores/org/apache/slide/store/txfile/rm/impl/GenericLockManager.java?rev=1.1&only_with_tag=HEAD&content-type=text/vnd.viewcvs-markup

allowing you to configure if it should be blocking (wait) and if it is 
reentrant. Additionally it, allows for any number of lock levels. This 
means you can have just two (like locked/unlocked) three for 
(read/write/unlocked) or as in my application five 
(read/write/read-while-write/commit/unlocked).

I am sure Doug and the others in this list are smarter than me, but I 
still feel it would be very hard in general to find something that 
matches all needs and applications even for them.

Hope this was not too much off topic.

Oliver

Adam Messinger wrote:

 > Please excuse if this is something which has already been discussed 
and found to be out of scope.  I looked back through the archives and 
couldn't find a record of it.  I believe that a number of programs have 
need for functionality that looks something like this:
 >
 > public interface LockManager {
 >   public void lock(Object key, Object owner);
 >   public void tryLock(Object key, Object owner, long time, TimeUnit 
unit);
 >
 >   public void unlock(Object key, Object owner);
 > }