Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

B&S - Record handling  RSS feed

Troy Farrell
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im new to this board so excuse me if I dont explain
myself clearly.

My system will utilise RMI for networking and allows multiple instances
of the Data access class to occurr. This means multiple threads can
be attempting to alter the DB file at the same time.
Using NIO package and FileChannels they guarantee safety with multiple concurrent threads in same application but if the user runs more than one local application in non networked mode a consistent view of the file is not guaranteed. How do you get round this?
Ive thought about limiting the number of application versions running locally on same machine by having a flag in App properties file and checking the flag before running the application.

Java quote below.

The view of a file provided by an instance of this class is guaranteed to be consistent with other views of the same file provided by other instances in the same program. The view provided by an instance of this class may or may not, however, be consistent with the views seen by other concurrently-running programs due to caching performed by the underlying operating system and delays induced by network-filesystem protocols. This is true regardless of the language in which these other programs are written, and whether they are running on the same machine or on some other machine. The exact nature of any such inconsistencies are system-dependent and are therefore unspecified.

OOOOPS sorry - The old read the instructions properly.

You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.

hope I didnt waste anyones time.


[ March 30, 2005: Message edited by: Troy Farrell ]
[ March 30, 2005: Message edited by: Troy Farrell ]
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!