Ignite-perftest - Put from system thread.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d18fc7f2 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d18fc7f2 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d18fc7f2 Branch: refs/heads/ignite-perftest Commit: d18fc7f2fc1d05531be67c27b6e576e2ad3103d8 Parents: d12674a Author: Alexey Goncharuk <[email protected]> Authored: Fri Nov 13 18:06:00 2015 +0300 Committer: Alexey Goncharuk <[email protected]> Committed: Fri Nov 13 18:06:00 2015 +0300 ---------------------------------------------------------------------- .../yardstick/cache/IgnitePutTxBenchmark.java | 35 +++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/d18fc7f2/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java index 9c3389f..c31ca75 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java @@ -17,30 +17,33 @@ package org.apache.ignite.yardstick.cache; -import java.util.Map; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.yardstick.cache.model.SampleValue; -import org.yardstickframework.BenchmarkConfiguration; +import java.util.concurrent.Callable; +import org.apache.ignite.*; +import org.apache.ignite.internal.IgniteKernal; +import org.apache.ignite.lang.IgniteFuture; +import org.apache.ignite.yardstick.cache.model.*; + +import java.util.*; /** * Ignite benchmark that performs transactional put operations. */ -public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> { - /** {@inheritDoc} */ - @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { - super.setUp(cfg); +public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark { + private Callable<IgniteFuture> testCallable = new Callable<IgniteFuture>() { + @Override public IgniteFuture call() throws Exception { + int key = nextRandom(args.range()); - if (!IgniteSystemProperties.getBoolean("SKIP_MAP_CHECK")) - ignite().compute().broadcast(new WaitMapExchangeFinishCallable()); - } + // Implicit transaction is used. + IgniteCache<Integer, Object> cache0 = cache.withAsync(); + cache0.put(key, new SampleValue(key)); + + return cache0.future(); + } + }; /** {@inheritDoc} */ @Override public boolean test(Map<Object, Object> ctx) throws Exception { - int key = nextRandom(args.range()); - - // Implicit transaction is used. - cache.put(key, new SampleValue(key)); + ((IgniteKernal)ignite()).context().closure().callLocalSafe(testCallable, true).get().get(); return true; }
