Posted on May 12th, 2006 by tpo
Synchronization from non-Java with Java through File Locks
Synchronization with Java through File Locks
flockfor synchronization through file locks with Java. When one process uses
flockand the other
lockf, then they will not be able to see each other's locks.
Java praises itself as being truly portable. Since 1.4 it also has a platform-independent file locking mechanism that is visible accross process boundaries and is meant for synchronization with non-Java applications .
Although the manual talks lenghtily about platform issues  it stays completey silent on the fact, that if you want to synchronize with Java you must use the
lockf/fcntlmechanism in non-Java applications in order to see Java's file locks and in order for Java to be able to see the non-Java application's ones.
How not documenting the fact leads to portable applications, in spite of the fact that many  other  languages use
flockinstead remains to be seen.