This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Should I synchronize my remote methods ?  RSS feed

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
I have coded a RMI application that connects to a database server (updating, deleting ....).
should I declare the methods of my RMI remote object as synchronized ?
thanks.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really wouldn't synchronize the entire remote method... This means that only one client can be active in the method at a time and it can create a bottleneck. You may want to synchronize important sections inside your methods if you're updating multiple rows/tables/etc. within one transaction. On the other hand, depending on what you're doing, the database may be able to do it for you - if you only need to update one row at a time and the database has row locking, you wouldn't really need any aditional controls in place.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!