This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class locks between processes

 
Jamie Burrell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I know the Thread and synchronize functionality allows me to lock objects between multiple threads within the same process, but is there anyway to lock an object between processes?

Case Study:
Process A calls class AccessResource. It utilises this class for 10 seconds before ending.
Process B calls class AccessResource. It cannot access it because class A is using it, and it is locked. It waits for it to be freed, then uses it itself.

Any ideas?

Thanks,
Jamie
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you'll have to make the processes talk to each other or some shared external resource manager. We had this conversation on the ranch once before and I thought if the two processes already share a database the database might make a good manager because it has good ACID operations. Flags on a shared file system might be tempting, but I'm not sure they would be reliable. I have a design in my drawer for a resource manager process that a friend did about 20 years ago. Maybe I should dig that out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic