Article View: borland.public.jbuilder.java.language
Article #17165Re: File Locking
From: William Yu
Date: Tue, 08 Dec 1998 00:00
Date: Tue, 08 Dec 1998 00:00
21 lines
1827 bytes
1827 bytes
Terry Swiers wrote: > I'm just starting to play around with JBuilder and have one question in > particular that I can't seem to find the answer to. Is there any type of > file locking capabilities in Java? In short, I need to be able to have one > user open a file exclusively on a internet server for a few seconds and then > release it for the next person. Is this possible? Part 1: In any language, the process of locking files is pretty much the same. You either (1) open a file handle for append access or (2) maintain your own internal locking list. I don't recall all the specific file I/O classes or methods so I can't direct you to a specific piece of code. However, I'm sure if you browsed the JDK documentation in the area of java.io.*, you'll find something that works. Part 2: But if you are attempting to lock a file from a downloaded applet, then no dice. This is one of the many restricted operations applets cannot perform without many tricks. You will need to have some sort of custom application (Java or otherwise) running on the web server to do the file locking for the applet. Of course, you will have to develop some method of communicating with this server application -- the choices you have are CGI, sockets, RMI or CORBA.
Technical Details
Message-ID:
<366D2A51.ABEE2F08@Bigfoot.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<74h1nl$7s19@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,880c91ca50958612 X-Google-Attributes: gidf74b3,public From: William Yu <William_Yu@Bigfoot.com> Subject: Re: File Locking Date: 1998/12/08 Message-ID: <366D2A51.ABEE2F08@Bigfoot.com> X-Deja-AN: 420042874 Content-Transfer-Encoding: 7bit References: <74h1nl$7s19@forums.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language