jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r650308 - in /jackrabbit/branches/1.4/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java test/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImplTest.java
Date Mon, 21 Apr 2008 22:50:41 GMT
Author: jukka
Date: Mon Apr 21 15:50:35 2008
New Revision: 650308

URL: http://svn.apache.org/viewvc?rev=650308&view=rev
Log:
1.4: Reverted revision 650301 as discussed with Tobias (JCR-1463)

Removed:
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImplTest.java
Modified:
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=650308&r1=650307&r2=650308&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
Mon Apr 21 15:50:35 2008
@@ -52,11 +52,6 @@
     private static Logger log = LoggerFactory.getLogger(InternalVersionHistory.class);
 
     /**
-     * The last current time that was returned by {@link #getCurrentTime()}.
-     */
-    private static final Calendar CURRENT_TIME = Calendar.getInstance();
-
-    /**
      * the cache of the version labels
      * key = version label (String)
      * value = version name
@@ -167,8 +162,8 @@
         if (rootVersion.getSuccessors().length==0) {		
             Iterator iter = nameCache.keySet().iterator();
             while (iter.hasNext()) {
-                Name versionName = (Name) iter.next();
-                InternalVersionImpl v = createVersionInstance(versionName);
+                Name versionName = (Name)iter.next();
+                InternalVersionImpl v = (InternalVersionImpl)createVersionInstance(versionName);
                 v.legacyResolveSuccessors();
             }
         }
@@ -485,7 +480,7 @@
         NodeStateEx vNode = node.addNode(name, NameConstants.NT_VERSION, versionId, true);
 
         // initialize 'created', 'predecessors' and 'successors'
-        vNode.setPropertyValue(NameConstants.JCR_CREATED, InternalValue.create(getCurrentTime()));
+        vNode.setPropertyValue(NameConstants.JCR_CREATED, InternalValue.create(Calendar.getInstance()));
         vNode.setPropertyValues(NameConstants.JCR_PREDECESSORS, PropertyType.REFERENCE, predecessors);
         vNode.setPropertyValues(NameConstants.JCR_SUCCESSORS, PropertyType.REFERENCE, InternalValue.EMPTY_ARRAY);
 
@@ -538,7 +533,7 @@
         NodeStateEx vNode = pNode.addNode(NameConstants.JCR_ROOTVERSION, NameConstants.NT_VERSION,
versionId, true);
 
         // initialize 'created' and 'predecessors'
-        vNode.setPropertyValue(NameConstants.JCR_CREATED, InternalValue.create(getCurrentTime()));
+        vNode.setPropertyValue(NameConstants.JCR_CREATED, InternalValue.create(Calendar.getInstance()));
         vNode.setPropertyValues(NameConstants.JCR_PREDECESSORS, PropertyType.REFERENCE, InternalValue.EMPTY_ARRAY);
         vNode.setPropertyValues(NameConstants.JCR_SUCCESSORS, PropertyType.REFERENCE, InternalValue.EMPTY_ARRAY);
 
@@ -562,25 +557,5 @@
 
         parent.store();
         return new InternalVersionHistoryImpl(vMgr, pNode);
-    }
-
-    /**
-     * Returns the current time as a calendar instance and makes sure that no
-     * two Calendar instances represent the exact same time. If this method is
-     * called quickly in succession each Calendar instance returned is at least
-     * one millisecond later than the previous one.
-     *
-     * @return the current time.
-     */
-    static Calendar getCurrentTime() {
-        long time = System.currentTimeMillis();
-        synchronized (CURRENT_TIME) {
-            if (time > CURRENT_TIME.getTimeInMillis()) {
-                CURRENT_TIME.setTimeInMillis(time);
-            } else {
-                CURRENT_TIME.add(Calendar.MILLISECOND, 1);
-            }
-            return (Calendar) CURRENT_TIME.clone();
-        }
     }
 }



Mime
View raw message