Hello i have command pattern with MVC pattern... do get(){ command.execute() } in execute method execute(){ calling a instance method of another class for accessing/delete/update DB } Should i use synchronize in class instance method which access/delete/update record
thanks Faisal
}
Syed Saifuddin
Ranch Hand
Joined: Sep 01, 2003
Posts: 129
posted
0
Assalaam-o-Alakum: One way to solve ur problem is by using Synchronise but if have to deal with money transection then use ejb at the backend of servlet
thanks... but u do not understand my question. my question is that, synchronize block is necessary for udating/delete/insert DB records in execute method...(the senario i give u)? thanks
steve souza
Ranch Hand
Joined: Jun 26, 2002
Posts: 852
posted
0
Synchronize would not be needed in this case if all you do is delete/insert/update database records as the db will not allow another DML SQL statement to execute until the other is finished.
Hi faisal, not sure how this is a Servlets question, and not sure which forum would this thread be more appropriate in. However, you should consider Synchronization as a way to keep one call to a method being run at one time. Meaning no other caller can call that method while the first caller is running. This is different than transactions, which is database related, and basically states that one or more sql statements can run and either they all commit or they all rollback. So while one user has a transaction occuring, another can also have their own transaction running, and all concurrency issues are handled by the database. With this in mind, I am just going to close this thread, and if you have more questions, please try to post them in the appropriate forum. Each forum has a topic, and posts in each forum should be about the topic. Thanks Mark