Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2FE78200BF0 for ; Fri, 30 Dec 2016 13:08:22 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 2BB6A160B32; Fri, 30 Dec 2016 12:08:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 50A37160B24 for ; Fri, 30 Dec 2016 13:08:21 +0100 (CET) Received: (qmail 94911 invoked by uid 500); 30 Dec 2016 12:08:20 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 94902 invoked by uid 99); 30 Dec 2016 12:08:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Dec 2016 12:08:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6A77FDFC47; Fri, 30 Dec 2016 12:08:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Message-Id: <7a3190a7a0dc4e90b5f8aebc25f4cfa4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: GridCacheContinuousQueryConcurrentTest: code style. Date: Fri, 30 Dec 2016 12:08:20 +0000 (UTC) archived-at: Fri, 30 Dec 2016 12:08:22 -0000 Repository: ignite Updated Branches: refs/heads/ignite-3477 5475bfda2 -> a940fc3ad GridCacheContinuousQueryConcurrentTest: code style. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a940fc3a Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a940fc3a Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a940fc3a Branch: refs/heads/ignite-3477 Commit: a940fc3adbe36917ac80c06580a25ca0d0ba92c8 Parents: 5475bfd Author: sboikov Authored: Fri Dec 30 15:08:18 2016 +0300 Committer: sboikov Committed: Fri Dec 30 15:08:18 2016 +0300 ---------------------------------------------------------------------- .../GridCacheContinuousQueryConcurrentTest.java | 47 +++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/a940fc3a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java index 29b351b..e0d6162 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java @@ -60,6 +60,7 @@ import static javax.cache.configuration.FactoryBuilder.factoryOf; /** * */ +@SuppressWarnings("unchecked") public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTest { /** */ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -152,9 +153,10 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe } /** + * @param ccfg Cache configuration. * @throws Exception If failed. */ - public void testRegistration(CacheConfiguration ccfg) throws Exception { + private void testRegistration(CacheConfiguration ccfg) throws Exception { ExecutorService execSrv = newSingleThreadExecutor(); try { @@ -171,16 +173,16 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe Future>> fut = execSrv.submit( new Callable>>() { @Override public List> call() throws Exception { - int count = 0; + int cnt = 0; List> futures = new ArrayList<>(); while (!stop.get()) { - futures.add(waitForKey(i0, cache, count)); + futures.add(waitForKey(i0, cache, cnt)); if (log.isDebugEnabled()) - log.debug("Started cont query count: " + count); + log.debug("Started cont query count: " + cnt); - if (++count >= conQryCnt) + if (++cnt >= conQryCnt) latch.countDown(); } @@ -208,9 +210,10 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe } /** + * @param ccfg Cache configuration. * @throws Exception If failed. */ - public void testRestartRegistration(CacheConfiguration ccfg) throws Exception { + private void testRestartRegistration(CacheConfiguration ccfg) throws Exception { ExecutorService execSrv = newSingleThreadExecutor(); final AtomicBoolean stopRes = new AtomicBoolean(false); @@ -261,16 +264,16 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe Future>> fut = execSrv.submit( new Callable>>() { @Override public List> call() throws Exception { - int count = 0; + int cnt = 0; List> futures = new ArrayList<>(); while (!stop.get()) { - futures.add(waitForKey(i0, cache, count)); + futures.add(waitForKey(i0, cache, cnt)); if (log.isDebugEnabled()) - log.debug("Started cont query count: " + count); + log.debug("Started cont query count: " + cnt); - if (++count >= conQryCnt) + if (++cnt >= conQryCnt) latch.countDown(); } @@ -313,7 +316,7 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe * @param id ID. * @return Future. */ - public IgniteFuture waitForKey(Integer key, final IgniteCache cache, final int id) { + private IgniteFuture waitForKey(Integer key, final IgniteCache cache, final int id) { String v = cache.get(key); // From now on, all futures will be completed immediately (since the key has been @@ -327,7 +330,7 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe createCacheListener(key, promise, id); promise.listen(new IgniteInClosure>() { - @Override public void apply(IgniteFuture future) { + @Override public void apply(IgniteFuture fut) { GridTestUtils.runAsync(new Callable() { @Override public Object call() throws Exception { cache.deregisterCacheEntryListener(cfg); @@ -351,9 +354,9 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe // Complete the promise if the key was inserted concurrently. asyncCache.future().listen(new IgniteInClosure>() { @Override public void apply(IgniteFuture f) { - String value = f.get(); + String val = f.get(); - if (value != null) { + if (val != null) { log.info("Completed by get: " + id); (((GridFutureAdapter)((IgniteFutureImpl)promise).internalFuture())).onDone("by get"); @@ -366,16 +369,16 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe /** * @param key Key. - * @param result Result. + * @param res Result. * @param id Listener ID. * @return Listener */ private CacheEntryListenerConfiguration createCacheListener( Integer key, - IgniteFuture result, + IgniteFuture res, int id) { return new MutableCacheEntryListenerConfiguration<>( - factoryOf(new CacheListener(result, id)), + factoryOf(new CacheListener(res, id)), new SingletonFactory<>(new KeyEventFilter(key, id)), false, true); } @@ -405,23 +408,23 @@ public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTe */ private static class CacheListener implements CacheEntryCreatedListener, Serializable { /** */ - final IgniteFuture result; + final IgniteFuture res; /** */ private final int id; /** - * @param result Result. + * @param res Result. * @param id ID. */ - CacheListener(IgniteFuture result, int id) { - this.result = result; + CacheListener(IgniteFuture res, int id) { + this.res = res; this.id = id; } /** {@inheritDoc} */ @Override public void onCreated(Iterable> evts) { - (((GridFutureAdapter)((IgniteFutureImpl)result).internalFuture())).onDone("by listener"); + (((GridFutureAdapter)((IgniteFutureImpl)res).internalFuture())).onDone("by listener"); } }