ignite-1.5 Added tx mdoe configuration for IgnitePutTxBenchmark.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/233231de Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/233231de Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/233231de Branch: refs/heads/ignite-1.5.1 Commit: 233231de53e0d2c7d91244f7d65a13ecd515d8ce Parents: 8033bc4 Author: sboikov <sboi...@gridgain.com> Authored: Mon Dec 7 10:40:19 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Mon Dec 7 10:40:19 2015 +0300 ---------------------------------------------------------------------- .../yardstick/cache/IgnitePutTxBenchmark.java | 26 +++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/233231de/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..15b7cd6 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 @@ -18,8 +18,11 @@ package org.apache.ignite.yardstick.cache; import java.util.Map; +import java.util.concurrent.Callable; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteSystemProperties; +import org.apache.ignite.IgniteTransactions; +import org.apache.ignite.yardstick.IgniteBenchmarkUtils; import org.apache.ignite.yardstick.cache.model.SampleValue; import org.yardstickframework.BenchmarkConfiguration; @@ -27,20 +30,35 @@ import org.yardstickframework.BenchmarkConfiguration; * Ignite benchmark that performs transactional put operations. */ public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> { + /** */ + private IgniteTransactions txs; + + /** */ + private Callable<Void> clo; + /** {@inheritDoc} */ @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { super.setUp(cfg); if (!IgniteSystemProperties.getBoolean("SKIP_MAP_CHECK")) ignite().compute().broadcast(new WaitMapExchangeFinishCallable()); + + txs = ignite().transactions(); + + clo = new Callable<Void>() { + @Override public Void call() throws Exception { + int key = nextRandom(args.range()); + + cache.put(key, new SampleValue(key)); + + return null; + } + }; } /** {@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)); + IgniteBenchmarkUtils.doInTransaction(txs, args.txConcurrency(), args.txIsolation(), clo); return true; }