Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#11 prevent multiple instances of programm

Somewhen
open
5
2007-09-01
2007-01-05
Anonymous
No

i feel that multiple open instances of the program can lead to confusion, so i better do not do that. But what if it happens inadvertently? I might change an entry in one instance and overwrite it later by another. Could this secenario even corrupt the data file?

Would it be a good idea to use some kind of lock to prevent multiple instances of JPassword accessing the same data file?

Discussion

  • Logged In: YES
    user_id=551242
    Originator: NO

    Some people do feel that multiple open instances are good for comparing different files! :)

    First, I must confess I currently lack the knowledge if and how this can be done in pure Java (namely to prevent multiple running instances of the same program). Second, at this time I'm not perfectly convinced this is a good idea.

    About your concern with multiple "open" databases:

    First, please keep in mind that Java does not make promises about the behaviour of a VM environment, in particular concerning OS dependent blocking and sharing. But assuming reasonable and expectable behaviour here, I can say the following.

    A. There is no reason to fear database corruption from multiple open instances/files. This is because JPWS does not keep open (random access) database files! So the only critical phase is when a file is actually being saved. During this stream writing phase the OS has automatically locked the file against secondary open requests, so there should be no corruption possible from this side.

    B. If you have the same file open in two different instances of the program, modify and save in both instances, the content of the instance that has saved latest is the actual file content.

    Presently, yes, JPWS expects the user to keep some awareness of what he or she is doing. Also, this program is designed as a *personal* manager, not a multi-user application. I consider to add file locking on an optional basis though some day. This would prevent simultaneous opening of the same file (in an environment that supports this kind of file locking). Yet, I don't see it as urgent.

    Cheers!
    - Wolfgang

     
  • Logged In: YES
    user_id=551242
    Originator: NO

    Should be done when conditions met.

     
  • Note that file locking has been implemented with 0-6-0 RC1, which works with operating systems that support such a feature (e.g. Windows). This will prevent inadvertent conflicts.

     


Anonymous


Cancel   Add attachments