Repository: incubator-ignite Updated Branches: refs/heads/ignite-client-bench [created] faaa719d4
# ignite-sprint-5: do not fail if server killed. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/faaa719d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/faaa719d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/faaa719d Branch: refs/heads/ignite-client-bench Commit: faaa719d40fbace696e10c24212c93ad56492430 Parents: 0fa2853 Author: ashutak <[email protected]> Authored: Mon Jun 8 18:45:01 2015 +0300 Committer: ashutak <[email protected]> Committed: Mon Jun 8 18:45:01 2015 +0300 ---------------------------------------------------------------------- .../yardstick/cache/IgnitePutGetBenchmark.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/faaa719d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java index b8e032c..c4b2506 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java @@ -20,22 +20,30 @@ package org.apache.ignite.yardstick.cache; import org.apache.ignite.*; import org.apache.ignite.yardstick.cache.model.*; +import java.lang.*; import java.util.*; +import static org.yardstickframework.BenchmarkUtils.*; + /** * Ignite benchmark that performs put and get operations. */ public class IgnitePutGetBenchmark extends IgniteCacheAbstractBenchmark { /** {@inheritDoc} */ @Override public boolean test(Map<Object, Object> ctx) throws Exception { - int key = nextRandom(args.range()); + try { + int key = nextRandom(args.range()); - Object val = cache.get(key); + Object val = cache.get(key); - if (val != null) - key = nextRandom(args.range()); + if (val != null) + key = nextRandom(args.range()); - cache.put(key, new SampleValue(key)); + cache.put(key, new SampleValue(key)); + } + catch (Exception e) { + error("Operation failed.", e); + } return true; }
