On 25 nov. 2011, at 15:58, Christopher Schultz wrote:
> On 11/24/11 4:02 PM, Sylvain Laurent wrote:
>> I don't think this ThreadLocal creates a real leak of classloader.
>> It would if dayFormat was static.
>
> IIRC, ThreadLocal essentially puts a key/value pair in a Map in the
> Thread. I dunn
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Sylvain,
On 11/24/11 4:02 PM, Sylvain Laurent wrote:
> I don't think this ThreadLocal creates a real leak of classloader.
> It would if dayFormat was static.
IIRC, ThreadLocal essentially puts a key/value pair in a Map in the
Thread. I dunno what ki
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Terrence,
On 11/23/11 8:13 PM, Terence M. Bandoian wrote:
> Adding Thread.yield() eliminated the error message from the log.
No, this is a legitimate leak.
In order to fix it, I'd have to clean all the threads in the thread
pool (because it's a Thre
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Chema,
On 11/23/11 1:10 PM, Chema wrote:
>>> The string of the date format is constant. However the
>>> SimpleDateFormat
>> class is not threadsafe, so you will hit intermittant issues when
>> sharing across threads
>
> Do you mean that read operatio
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Konstantin,
On 11/23/11 1:21 PM, Konstantin Kolinko wrote:
> 2011/11/23 Christopher Schultz :
>> On 11/23/11 11:29 AM, Caldarale, Charles R wrote:
>>>> From: Christopher Schultz
>>>> [mailto:ch...@christopher
On 23 nov. 2011, at 16:48, Christopher Schultz wrote:
> Our servlet defines the ThreadLocal to be protected (because this is a
> base class for several servlets that all do similar things) and
> transient (because we just don't need it to be serialized) and
> override the initialValue method, like
On 1:59 PM, Christopher Schultz wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
All,
I've got a servlet that needs to log every request (potentially big
requests) to files on the disk. In order to do that in a
reasonably-tidy way, we write each file into a directory with the
current date
> From: Chema [mailto:demablo...@gmail.com]
> Subject: Re: Babysitting ThreadLocals
> Do you mean that read operations (getters) in not-threadsafe objects
> are not an atomic operations and could retrieve "dirty" values cause
> sharing across threads?
Correct. Not-th
2011/11/23 Christopher Schultz :
> On 11/23/11 11:29 AM, Caldarale, Charles R wrote:
>>> From: Christopher Schultz [mailto:ch...@christopherschultz.net]
>>> Subject: Babysitting ThreadLocals
>>
>>> Removing the ThreadLocal after every request of course mean
>> The string of the date format is constant. However the SimpleDateFormat
> class is not threadsafe, so you will hit intermittant issues when sharing
> across threads
Do you mean that read operations (getters) in not-threadsafe objects
are not an atomic operations and could retrieve "dirty" value
Ciao Christopher, i heard Joda has a thread safe date
parser/fotmatter..remember to check it doesn't use threadlocals too :)
Hth
Fil
Il giorno 23/nov/2011 17.57, "Christopher Schultz" <
ch...@christopherschultz.net> ha scritto:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Chris,
>
> On 11
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Chris,
On 11/23/11 11:46 AM, chris derham wrote:
> If you do this, and fine that creating these objects is taking more
> time, then perhaps one method would be to use a weak object
> reference to the thread local. That way you would get the best of
>
>
> A silly question:
>
> why do you use a ThreadLocal to store a constant value for entire
> application? why not a static variable or store into web application
> context , by example ?
>
> The string of the date format is constant. However the SimpleDateFormat
class is not threadsafe, so you wil
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Chuck,
On 11/23/11 11:29 AM, Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:ch...@christopherschultz.net]
>> Subject: Babysitting ThreadLocals
>
>> Removing the ThreadLocal after every request of course mea
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Chema,
On 11/23/11 11:31 AM, Chema wrote:
> A silly question:
>
> why do you use a ThreadLocal to store a constant value for entire
> application? why not a static variable or store into web
> application context , by example ?
It's not a silly que
On Wed, 2011-11-23 at 07:48 -0800, Christopher Schultz wrote:
> Should I look for a threadsafe implementation of
> SimpleDateFormat (maybe in commons-lang or something)?
I haven't used this, but it seems to be a drop in replacement for
SimpleDateFormat.
https://commons.apache.org/lang/api-2.5/o
A silly question:
why do you use a ThreadLocal to store a constant value for entire
application? why not a static variable or store into web application
context , by example ?
Thanks
2011/11/23 Christopher Schultz :
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> All,
>
> I've got a servle
> From: Christopher Schultz [mailto:ch...@christopherschultz.net]
> Subject: Babysitting ThreadLocals
> Removing the ThreadLocal after every request of course means
> that the use of ThreadLocal is entirely useless.
> Should I stop worrying about the overhead of creating a
>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
All,
I've got a servlet that needs to log every request (potentially big
requests) to files on the disk. In order to do that in a
reasonably-tidy way, we write each file into a directory with the
current date in the path, something like this:
.../log
19 matches
Mail list logo