commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mart...@apache.org>
Subject Re: [fileupload] DefaultFileItem.getUniqueId and multiple class l oaders
Date Mon, 28 Nov 2005 01:20:15 GMT
On 9/28/05, Small, Michael <Michael.Small@ssa.gov> wrote:
>
>
> Thanks Alexey,
>
> That would give us uniqueness across class loaders, and we could create
> the
> UID just once.
>
> To avoid creating a UID object every time a file is uploaded, in the
> defaultFileItem class we would initialize a static String variable (call
> it
> thisJvmId) with the UID method.  We would concatenate thisJvmId with the
> existing static counter variable to have a unique ID across class loaders.


I've just checked in this change, so now the  generated file names look
something like this:

upload_c4d04d_107d4707f56__8000_00000000.tmp

This will be available in FileUpload 1.1.

--
Martin Cooper


Although we are using the FileUpload 1.0 binary release (2003) - as yet
> unmodified - we'd be happy to share our modification to
> defaultFileItem.  It
> may save others from the strange, sporadic errors we encountered.  I'll
> continue to lurk on the list to see how to best go about that.
>
> Thanks,
> Mike
>
>
> Mike S wrote:
>
> > 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.
>
> return new java.rmi.server.UID().toString().replace(':','-');
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>

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