Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

too hard for me - multi-process file synchronization

Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic