Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 42721 invoked from network); 4 Aug 2010 14:48:29 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Aug 2010 14:48:29 -0000 Received: (qmail 97463 invoked by uid 500); 4 Aug 2010 14:48:29 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 97383 invoked by uid 500); 4 Aug 2010 14:48:28 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 97375 invoked by uid 99); 4 Aug 2010 14:48:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Aug 2010 14:48:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Aug 2010 14:48:25 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BE71423889BF; Wed, 4 Aug 2010 14:47:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r982270 - in /jackrabbit/branches/2.0: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveVersionTest.java Date: Wed, 04 Aug 2010 14:47:07 -0000 To: commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100804144707.BE71423889BF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Wed Aug 4 14:47:07 2010 New Revision: 982270 URL: http://svn.apache.org/viewvc?rev=982270&view=rev Log: 2.0: Merged revision 982266 (JCR-2613) Added: jackrabbit/branches/2.0/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveVersionTest.java - copied unchanged from r982266, jackrabbit/branches/2.1/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveVersionTest.java Modified: jackrabbit/branches/2.0/ (props changed) jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java Propchange: jackrabbit/branches/2.0/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Aug 4 14:47:07 2010 @@ -1,6 +1,6 @@ /jackrabbit/branches/1.5:794012,794100,794102 -/jackrabbit/branches/2.1:955314 +/jackrabbit/branches/2.1:955314,982266 /jackrabbit/sandbox/JCR-1456:774917-886178 /jackrabbit/sandbox/JCR-2170:812417-816332 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863 -/jackrabbit/trunk:891595,891629,892253,892263,894150-894151,896408,896513,896532,896857,896870,896876,896908,896940,896942-896943,896969,896977,897071,897836,897842,897858,897935,897983,897992-897993,897996,898002,898042,898267,898325,898540,898677,898699,898701,898715,898872,899102,899181,899391,899393-899394,899583,899594,899643,900305,900310,900314,900453,900702,900736,900762-900763,900767,900782,901095,901122,901139,901144,901170,901176,901191,901193,901196,901216,901228,901285,902058,902062,926324,928888,955307 +/jackrabbit/trunk:891595,891629,892253,892263,894150-894151,896408,896513,896532,896857,896870,896876,896908,896940,896942-896943,896969,896977,897071,897836,897842,897858,897935,897983,897992-897993,897996,898002,898042,898267,898325,898540,898677,898699,898701,898715,898872,899102,899181,899391,899393-899394,899583,899594,899643,900305,900310,900314,900453,900702,900736,900762-900763,900767,900782,901095,901122,901139,901144,901170,901176,901191,901193,901196,901216,901228,901285,902058,902062,926324,928888,936668,955307 Modified: jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=982270&r1=982269&r2=982270&view=diff ============================================================================== --- jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java (original) +++ jackrabbit/branches/2.0/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java Wed Aug 4 14:47:07 2010 @@ -288,6 +288,34 @@ class InternalVersionHistoryImpl extends * {@inheritDoc} */ public InternalVersion getVersion(NodeId id) { + InternalVersion v = getCachedVersion(id); + + // If the version was not found, our cache may not have been + // synchronized with updates from another cluster node. Reload the history + // to be sure we have the latest updates and try again. + if (v == null) { + try { + reload(); + } catch (RepositoryException e) { + + // We should add the checked exception to this method definition + // so we don't need to wrap it. + // Avoiding it for now to limit impact of this fix. + throw new RuntimeException(e); + } + v = getCachedVersion(id); + } + + return v; + } + + /** + * Returns the version from cache, or null if it is not + * present. + * @param id the id of the version + * @return the version or null if not cached. + */ + private synchronized InternalVersion getCachedVersion(NodeId id) { InternalVersion v = versionCache.get(id); if (v == null) { for (Name versionName : nameCache.keySet()) { @@ -413,6 +441,8 @@ class InternalVersionHistoryImpl extends parentNode.removeNode(node.getName()); // store changes for this node and his children parentNode.store(); + } else { + node.store(); } } else { log.debug("Current version history has at least one reference"); @@ -435,7 +465,7 @@ class InternalVersionHistoryImpl extends * or null of the label was not moved. * * @param versionName the name of the version - * @param label the label to assgign + * @param label the label to assign * @param move flag what to do by collisions * @return the version that was previously assigned by this label or null. * @throws VersionException if the version does not exist or if the label is already defined.