• Post Reply Bookmark Topic Watch Topic
  • New Topic

too hard for me - multi-process file synchronization

 
Jeff Caswell
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please tell me how to do this or where to find information on how to do it? I have a general idea but don't want to waste time going down the wrong path. Here's my problem:
I have three separate JVMs running on the same or different machines and they all read/write the same file, which resides on one of the machines. (Right now, they are all on one machine.) My problem is they are not all writing to the file properly. Some information from each process gets in, but a lot is not.
My idea - please comment or suggest other ways:
Use a separate class to control that file on the machine it resides on and include an RMI "server" in it to control read/write to the file. The other JVMs should go through this class to access the file.
I don't know how to go about writing the class though. Just a few pointers is all I need.
Thanks.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeff,
You're right on the idea of using RMI and encapsulating the file into a single class which should be a Singleton. As for using RMI, it is fairly simple once you get the basics down. There is another forum on this site named Distributed Java and I believe there is a very good tutorial on RMI there by one of Sun's gurus. Also, there are various books which cover RMI. One of the bartenders here, Michael Ernest is co-author of The Complete Java 2 Certification Study Guide which has some excellent material on RMI in the Developer's section of the book.
Hope this helps
Michael Morris
SCJP
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!