How to protect object's state in distributed scenario
posted 5 years ago
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()
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..