tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Maybe OT: File Locking and Tomcat
Date Mon, 14 Apr 2003 13:14:19 GMT


>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 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:
For additional commands, e-mail:

View raw message