Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RandomAccessFile - which mode?

 
Dan Murphy
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my design I have multiple instances of Data, each of which uses a RandomAccessFile to read the database file. It seems to me that using RandomAccessFile mode "rws" (or "rwd") rather than "rw" will greatly simplify concurrent file access, when there are multiple instances of RandomAccessFile writing to the same file, because a client knows that as soon as a file-updating method has returned, other clients will be able to see the changes. But the consensus in this thread seems to be that "rw" is sufficient, can someone explain why?

Cheers,
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic