tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brian janaszek <>
Subject RE: Maybe OT: File Locking and Tomcat
Date Mon, 14 Apr 2003 09:21:29 GMT
> >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.


I also just saw a thread on Google groups that suggested just wrapping
the IO code in a synchronized block....would this be an acceptable
solution?  Or could this cause race/deadlock conditions?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message