futures: api cleanup
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/83c10649 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/83c10649 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/83c10649 Branch: refs/heads/ignite-51 Commit: 83c10649c5a72d1075b67e9cc7f2feddfe19b831 Parents: 86cf5e3 Author: Yakov Zhdanov <yzhda...@gridgain.com> Authored: Thu Mar 5 18:16:15 2015 +0300 Committer: Yakov Zhdanov <yzhda...@gridgain.com> Committed: Thu Mar 5 18:16:15 2015 +0300 ---------------------------------------------------------------------- .../util/future/GridFutureAdapterSelfTest.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/83c10649/modules/core/src/test/java/org/apache/ignite/internal/util/future/GridFutureAdapterSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/future/GridFutureAdapterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/future/GridFutureAdapterSelfTest.java index 34e55f9..92df7b2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/future/GridFutureAdapterSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/future/GridFutureAdapterSelfTest.java @@ -182,14 +182,10 @@ public class GridFutureAdapterSelfTest extends GridCommonAbstractTest { final Thread runThread = Thread.currentThread(); - final AtomicReference<Exception> err = new AtomicReference<>(); - for (int i = 0; i < lsnrCnt; i++) { fut.listen(new CI1<IgniteInternalFuture<String>>() { @Override public void apply(IgniteInternalFuture<String> t) { - if (Thread.currentThread() == runThread) - err.compareAndSet(null, new Exception("Wrong notification thread: " + - Thread.currentThread())); + assert Thread.currentThread() == runThread; latch.countDown(); } @@ -200,26 +196,19 @@ public class GridFutureAdapterSelfTest extends GridCommonAbstractTest { latch.await(); - if (err.get() != null) - throw err.get(); - final CountDownLatch doneLatch = new CountDownLatch(1); - err.set(null); - fut.listen(new CI1<IgniteInternalFuture<String>>() { @Override public void apply(IgniteInternalFuture<String> t) { - if (Thread.currentThread() == runThread) - err.compareAndSet(null, new Exception("Wrong notification thread: " + Thread.currentThread())); + assert Thread.currentThread() == runThread; doneLatch.countDown(); } }); - doneLatch.await(); + assert doneLatch.getCount() == 0; - if (err.get() != null) - throw err.get(); + doneLatch.await(); } finally { ctx.stop(false);