You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/09/28 02:26:47 UTC

[07/18] ignite git commit: IGNITE-3639: IGFS: Removed BufferedOutputStream from LocalIgfsSecondaryFileSystem because it doesn't give any performance benefit.

IGNITE-3639: IGFS: Removed BufferedOutputStream from LocalIgfsSecondaryFileSystem because it doesn't give any performance benefit.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/39fc5477
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/39fc5477
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/39fc5477

Branch: refs/heads/master
Commit: 39fc5477c19cbe2b2116aaf575a2d0a9c9a618b1
Parents: c2a3f11
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Sep 27 14:48:18 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 27 14:48:18 2016 +0300

----------------------------------------------------------------------
 .../local/LocalIgfsSecondaryFileSystem.java      | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/39fc5477/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
index 8dd4fda..1775db6 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
@@ -34,7 +34,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lifecycle.LifecycleAware;
 import org.jetbrains.annotations.Nullable;
 
-import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -53,9 +52,6 @@ import java.util.Map;
  * Secondary file system which delegates to local file system.
  */
 public class LocalIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem, LifecycleAware {
-    /** Default buffer size. */
-    private static final int DFLT_BUF_SIZE = 8 * 1024;
-
     /** Path that will be added to each passed path. */
     private String workDir;
 
@@ -256,13 +252,13 @@ public class LocalIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem, Li
 
     /** {@inheritDoc} */
     @Override public OutputStream create(IgfsPath path, boolean overwrite) {
-        return create0(path, overwrite, DFLT_BUF_SIZE);
+        return create0(path, overwrite);
     }
 
     /** {@inheritDoc} */
     @Override public OutputStream create(IgfsPath path, int bufSize, boolean overwrite, int replication,
         long blockSize, @Nullable Map<String, String> props) {
-        return create0(path, overwrite, bufSize);
+        return create0(path, overwrite);
     }
 
     /** {@inheritDoc} */
@@ -274,10 +270,10 @@ public class LocalIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem, Li
             boolean exists = file.exists();
 
             if (exists)
-                return new BufferedOutputStream(new FileOutputStream(file, true), bufSize);
+                return new FileOutputStream(file, true);
             else {
                 if (create)
-                    return create0(path, false, bufSize);
+                    return create0(path, false);
                 else
                     throw new IgfsPathNotFoundException("Failed to append to file because it doesn't exist: " + path);
             }
@@ -389,11 +385,10 @@ public class LocalIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem, Li
      * Internal create routine.
      *
      * @param path Path.
-     * @param overwrite Overwirte flag.
-     * @param bufSize Buffer size.
+     * @param overwrite Overwrite flag.
      * @return Output stream.
      */
-    private OutputStream create0(IgfsPath path, boolean overwrite, int bufSize) {
+    private OutputStream create0(IgfsPath path, boolean overwrite) {
         File file = fileForPath(path);
 
         boolean exists = file.exists();
@@ -411,7 +406,7 @@ public class LocalIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem, Li
         }
 
         try {
-            return new BufferedOutputStream(new FileOutputStream(file), bufSize);
+            return new FileOutputStream(file);
         }
         catch (IOException e) {
             throw handleSecondaryFsError(e, "Failed to create file [path=" + path + ", overwrite=" + overwrite + ']');