ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [10/14] ignite git commit: IGNITE-3343: fixed by review results: avoided list copying.
Date Tue, 02 Aug 2016 07:41:33 GMT
IGNITE-3343: fixed by review results: avoided list copying.


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

Branch: refs/heads/ignite-3343
Commit: 461f1063df5f93baceebc927e3e8cef9b7894e24
Parents: af2e9dc
Author: iveselovskiy <iveselovskiy@gridgain.com>
Authored: Thu Jul 28 16:28:29 2016 +0300
Committer: iveselovskiy <iveselovskiy@gridgain.com>
Committed: Thu Jul 28 16:28:29 2016 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/processors/igfs/IgfsImpl.java  |  3 ++-
 .../ignite/internal/processors/igfs/IgfsModeResolver.java | 10 +++++-----
 .../apache/ignite/internal/processors/igfs/IgfsPaths.java |  6 +++---
 .../apache/ignite/internal/processors/igfs/IgfsUtils.java |  2 --
 .../processors/igfs/IgfsModeResolverSelfTest.java         |  6 ++++--
 5 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/461f1063/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index a170151..73bf279 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.igfs;
 
+import java.util.Set;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
@@ -841,7 +842,7 @@ public final class IgfsImpl implements IgfsEx {
 
                 IgfsMode mode = resolveMode(path);
 
-                Collection<IgfsFile> files = new HashSet<>();
+                Set<IgfsFile> files = new HashSet<>();
 
                 if (IgfsUtils.isDualMode(mode)) {
                     assert secondaryFs != null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/461f1063/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
index 978c725..33b835f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolver.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.processors.igfs;
 
-import java.util.Collections;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -54,7 +54,7 @@ public class IgfsModeResolver {
      * @param dfltMode Default IGFS mode.
      * @param modes List of configured modes. The order is significant as modes are added
in order of occurrence.
      */
-    public IgfsModeResolver(IgfsMode dfltMode, @Nullable List<T2<IgfsPath, IgfsMode>>
modes)
+    public IgfsModeResolver(IgfsMode dfltMode, @Nullable ArrayList<T2<IgfsPath, IgfsMode>>
modes)
             throws IgniteCheckedException {
         assert dfltMode != null;
 
@@ -103,11 +103,11 @@ public class IgfsModeResolver {
     }
 
     /**
-     * @return Unmodifiable copy of properly ordered modes prefixes
+     * @return Copy of properly ordered modes prefixes
      *  or {@code null} if no modes set.
      */
-    @Nullable public List<T2<IgfsPath, IgfsMode>> modesOrdered() {
-        return modes != null ? Collections.unmodifiableList(modes) : null;
+    @Nullable public ArrayList<T2<IgfsPath, IgfsMode>> modesOrdered() {
+        return modes != null ? new ArrayList<>(modes) : null;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/461f1063/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
index 4a79259..2bdb23b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
@@ -48,7 +48,7 @@ public class IgfsPaths implements Externalizable {
     private IgfsMode dfltMode;
 
     /** Path modes. */
-    private List<T2<IgfsPath, IgfsMode>> pathModes;
+    private ArrayList<T2<IgfsPath, IgfsMode>> pathModes;
 
     /**
      * Empty constructor required by {@link Externalizable}.
@@ -65,7 +65,7 @@ public class IgfsPaths implements Externalizable {
      * @param pathModes Path modes.
      * @throws IgniteCheckedException If failed.
      */
-    public IgfsPaths(Object payload, IgfsMode dfltMode, @Nullable List<T2<IgfsPath,
IgfsMode>> pathModes)
+    public IgfsPaths(Object payload, IgfsMode dfltMode, @Nullable ArrayList<T2<IgfsPath,
IgfsMode>> pathModes)
         throws IgniteCheckedException {
         this.dfltMode = dfltMode;
         this.pathModes = pathModes;
@@ -91,7 +91,7 @@ public class IgfsPaths implements Externalizable {
     /**
      * @return Path modes.
      */
-    @Nullable public List<T2<IgfsPath, IgfsMode>> pathModes() {
+    @Nullable public ArrayList<T2<IgfsPath, IgfsMode>> pathModes() {
         return pathModes;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/461f1063/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index c582b2e..b9788f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -831,8 +831,6 @@ public class IgfsUtils {
         if (modes == null)
             return null;
 
-        modes = new ArrayList<>(modes); // modes collection may be immutable.
-
         // Sort by depth, shallow first.
         Collections.sort(modes, new Comparator<Map.Entry<IgfsPath, IgfsMode>>()
{
             @Override public int compare(Map.Entry<IgfsPath, IgfsMode> o1, Map.Entry<IgfsPath,
IgfsMode> o2) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/461f1063/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
index 5117edb..bd7e413 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModeResolverSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.igfs;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
@@ -40,8 +41,9 @@ public class IgfsModeResolverSelfTest extends TestCase {
 
     /** {@inheritDoc} */
     @Override protected void setUp() throws Exception {
-        reslvr = new IgfsModeResolver(DUAL_SYNC, Arrays.asList(new T2<>(new IgfsPath("/a/b/c/d"),
PROXY), new T2<>
-            (new IgfsPath("/a/P/"), PRIMARY), new T2<>(new IgfsPath("/a/b/"), DUAL_ASYNC)));
+        reslvr = new IgfsModeResolver(DUAL_SYNC, new ArrayList<>(Arrays.asList(new
T2<>(
+            new IgfsPath("/a/b/c/d"), PROXY), new T2<>(new IgfsPath("/a/P/"), PRIMARY),
new T2<>(new IgfsPath("/a/b/"),
+            DUAL_ASYNC))));
     }
 
     /**


Mime
View raw message