This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes How can i avoid con-current access in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How can i avoid con-current access in java" Watch "How can i avoid con-current access in java" New topic
Author

How can i avoid con-current access in java

Guy Belpa
Ranch Hand

Joined: Nov 21, 2004
Posts: 41


IF my english wrong sorry.

see this code,
(this is not real code.. this is only


What i want is avoid con-current access to this method.
Becase Currently sometimes this method returns same "currentstID"
for two users!!! which spoil all program flow.

i tried



and



But no work??

Please help!!!


(this is web based (struts) application hosted in Weblogic server)

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

I'm moving this to JDBC.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Guy Belpa
Ranch Hand

Joined: Nov 21, 2004
Posts: 41
problem not clear?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41085
    
  43
PatienceIsAVirtue

Making that method synchronized will only work if there's only a single instance of the class that contains the method. If there are several instances then the code needs to synchronize on the same object for all instances - maybe the Class object of that class.


Ping & DNS - my free Android networking tools app
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How can i avoid con-current access in java
 
Similar Threads
jdbc update help
Inserting/Updating BLOBs in Oracle8i using JDBC thin driver
Problem with DSN less Connection with MS Access 2000
SQL coding to add stock balance in JSP
SQLException: No more data to read from socket