Suresh Thalamati wrote:
Any ideas to fix this problem ?
What if you included some additional information in the lock files,
and then changed the locking algorithm so that it considered more
than just the presence or absence of the lock file, and whether it
could be locked successfully or not.
For example, in traditional Unix programming, one would put the
process ID of the process which was locking the thing into the file,
either in the contents of the file or in the name of the file.
That way, another process which came along and discovered the lock
file could know not only that some other process was trying to lock
the object, but also the process ID of that process.
To adapt this algorithm to your case, you would need some sort of
unique identifier for each class loader. Then, class loader A in the
VM would encounter the lock file, and would see that class loader B
in that VM had created the lock file, and would know that the database
was locked and a lock error should be returned.
In pseudocode:
if (file exists &&
I am able to lock the file &&
(the file was written by a different process ||
the file was written by a different class-loader))
then
the database is locked, return lock error
Does this work?
thanks,
bryan