Re: Persistent locking

Nathan Kontny <Nathan.Kontny-UgwZ4owrJFB8UrSeD/[email protected]> Sat, 22 May 2004 13:39:37 -0700
Newsgroups gmane.comp.java.keel.user
Message-ID <[email protected]>
Following up my post: 

I guess instead of locking the Persistent, in my use case having my Model
implement Threadsafe will do the trick I believe.  Am I correct in thinking
that having my model implement Threadsafe will ensure that my model will finish
executing its execute method, before another thread is allowed to start it
again?

Thank you,
-Nate

Quoting Nathan Kontny <Nathan.Kontny-UgwZ4owrJFB8UrSeD/[email protected]>:

> I am a little confused about the current state of Keel's Persistent locking.
> 
> The JavaDoc says that calling lock on a persistent keeps the persistent in
> an
> exclusive read/write state.  
> 
> However, when I call lock on my Persistent, and then a little later I call
> add()
> on it, I notice that the add method hangs indefinitely while it tries to
> require the lock.  I haven't releaed the lock before calling add() because I
> want to still maintain the write exclusivity until my updates are commited. 
> But I see that the Mutex class that Keel uses for locking does not support
> reentrant locks.  I assume this means that once a thread calls aquire on the
> lock, it can't do it again?  
> 
> Am I missing something?  Or does Keel need a reentrant locking mechanism? 
> 
> -Nate
> _______________________________________________
> User mailing list
> [email protected]
> http://lists.keelframework.org/listinfo.cgi/user-keelframework.org
>