commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike S <mike.tallsm...@gmail.com>
Subject [fileupload] DefaultFileItem.getUniqueId and multiple class loaders
Date Tue, 27 Sep 2005 16:01:45 GMT
We have a very busy server running 9 clones of a web app server. Each clone
uses DiskFileUpload, and most of the incoming files are cached to disk. We
discovered that in rare instances, two clones will attempt to write to the
same file, causing corruption.

We discovered that getUniqueId (which is used to create tmp file name) is
not guaranteed unique across class loaders (it's written in the code
comments -- thank you). One solution to the file collisions is to force each
clone to write to a different tmp directory. However, we would prefer to not
have to worry about managing multiple tmp directories.

Are there any suggestions as to the best way to modify the getUniqueId
method to return a unique ID across class loaders? We are thinking along the
lines of injecting a random number to concatenate with the static counter in
the DefaultFileItem, (or grabbing the start timestamp off the jvm) to create
unique names.

Thanks,
Mike

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message