Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 92278 invoked from network); 14 Apr 2003 13:36:20 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 14 Apr 2003 13:36:20 -0000 Received: (qmail 3561 invoked by uid 97); 14 Apr 2003 13:38:15 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 3554 invoked from network); 14 Apr 2003 13:38:14 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 14 Apr 2003 13:38:14 -0000 Received: (qmail 75250 invoked by uid 500); 14 Apr 2003 13:30:36 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 75207 invoked from network); 14 Apr 2003 13:30:36 -0000 Received: from mail-ex1.shaws.com (HELO shaws63svr.shaws.com) (67.96.113.130) by daedalus.apache.org with SMTP; 14 Apr 2003 13:30:36 -0000 Received: from WSLB2366A (wslb2366a.shaws.com [172.22.50.210]) by shaws63svr.shaws.com (iPlanet Messaging Server 5.2 HotFix 1.03 (built Oct 1 2002)) with ESMTP id for tomcat-user@jakarta.apache.org; Mon, 14 Apr 2003 09:30:28 -0400 (Eastern Daylight Time) Date: Mon, 14 Apr 2003 09:30:34 -0400 From: Jim Krygowski Subject: RE: Maybe OT: File Locking and Tomcat In-reply-to: <9C5166762F311146951505C6790A9CF858E89B@US-VS1.corp.mpi.com> To: Tomcat Users List Message-id: MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Have you thought about using the java.nio.channel package? I haven't dug into it yet but I've read a few articles. You might be interested in looking at SelectableChannel. > -----Original Message----- > From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com] > Sent: Monday, April 14, 2003 9:14 AM > To: Tomcat Users List > Subject: RE: Maybe OT: File Locking and Tomcat > > > > Howdy, > > >I'm implementing a web app using Tomcat 4.1 running on linus with JDK > >1.3 and currently my client doesn't want to use a database to store > > This is not always a bad thing! ;) > > >A potential solution I'm looking into involves checking for a lock file > >(like my-file.csv.lock). If it doesn't exist, I create it, then write > >to the CSV, otherwise, I wait til the lock file doesn't exist. > > This is a good solution as it's platform-independent, > database-independent, lightweight, and self-contained within your > webapp. I would make two small suggestions: > > - Use the javax.servlet.context.tempdir directory for the lock file, as > this is the one (actually you could use java.io.tmpdir as well) place > you're guaranteed write permissions. > > - Either don't wait for the lock file to not exist, instead putting a > message to the user to try again later, or wait for a very short time. > Don't get into a state that could appear as 'hung' to the user. > > Yoav Shapira > Millennium ChemInformatics > > > > This e-mail, including any attachments, is a confidential > business communication, and may contain information that is > confidential, proprietary and/or privileged. This e-mail is > intended only for the individual(s) to whom it is addressed, and > may not be saved, copied, printed, disclosed or used by anyone > else. If you are not the(an) intended recipient, please > immediately delete this e-mail from your computer system and > notify the sender. Thank you. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org