jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r927406 - in /jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex: BinaryPartSource.java QValueFactoryImpl.java ValueLoader.java
Date Thu, 25 Mar 2010 14:01:52 GMT
Author: tripod
Date: Thu Mar 25 14:01:52 2010
New Revision: 927406

URL: http://svn.apache.org/viewvc?rev=927406&view=rev
Log:
JCR-2582 spi2dav: temp files are not clean up after batch submit

Modified:
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/BinaryPartSource.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/BinaryPartSource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/BinaryPartSource.java?rev=927406&r1=927405&r2=927406&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/BinaryPartSource.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/BinaryPartSource.java
Thu Mar 25 14:01:52 2010
@@ -55,6 +55,8 @@ public class BinaryPartSource implements
     }
 
     public void dispose() {
-        value.discard();
+        if (value instanceof ValueLoader.Target) {
+            ((ValueLoader.Target) value).reset();
+        }
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java?rev=927406&r1=927405&r2=927406&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
Thu Mar 25 14:01:52 2010
@@ -316,9 +316,33 @@ class QValueFactoryImpl extends org.apac
             if (file != null) {
                 // this instance is backed by a temp file
                 file.delete();
+            } else if (buffer != null) {
+                // this instance is backed by an in-memory buffer
+                buffer = EMPTY_BYTE_ARRAY;
+            }
+        }
+
+        /**
+         * Resets the state of this value. a subsequent call to init() can be
+         * used to load the binary again.
+         *
+         * If this <code>BinaryQValue</code> is backed by a persistent resource
+         * calling this method will have no effect.
+         * @see QValue#discard()
+         */
+        public void reset() {
+            if (!temp) {
+                // do nothing if this instance is not backed by temporarily
+                // allocated resource/buffer
+                return;
+            }
+            if (file != null) {
+                // this instance is backed by a temp file
+                file.delete();
             }
             file = null;
             buffer = null;
+            initialized = false;
         }
 
         //-----------------------------------------------< java.lang.Object >---

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java?rev=927406&r1=927405&r2=927406&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java
Thu Mar 25 14:01:52 2010
@@ -102,5 +102,11 @@ class ValueLoader {
          * @throws IOException
          */
         void setStream(InputStream in) throws IOException;
+
+        /**
+         * Resets (clears) the state and this target is in the state as
+         * prior to setStream()
+         */
+        void reset();
     }
 }



Mime
View raw message