Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to protect object's state in distributed scenario

 
Vijay Bhore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic