ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [5/6] ignite git commit: MInors.
Date Tue, 09 Aug 2016 07:45:47 GMT
MInors.


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

Branch: refs/heads/ignite-2545
Commit: a01391c8cc8828666424c667638310ad4fcd0d16
Parents: 5fb0a54
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Tue Aug 9 10:43:37 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Aug 9 10:43:37 2016 +0300

----------------------------------------------------------------------
 .../util/future/GridCompoundFuture.java         | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a01391c8/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
index 941d88b..80fac56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
@@ -284,27 +284,27 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R>
implements Ig
      * @param idx - index index of the element to return
      * @return Future.
      */
+    @SuppressWarnings("unchecked")
     protected IgniteInternalFuture<T> future(int idx) {
         assert idx >= 0;
+        assert idx < futuresCount();
+        assert futs != null;
 
-        Object futs0 = futs;
-
-        if (futs0 == null)
-            throw new IndexOutOfBoundsException("Index: " + idx + ", Size: 0");
+        assert Thread.holdsLock(sync);
 
-        if (futs0 instanceof IgniteInternalFuture) {
-            if (idx > 0)
-                throw new IndexOutOfBoundsException("Index: " + idx + ", Size: 1");
+        if (futs instanceof IgniteInternalFuture) {
+            assert idx == 0;
 
-            return (IgniteInternalFuture<T>)futs0;
+            return (IgniteInternalFuture<T>)futs;
         }
-
-        return ((List<IgniteInternalFuture<T>>)futs0).get(idx);
+        else
+            return ((List<IgniteInternalFuture>)futs).get(idx);
     }
 
     /**
      * @return Futures size.
      */
+    @SuppressWarnings("unchecked")
     protected int futuresCount() {
         synchronized (sync) {
             if (futs==null)
@@ -313,7 +313,7 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R>
implements Ig
             if (futs instanceof IgniteInternalFuture)
                 return 1;
 
-            return ((Collection<IgniteInternalFuture<T>>)futs).size();
+            return ((Collection<IgniteInternalFuture>)futs).size();
         }
     }
 


Mime
View raw message