ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [25/29] incubator-ignite git commit: # sprint-1 Fixed future API.
Date Thu, 05 Feb 2015 06:33:23 GMT
# sprint-1 Fixed future API.


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

Branch: refs/heads/ignite-6
Commit: 857c5259afd8583cef31ee03a07f8d1d637b9661
Parents: 822deaa
Author: Dmitiry Setrakyan <dsetrakyan@gridgain.com>
Authored: Wed Feb 4 18:03:13 2015 -0800
Committer: Dmitiry Setrakyan <dsetrakyan@gridgain.com>
Committed: Wed Feb 4 18:03:13 2015 -0800

----------------------------------------------------------------------
 .../internal/util/future/IgniteFutureImpl.java      |  9 ++++-----
 .../java/org/apache/ignite/lang/IgniteFuture.java   | 12 +++++-------
 .../internal/util/future/IgniteFutureImplTest.java  |  3 ++-
 .../processors/schedule/ScheduleFutureImpl.java     | 16 ++++++++--------
 4 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/857c5259/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java
index ddf9e2d..5dde21a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java
@@ -97,11 +97,10 @@ public class IgniteFutureImpl<V> implements IgniteFuture<V>
{
     }
 
     /** {@inheritDoc} */
-    @Override public void stopListenAsync(IgniteInClosure<? super IgniteFuture<V>>...
lsnrs) {
-        for (IgniteInClosure<? super IgniteFuture<V>> lsnr : lsnrs) {
-            if (lsnr != null)
-                fut.stopListenAsync(new InternalFutureListener(lsnr));
-        }
+    @Override public void stopListenAsync(IgniteInClosure<? super IgniteFuture<V>>
lsnr) {
+        A.notNull(lsnr, "lsnr");
+
+        fut.stopListenAsync(new InternalFutureListener(lsnr));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/857c5259/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
index 9f9e724..b93b33f 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
@@ -52,7 +52,7 @@ public interface IgniteFuture<V> extends Future<V> {
      * @throws IgniteFutureTimeoutException Subclass of {@link IgniteException} thrown if
the wait was timed out.
      * @throws IgniteException If computation failed.
      */
-    public V get(long timeout)throws IgniteException;
+    public V get(long timeout) throws IgniteException;
 
     /**
      * Synchronously waits for completion of the computation for
@@ -154,15 +154,14 @@ public interface IgniteFuture<V> extends Future<V> {
      *
      * @param lsnr Listener closure to register. If not provided - this method is no-op.
      */
-    public void listenAsync(@Nullable IgniteInClosure<? super IgniteFuture<V>>
lsnr);
+    public void listenAsync(IgniteInClosure<? super IgniteFuture<V>> lsnr);
 
     /**
-     * Removes given listeners from the future. If no listener is passed in, then all listeners
-     * will be removed.
+     * Removes given listener from the future.
      *
-     * @param lsnr Listeners to remove.
+     * @param lsnr Listener to remove.
      */
-    public void stopListenAsync(@Nullable IgniteInClosure<? super IgniteFuture<V>>...
lsnr);
+    public void stopListenAsync(IgniteInClosure<? super IgniteFuture<V>> lsnr);
 
     /**
      * Make a chained future to convert result of this future (when complete) into a new
format.
@@ -172,5 +171,4 @@ public interface IgniteFuture<V> extends Future<V> {
      * @return Chained future that finishes after this future completes and done callback
is called.
      */
     public <T> IgniteFuture<T> chain(IgniteClosure<? super IgniteFuture<V>,
T> doneCb);
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/857c5259/modules/core/src/test/java/org/apache/ignite/internal/util/future/IgniteFutureImplTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/future/IgniteFutureImplTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/util/future/IgniteFutureImplTest.java
index 66a6e64..d57ed8e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/future/IgniteFutureImplTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/future/IgniteFutureImplTest.java
@@ -237,7 +237,8 @@ public class IgniteFutureImplTest extends GridCommonAbstractTest {
             fut.listenAsync(lsnr1);
             fut.listenAsync(lsnr2);
 
-            fut.stopListenAsync(lsnr2, lsnr1);
+            fut.stopListenAsync(lsnr2);
+            fut.stopListenAsync(lsnr1);
 
             fut0.onDone("test");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/857c5259/modules/schedule/src/main/java/org/apache/ignite/internal/processors/schedule/ScheduleFutureImpl.java
----------------------------------------------------------------------
diff --git a/modules/schedule/src/main/java/org/apache/ignite/internal/processors/schedule/ScheduleFutureImpl.java
b/modules/schedule/src/main/java/org/apache/ignite/internal/processors/schedule/ScheduleFutureImpl.java
index aefca70..67531b4 100644
--- a/modules/schedule/src/main/java/org/apache/ignite/internal/processors/schedule/ScheduleFutureImpl.java
+++ b/modules/schedule/src/main/java/org/apache/ignite/internal/processors/schedule/ScheduleFutureImpl.java
@@ -77,8 +77,7 @@ class ScheduleFutureImpl<R> implements SchedulerFuture<R>, Externalizable
{
     private final AtomicBoolean descheduled = new AtomicBoolean(false);
 
     /** Listeners. */
-    private Collection<IgniteInClosure<? super IgniteFuture<R>>> lsnrs
=
-        new ArrayList<>(1);
+    private Collection<IgniteInClosure<? super IgniteFuture<R>>> lsnrs
= new ArrayList<>(1);
 
     /** Statistics. */
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
@@ -613,11 +612,12 @@ class ScheduleFutureImpl<R> implements SchedulerFuture<R>,
Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public void stopListenAsync(@Nullable IgniteInClosure<? super IgniteFuture<R>>...
lsnr) {
-        if (!F.isEmpty(lsnr))
-            synchronized (mux) {
-                lsnrs.removeAll(F.asList(lsnr));
-            }
+    @Override public void stopListenAsync(@Nullable IgniteInClosure<? super IgniteFuture<R>>
lsnr) {
+        A.notNull(lsnr, "lsnr");
+
+        synchronized (mux) {
+            lsnrs.remove(lsnr);
+        }
     }
 
     /** {@inheritDoc} */
@@ -972,7 +972,7 @@ class ScheduleFutureImpl<R> implements SchedulerFuture<R>,
Externalizable {
         }
 
         /** {@inheritDoc} */
-        @Override public void stopListenAsync(@Nullable IgniteInClosure<? super IgniteFuture<R>>...
lsnr) {
+        @Override public void stopListenAsync(@Nullable IgniteInClosure<? super IgniteFuture<R>>
lsnr) {
             ref.stopListenAsync(lsnr);
         }
 


Mime
View raw message