Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

Exclusive file lock

Thread view: 
Bruintje Beer - 21 Dec 2007 17:58 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.