File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "How to protect object Watch "How to protect object New topic

How to protect object's state in distributed scenario

Vijay Bhore

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

I agree. Here's the link:
subject: How to protect object's state in distributed scenario
jQuery in Action, 3rd edition