Hi,
I was wondering if there is a way to open a data file in exclusive mode not
using the nio package. The reason for not using the nio package is not
relevant I am just interrested in some kind of solution.
John
Hunter Gratzner - 21 Dec 2007 18:51 GMT
> I was wondering if there is a way to open a data file in exclusive mode not
> using the nio package. The reason for not using the nio package is not
> relevant
So you thing we are not worthy to know some background. But we should
be glad to be at your service.
Hint: Hire a consultant if you need to have someone you can push
around.
Daniel Pitts - 21 Dec 2007 19:02 GMT
> Hi,
>
[quoted text clipped - 3 lines]
>
> John
Exclusive file locks are often OS specific, and as such difficult to
have a OS neutral implementation.

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
Roedy Green - 21 Dec 2007 19:29 GMT
>I was wondering if there is a way to open a data file in exclusive mode not
>using the nio package. The reason for not using the nio package is not
>relevant I am just interrested in some kind of solution
Only some half-assed solutions.
see http://mindprod.com/jgloss/lockedfiles.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Arne Vajhøj - 21 Dec 2007 23:13 GMT
> I was wondering if there is a way to open a data file in exclusive mode not
> using the nio package. The reason for not using the nio package is not
> relevant I am just interrested in some kind of solution.
Write some C code and call it via JNI.
Arne
Lew - 22 Dec 2007 01:32 GMT
Bruintje Beer wrote:
>> I was wondering if there is a way to open a data file in exclusive
>> mode not using the nio package. The reason for not using the nio
>> package is not relevant I am just interrested in some kind of solution.
How come you don't want to use NIO?
> Write some C code and call it via JNI.
Assuming an OS for which it's possible to take out such a lock on a file.

Signature
Lew
EJP - 22 Dec 2007 05:01 GMT
> The reason for not using the nio package is not
> relevant
Your reason for not using the only package that provides a solution is
*extremely* relevant.
You only have to use NIO for the lock, not for the I/O. Start with a
FileInputStream or RandomAccessFile, get the FileChannel from that, and
lock the file.