You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Vadim Gritsenko <va...@reverycodes.com> on 2008/04/01 14:02:17 UTC

Re: svn commit: r643293 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java

On Apr 1, 2008, at 2:17 AM, joerg@apache.org wrote:
> fix threading issue (DateFormat is not thread-safe)
>
>     public String getLastAccessTime() {
> -        return formatter.format(new Date(wc.getLastAccessTime()));
> +        synchronized (this.formatter) {
> +            return formatter.format(new  
> Date(wc.getLastAccessTime()));
> +        }
>     }

The better fix is to use FastDateFormat which features thread safe  
formatting.

Vadim

Re: svn commit: r643293 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java

Posted by Joerg Heinicke <jo...@gmx.de>.
On 01.04.2008 08:02, Vadim Gritsenko wrote:

>> fix threading issue (DateFormat is not thread-safe)
>>
>>     public String getLastAccessTime() {
>> -        return formatter.format(new Date(wc.getLastAccessTime()));
>> +        synchronized (this.formatter) {
>> +            return formatter.format(new Date(wc.getLastAccessTime()));
>> +        }
>>     }
> 
> The better fix is to use FastDateFormat which features thread safe 
> formatting.

All these nice little gems hidden in Apache Commons libs :)

Applied.

Thanks,

Joerg