In your environment, is no-wait something you use every time you select from
a table, or is it something that is used very occasionally?
What I mean is; is it enough to have a system property
hibernate.locking.use_no_wait
or mapping file option,
<class name="Foo" no-wait="true">
or should I have a new LockMode
LockMode.EXCLUSIVE_NO_WAIT
----- Original Message -----
From: "Paul Szego" <pau...@ne...>
To: "Gavin King" <ga...@ap...>
Sent: Tuesday, October 01, 2002 3:04 PM
Subject: Re: [Hibernate] What would a good locking API look like?
>
> Hi,
>
> a no-wait option would be useful. It's what's stopping us using this in
> a few productions sytems. I hacked this in quite a while back, but the
> codebase has moved on considerably.
>
> Session.lock(foo) == Session.lock(foo, LockMode.EXCLUSIVE)
> == Session.lock(foo, LockMode.EXCLUSIVE, WaitMode.WAIT)
> == Session.lock(foo, WaitMode.WAIT)
>
> with an alternative of WaitMode.NOWAIT, or just use a boolean if you're
> that way inclined.
>
> PaulS.
>
> Gavin King wrote:
> > Hi, I've been thinking about improving Hibernate's locking API recently.
> > Currently your object could be in 3 different states:
> >
> > * No lock, for example if you just called session.update(foo) or if the
> > session was disconnected
> > * Shared lock, for example if you just called session.load(id) or
> > session.find(query)
> > * Exclusive lock, if you called session.loadWithLock(id) or
> > session.lock(foo), or if changes to the object have been flush()ed
> >
> > There is currently no mechanism for upgrading a lock from No lock to
Shared
> > lock, ie. to do a version check for an object.
> >
> > So I'm wondering about deprecating Session.lock() and
Session.loadWithLock()
> > and replacing them with
> >
> > Session.load(clazz, id, lockMode)
> > Session.load(object, id, lockMode)
> > Session.lock(object, lockMode)
> >
> > I would introduce a new class,
> >
> > public class LockMode {
> > public static final LockMode NONE;
> > public static final LockMode SHARED;
> > public static final LockMode EXCLUSIVE;
> > }
> >
> > Then
> >
> > Session.loadWithLock(clazz, id) == Session.load(clazz, id,
> > LockMode.EXCLUSIVE)
> > Session.lock(foo) == Session.lock(foo, LockMode.EXCLUSIVE)
> >
> > There is also a certain argument for allowing Session.update(foo,
lockMode),
> > but thats a bit more difficult to implement, so lets leave it for
later....
> >
> > Ideas + criticisms are very welcome!
> >
> > Gavin
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by: DEDICATED SERVERS only $89!
> > Linux or FreeBSD, FREE setup, FAST network. Get your own server
> > today at http://www.ServePath.com/indexfm.htm
> > _______________________________________________
> > hibernate-devel mailing list
> > hib...@li...
> > https://lists.sourceforge.net/lists/listinfo/hibernate-devel
> >
>
>
>
|