Re: method level synchronization doesn't work

2004-10-01 Thread Peter Lin
My feeling on this is, doing a sync on a data bean in this specific case is not worth it. If the transaction is complex, which this case isn't, use something like java transaction API. doing either a subquery or the prepared statement example is a far better way. doing a sync unnecessarily is a ba

Re: method level synchronization doesn't work

2004-10-01 Thread Mike Fuellbrandt
Correct me if I'm wrong, but couldn't the code synchronize on a static final member of the jsp? private static final String COUNTER_INCREMENT_LOCK = newString("lock"); and then you would use the second method from the first post to synchronize on? (It's been a long time since I considered synchr

RE: method level synchronization doesn't work

2004-10-01 Thread Mike Curwen
IL PROTECTED] > Cc: Tomcat Users List > Subject: Re: method level synchronization doesn't work > > > On Fri, Oct 01, 2004 at 04:05:53PM +1200, [EMAIL PROTECTED] wrote: > > Is your primary key generated automatically? > > If so, the combined insert/query is:

Re: method level synchronization doesn't work

2004-10-01 Thread erh
On Fri, Oct 01, 2004 at 04:05:53PM +1200, [EMAIL PROTECTED] wrote: > Is your primary key generated automatically? > If so, the combined insert/query is: > >String stmt="INSERT INTO SOMEFILE (FLD1,FLD2,FLD3) > VALUES(?,?,?)"; >PreparedStatement sql = > conn.prepareStatement(

RE: method level synchronization doesn't work

2004-09-30 Thread Mike Curwen
queries for other reasons. > -Original Message- > From: Peter Lin [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 30, 2004 10:24 PM > To: Tomcat Users List > Subject: Re: method level synchronization doesn't work > > > that would explain some of the problems

RE: method level synchronization doesn't work

2004-09-30 Thread Mike Curwen
racle'ish feel to it. So whenever I hear of someone say something like "use one query to generate your next pk".. I always wonder. > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 30, 2004 11:06 PM &g

RE: method level synchronization doesn't work

2004-09-30 Thread jthompson
t; -Original Message- > From: Peter Lin [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 30, 2004 7:42 PM > To: Tomcat Users List; [EMAIL PROTECTED] > Subject: Re: method level synchronization doesn't work > > > that would be the easiest way. > > but you

Re: method level synchronization doesn't work

2004-09-30 Thread Peter Lin
omething that would run on mysql? > > unless you can get this magic query, it's not quite as simple as "let the > databse handle it", is it? > > > > > > -Original Message- > > From: Peter Lin [mailto:[EMAIL PROTECTED] > > Sent: Thursday

Re: method level synchronization doesn't work

2004-09-30 Thread Frank W. Zammetti
ad safe." something that would run on mysql? unless you can get this magic query, it's not quite as simple as "let the databse handle it", is it? -Original Message- From: Peter Lin [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 7:42 PM To: Tomcat User

RE: method level synchronization doesn't work

2004-09-30 Thread Mike Curwen
let the databse handle it", is it? > -Original Message- > From: Peter Lin [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 30, 2004 7:42 PM > To: Tomcat Users List; [EMAIL PROTECTED] > Subject: Re: method level synchronization doesn't work > > > that

Re: method level synchronization doesn't work

2004-09-30 Thread Peter Lin
that would be the easiest way. but you made it too easy, I thought people are suppose to suffer and stumble :) peter On Thu, 30 Sep 2004 17:46:51 -0400, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > Why not just let SQL do the update? Do the following: > > update my_table set counter_field =

Re: method level synchronization doesn't work

2004-09-30 Thread Frank W. Zammetti
e to synchronization. Thanks, Malia -Original Message- From: QM [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 3:01 PM To: Tomcat Users List Subject: Re: method level synchronization doesn't work On Thu, Sep 30, 2004 at 01:14:26PM -0400, Malia Noori wrote: : I thought T

Re: method level synchronization doesn't work

2004-09-30 Thread QM
On Thu, Sep 30, 2004 at 05:31:25PM -0400, Malia Noori wrote: : Thank you for replying, but I would appreciate it if you could expand on : your explanation. Here is my original post: : : Actually, the data that I am modifying requires a transaction and : > synchronization. It increments a counter

RE: method level synchronization doesn't work

2004-09-30 Thread Malia Noori
chronization. Thanks, Malia -Original Message- From: QM [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 3:01 PM To: Tomcat Users List Subject: Re: method level synchronization doesn't work On Thu, Sep 30, 2004 at 01:14:26PM -0400, Malia Noori wrote: : I thought Tomcat

Re: method level synchronization doesn't work

2004-09-30 Thread QM
On Thu, Sep 30, 2004 at 01:14:26PM -0400, Malia Noori wrote: : I thought Tomcat instantiates only 1 instance of JSP servlet to handle all : requests. Isn't that the reason why it's not suggested to have instance : variables? Close, but not quite. ;) The servlet spec permits a container to create

RE: method level synchronization doesn't work

2004-09-30 Thread Malia Noori
o: Tomcat Users List Subject: Re: method level synchronization doesn't work I'd be surprised if synchronization was broken. Given one assumption I think I can explain what you are seeing. Assumption: The two concurrent requests are handled by two different instances of a jsp servlet. I

Re: method level synchronization doesn't work

2004-09-30 Thread Peter Lin
method level synchronization does not work while synchronizing on a block of > code inside a method works. > > Thanks, > Malia > > > > -Original Message- > From: Peter Lin [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 30, 2004 10:26 AM > To: Tomcat User

Re: method level synchronization doesn't work

2004-09-30 Thread Jon Wingfield
- From: Peter Lin [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 10:26 AM To: Tomcat Users List; [EMAIL PROTECTED] Subject: Re: method level synchronization doesn't work am I missing something, but looks like you're trying to build some kind of web cache. why not use Hiberna

RE: method level synchronization doesn't work

2004-09-30 Thread Malia Noori
10:26 AM To: Tomcat Users List; [EMAIL PROTECTED] Subject: Re: method level synchronization doesn't work am I missing something, but looks like you're trying to build some kind of web cache. why not use Hibernate or something that already does caching for you instead? the only time I ca

Re: method level synchronization doesn't work

2004-09-30 Thread Peter Lin
am I missing something, but looks like you're trying to build some kind of web cache. why not use Hibernate or something that already does caching for you instead? the only time I can see a need to sync, is if the request contains data that requires a transaction. Which in that case, you're better