Author: rfrovarp
Date: Tue Aug 14 09:25:29 2007
New Revision: 565823
URL: http://svn.apache.org/viewvc?view=rev&rev=565823
Log:
Make sure only one thread is getting to the DateFormat object at a time.
Modified:
lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java
Modified: lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java?view=diff&rev=565823&r1=565822&r2=565823
==============================================================================
--- lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java (original)
+++ lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/cocoon/components/modules/input/WorkflowModule.java Tue Aug 14 09:25:29 2007
@@ -64,8 +64,8 @@
*/
public static final String LAST_DATE_PREFIX = "lastDate.";
- protected final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
+ private final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ private final Object lock = new Object();
static final String[] PARAMETER_NAMES = { STATE };
/**
@@ -121,7 +121,9 @@
String event = name.substring(LAST_DATE_PREFIX.length());
Version latestEventVersion = getLatestVersion(workflowable, event);
if (latestEventVersion != null) {
- value = this.DATE_FORMAT.format(latestEventVersion.getDate());
+ synchronized(lock) {
+ value = this.DATE_FORMAT.format(latestEventVersion.getDate());
+ }
}
} else {
throw new ConfigurationException("The attribute [" + name
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.