cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r643293 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java
Date Tue, 01 Apr 2008 06:17:37 GMT
Author: joerg
Date: Mon Mar 31 23:17:35 2008
New Revision: 643293

URL: http://svn.apache.org/viewvc?rev=643293&view=rev
Log:
fix threading issue (DateFormat is not thread-safe)

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java?rev=643293&r1=643292&r2=643293&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java
Mon Mar 31 23:17:35 2008
@@ -50,7 +50,9 @@
     }
 
     public String getLastAccessTime() {
-        return formatter.format(new Date(wc.getLastAccessTime()));
+        synchronized (this.formatter) {
+            return formatter.format(new Date(wc.getLastAccessTime()));
+        }
     }
 
     public String getInterpreterId() {
@@ -66,17 +68,17 @@
     }
 
     public String getExpireTime() {
-        return formatter.format(new Date(wc.getLastAccessTime()
-                + wc.getTimeToLive()));
+        Date date = new Date(wc.getLastAccessTime() + wc.getTimeToLive());
+        synchronized (this.formatter) {
+            return formatter.format(date);
+        }
     }
 
     public String hasExpired() {
-        if ((wc.getLastAccessTime() + wc.getTimeToLive()) < System
-                .currentTimeMillis()) {
+        if (wc.hasExpired()) {
             return HAS_EXPIRED_YES;
         }
         return HAS_EXPIRED_NO;
-
     }
 
     public String getType() {



Mime
View raw message