jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1325709 - in /jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk: model/ChildNodeEntriesMap.java model/ChildNodeEntriesTree.java persistence/MongoPersistence.java persistence/Persistence.java
Date Fri, 13 Apr 2012 10:22:33 GMT
Author: stefan
Date: Fri Apr 13 10:22:33 2012
New Revision: 1325709

URL: http://svn.apache.org/viewvc?rev=1325709&view=rev
Log:
minor optimizations and javadoc

Modified:
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/MongoPersistence.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/Persistence.java

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java?rev=1325709&r1=1325708&r2=1325709&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
Fri Apr 13 10:22:33 2012
@@ -158,10 +158,6 @@ public class ChildNodeEntriesMap impleme
 
     @Override
     public Iterator<ChildNode> getAdded(final ChildNodeEntries other) {
-        if (equals(other)) {
-            return EMPTY.iterator();            
-        }
-        
         return new AbstractFilteringIterator<ChildNode>(other.getEntries(0, -1)) {
             @Override
             protected boolean include(ChildNode entry) {
@@ -172,10 +168,6 @@ public class ChildNodeEntriesMap impleme
 
     @Override
     public Iterator<ChildNode> getRemoved(final ChildNodeEntries other) {
-        if (equals(other)) {
-            return EMPTY.iterator();
-        }
-
         return new AbstractFilteringIterator<ChildNode>(entries.values().iterator())
{
             @Override
             protected boolean include(ChildNode entry) {
@@ -186,9 +178,6 @@ public class ChildNodeEntriesMap impleme
 
     @Override
     public Iterator<ChildNode> getModified(final ChildNodeEntries other) {
-        if (equals(other)) {
-            return EMPTY.iterator();
-        }
         return new AbstractFilteringIterator<ChildNode>(getEntries(0, -1)) {
             @Override
             protected boolean include(ChildNode entry) {

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java?rev=1325709&r1=1325708&r2=1325709&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
Fri Apr 13 10:22:33 2012
@@ -290,10 +290,6 @@ public class ChildNodeEntriesTree implem
 
     @Override
     public Iterator<ChildNode> getAdded(final ChildNodeEntries other) {
-        if (equals(other)) {
-            return EMPTY.iterator();
-        }
-
         if (other instanceof ChildNodeEntriesTree) {
             List<ChildNode> added = new ArrayList<ChildNode>();
             ChildNodeEntriesTree otherEntries = (ChildNodeEntriesTree) other;
@@ -367,10 +363,6 @@ public class ChildNodeEntriesTree implem
 
     @Override
     public Iterator<ChildNode> getRemoved(final ChildNodeEntries other) {
-        if (equals(other)) {
-            return EMPTY.iterator();
-        }
-
         if (other instanceof ChildNodeEntriesTree) {
             List<ChildNode> removed = new ArrayList<ChildNode>();
             ChildNodeEntriesTree otherEntries = (ChildNodeEntriesTree) other;
@@ -444,10 +436,6 @@ public class ChildNodeEntriesTree implem
 
     @Override
     public Iterator<ChildNode> getModified(final ChildNodeEntries other) {
-        if (equals(other)) {
-            return EMPTY.iterator();
-        }
-
         if (other instanceof ChildNodeEntriesTree) {
             List<ChildNode> modified = new ArrayList<ChildNode>();
             ChildNodeEntriesTree otherEntries = (ChildNodeEntriesTree) other;

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/MongoPersistence.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/MongoPersistence.java?rev=1325709&r1=1325708&r2=1325709&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/MongoPersistence.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/MongoPersistence.java
Fri Apr 13 10:22:33 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.mk.persistence;
 
+import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.Closeable;
@@ -258,12 +259,9 @@ public class MongoPersistence implements
             File file = new File(tempFilePath);
             InputStream in = null;
             try {
-                in = new FileInputStream(file);
+                in = new BufferedInputStream(new FileInputStream(file));
                 return writeBlob(in);
             } finally {
-                if (in != null) {
-                    in.close();
-                }
                 file.delete();
             }
         } catch (Exception e) {
@@ -276,6 +274,8 @@ public class MongoPersistence implements
         //f.save(0x20000);   // save in 128k chunks
         f.save();
 
+        IOUtils.closeQuietly(in);
+
         return f.getId().toString();
     }
 
@@ -286,7 +286,8 @@ public class MongoPersistence implements
         if (f == null) {
             throw new NotFoundException(blobId);
         }
-        // todo provide a more efficient implementation
+        // todo provide a more efficient implementation (gridfs stores the data in chunks)
+        //long nChunk = pos / f.getChunkSize();
         InputStream in = f.getInputStream();
         try {
             in.skip(pos);

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/Persistence.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/Persistence.java?rev=1325709&r1=1325708&r2=1325709&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/Persistence.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/persistence/Persistence.java
Fri Apr 13 10:22:33 2012
@@ -52,7 +52,7 @@ public interface Persistence {
     StoredCommit readCommit(Id id) throws NotFoundException, Exception;
 
     /**
-     * Persist a commit, with an id that is selected by the caller.
+     * Persist a commit with an id provided by the caller.
      * 
      * @param id commit id
      * @param commit commit



Mime
View raw message