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
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
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:
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(
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
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
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
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
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
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
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 =
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
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
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
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
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
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
-
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
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
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
20 matches
Mail list logo