Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 30966 invoked from network); 14 Dec 2007 15:28:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Dec 2007 15:28:19 -0000 Received: (qmail 64410 invoked by uid 500); 14 Dec 2007 15:28:08 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 64331 invoked by uid 500); 14 Dec 2007 15:28:07 -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 64322 invoked by uid 99); 14 Dec 2007 15:28:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2007 07:28:07 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2007 15:27:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 090521A9842; Fri, 14 Dec 2007 07:27:44 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r604211 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle: ./ util/ Date: Fri, 14 Dec 2007 15:24:14 -0000 To: commits@jackrabbit.apache.org From: tripod@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071214152746.090521A9842@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tripod Date: Fri Dec 14 07:23:58 2007 New Revision: 604211 URL: http://svn.apache.org/viewvc?rev=604211&view=rev Log: JCR-832 BundleDBPersistenceManager does not free blobStore resources Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java?rev=604211&r1=604210&r2=604211&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java Fri Dec 14 07:23:58 2007 @@ -42,6 +42,7 @@ import org.apache.jackrabbit.core.persistence.bundle.util.BundleCache; import org.apache.jackrabbit.core.persistence.bundle.util.LRUNodeIdCache; import org.apache.jackrabbit.core.persistence.bundle.util.HashMapIndex; +import org.apache.jackrabbit.core.persistence.bundle.util.BundleBinding; import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.name.NameConstants; @@ -392,6 +393,12 @@ protected abstract void store(NodeReferences refs) throws ItemStateException; + /** + * Returns the bundle binding that is used for serializing the bundles. + * @return the bundle binding + */ + protected abstract BundleBinding getBinding(); + //-------------------------------------------------< PersistenceManager >--- /** @@ -536,7 +543,7 @@ while (iter.hasNext()) { ItemState state = (ItemState) iter.next(); if (state.isNode()) { - NodePropBundle bundle = new NodePropBundle((NodeState) state); + NodePropBundle bundle = new NodePropBundle(getBinding(), (NodeState) state); modified.put(state.getId(), bundle); } } @@ -682,6 +689,7 @@ */ private void deleteBundle(NodePropBundle bundle) throws ItemStateException { destroyBundle(bundle); + bundle.removeAllProperties(); bundles.remove(bundle.getId()); missing.put(bundle.getId()); } Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java?rev=604211&r1=604210&r2=604211&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java Fri Dec 14 07:23:58 2007 @@ -580,6 +580,13 @@ } /** + * {@inheritDoc} + */ + protected BundleBinding getBinding() { + return binding; + } + + /** * Creates a suitable blobstore * @return a blobstore * @throws Exception if an unspecified error occurs @@ -1036,8 +1043,6 @@ protected synchronized void destroyBundle(NodePropBundle bundle) throws ItemStateException { try { connectionManager.executeStmt(bundleDeleteSQL, getKey(bundle.getId().getUUID())); - // also delete all - bundle.removeAllProperties(); } catch (Exception e) { if (e instanceof NoSuchItemStateException) { throw (NoSuchItemStateException) e; @@ -1086,13 +1091,13 @@ } /** + * {@inheritDoc} + * * This method uses shared PreparedStatements, which must * be used strictly sequentially. Because this method synchronizes on the * persistence manager instance, there is no need to synchronize on the * shared statement. If the method would not be synchronized, the shared * statement must be synchronized. - * - * @see AbstractPersistenceManager#store(NodeReferences) */ public synchronized void store(NodeReferences refs) throws ItemStateException { if (!initialized) { Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java?rev=604211&r1=604210&r2=604211&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java Fri Dec 14 07:23:58 2007 @@ -212,6 +212,13 @@ /** * {@inheritDoc} */ + protected BundleBinding getBinding() { + return binding; + } + + /** + * {@inheritDoc} + */ public synchronized void close() throws Exception { if (!initialized) { throw new IllegalStateException("not initialized"); Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java?rev=604211&r1=604210&r2=604211&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java Fri Dec 14 07:23:58 2007 @@ -63,6 +63,7 @@ * @param blobStore the blobstore for retrieving blobs * @param nsIndex the namespace index * @param nameIndex the name index + * @param dataStore the data store */ public BundleBinding(ErrorHandling errorHandling, BLOBStore blobStore, StringIndex nsIndex, StringIndex nameIndex, DataStore dataStore) { @@ -80,7 +81,7 @@ public NodePropBundle readBundle(DataInputStream in, NodeId id) throws IOException { - NodePropBundle bundle = new NodePropBundle(id); + NodePropBundle bundle = new NodePropBundle(this, id); // read version and primary type...special handling int index = in.readInt(); Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java?rev=604211&r1=604210&r2=604211&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java Fri Dec 14 07:23:58 2007 @@ -93,6 +93,7 @@ * @param blobStore the blobstore * @param nsIndex the namespace index * @param nameIndex the name index + * @param dataStore the data store */ public ItemStateBinding(ErrorHandling errorHandling, BLOBStore blobStore, @@ -122,6 +123,14 @@ */ public void setMinBlobSize(long minBlobSize) { this.minBlobSize = minBlobSize; + } + + /** + * Returns the blob store that is assosiated with this binding. + * @return the blob store + */ + public BLOBStore getBlobStore() { + return blobStore; } /** Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java?rev=604211&r1=604210&r2=604211&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java Fri Dec 14 07:23:58 2007 @@ -28,6 +28,7 @@ import org.apache.jackrabbit.core.NodeId; import org.apache.jackrabbit.core.PropertyId; import org.apache.jackrabbit.core.persistence.PersistenceManager; +import org.apache.jackrabbit.core.persistence.util.BLOBStore; import org.apache.jackrabbit.core.value.InternalValue; import org.apache.jackrabbit.core.state.PropertyState; import org.apache.jackrabbit.core.state.NodeState; @@ -35,6 +36,8 @@ import org.apache.jackrabbit.core.nodetype.PropDefId; import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.name.NameConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This Class provides a simple structure to hold the nodestate and related @@ -46,6 +49,16 @@ static final String CVS_ID = "$URL$ $Rev$ $Date$"; /** + * default logger + */ + private static Logger log = LoggerFactory.getLogger(NodePropBundle.class); + + /** + * the bundle binding that handles this bundle + */ + private final BundleBinding binding; + + /** * the node id */ private final NodeId id; @@ -102,18 +115,21 @@ /** * Creates a "new" bundle with the given id + * @param binding the bundle binding * @param id the node id */ - public NodePropBundle(NodeId id) { + public NodePropBundle(BundleBinding binding, NodeId id) { + this.binding = binding; this.id = id; } /** * Creates a bundle from the given state + * @param binding the bundle binding * @param state the node state */ - public NodePropBundle(NodeState state) { - this((NodeId) state.getId()); + public NodePropBundle(BundleBinding binding, NodeState state) { + this(binding, (NodeId) state.getId()); update(state); } @@ -346,7 +362,7 @@ public void addProperty(PropertyState state) { PropertyEntry old = (PropertyEntry) properties.put(state.getName(), new PropertyEntry(state)); if (old != null) { - old.destroy(); + old.destroy(binding.getBlobStore()); } } @@ -407,7 +423,7 @@ public void removeProperty(Name name) { PropertyEntry pe = (PropertyEntry) properties.remove(name); if (pe != null) { - pe.destroy(); + pe.destroy(binding.getBlobStore()); } } @@ -678,18 +694,22 @@ /** * Destroys this property state and deletes temporary blob file values. + * @param blobStore the blobstore that will destroy the blobs */ - private void destroy() { - if (type == PropertyType.BINARY) { - // destroy binary property values - for (int i=0; i