This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Data class is used to access data in Local mode, I am planning to remove all the synchronized key word from method heading in Data class, any comments ?
I assume that in remote mode, your clients use a remote object that wraps the same instance of Data. If so, the methods of Data must be synchronized to insure thread safety. Eugene.
Joined: Jan 07, 2003
I assume that in remote mode, your clients use a remote object that wraps the same instance of Data. If so, the methods of Data must be synchronized to insure thread safety.
Yes, that is what I do. But what if I remove synchronized from Data and make all my RemotedataServer methods synchronized? Eugene, I send you a private msg. could you please let me know about it. Thank you Garandi
Joined: Oct 08, 2001
But what if I remove synchronized from Data and make all my RemotedataServer methods synchronized?
But each client has its own RemotedataServer object, right? If so, nothing will prevent client A to call a modify() method of Data while client B is in the middle of it. You need some sort of inter-client (as opposed to intra-client) synchronization, and the common solution here is that remote cients use their own remote objects, but all of these remote objects use the same instance of Data, whose methods are synchronized. This guaranties that although the clients are never aware of each other, they never collide, since there is a semaphore at the crossing, i.e. the synchronized methods of Data. Eugene. [ January 15, 2003: Message edited by: Eugene Kononov ]