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

2008-04-01 Thread Vadim Gritsenko

On Apr 1, 2008, at 2:17 AM, [EMAIL PROTECTED] 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

2008-04-01 Thread Joerg Heinicke

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