This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes How to protect object's state in distributed scenario Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "How to protect object Watch "How to protect object New topic
Author

How to protect object's state in distributed scenario

Vijay Bhore
Greenhorn

Joined: May 15, 2006
Posts: 12
Hii All,

In CORBA, I need to implement a mechanism which protects objects state when it is being accessed by remote objects.

I have an interface which lists a method increment() which is implemented as,

public synchronized int increment()
{ sum++;
return sum;
}

I am able to achieve the multiple clients access for this method when i m running it in a desktop. For that, i have synchronized the call to this method by keeping the servant object as a monitor.

But now i want to protect the state of the object when the remote objects are calling the same method.
Can anybody suggest about the approach i can follow to lock and unlock objects so that only one client can access/modify the state in distributed environment ?

I heard about two approaches
1) test and set approach
2) lock manager

It will be nice if i get a sample implementation of this..

Thanks in advance,
Vijay Bhore
Student, CA, USA

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to protect object's state in distributed scenario
 
Similar Threads
differences between synchronized blocks and synchronized() method
Synchronization on Threads in Java
Qs from Javachamp.com
Synchronizing Code
Threads - How to approach such a question?