Skip to content

Commit

Permalink
# IGNITE-102: Renaming + debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
akuznetsov-gridgain committed Jan 29, 2015
1 parent 641a4c8 commit fa4ac59
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 19 deletions.
Expand Up @@ -78,7 +78,7 @@ public abstract class IgniteAbstractBenchmark extends BenchmarkDriverAdapter {
/**
* @return Grid.
*/
protected Ignite grid() {
protected Ignite ignite() {
return node.ignite();
}

Expand All @@ -88,7 +88,7 @@ protected Ignite grid() {
private void waitForNodes() throws Exception {
final CountDownLatch nodesStartedLatch = new CountDownLatch(1);

grid().events().localListen(new IgnitePredicate<IgniteEvent>() {
ignite().events().localListen(new IgnitePredicate<IgniteEvent>() {
@Override public boolean apply(IgniteEvent gridEvt) {
if (nodesStarted())
nodesStartedLatch.countDown();
Expand All @@ -108,7 +108,7 @@ private void waitForNodes() throws Exception {
* @return {@code True} if all nodes are started, {@code false} otherwise.
*/
private boolean nodesStarted() {
return grid().cluster().nodes().size() >= args.nodes();
return ignite().cluster().nodes().size() >= args.nodes();
}

/**
Expand Down
Expand Up @@ -36,6 +36,6 @@ public class IgniteGetBenchmark extends IgniteCacheAbstractBenchmark {

/** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("atomic");
return ignite().jcache("atomic");
}
}
Expand Up @@ -37,6 +37,6 @@ public class IgnitePutBenchmark extends IgniteCacheAbstractBenchmark {

/** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("atomic");
return ignite().jcache("atomic");
}
}
Expand Up @@ -42,6 +42,6 @@ public class IgnitePutGetBenchmark extends IgniteCacheAbstractBenchmark {

/** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("atomic");
return ignite().jcache("atomic");
}
}
Expand Up @@ -31,22 +31,30 @@ public class IgnitePutGetTxBenchmark extends IgniteCacheAbstractBenchmark {
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(0, args.range() / 2);

try (IgniteTx tx = grid().transactions().txStart()) {
ignite().log().debug("IgnitePutGetTxBenchmark - key: " + key);

try (IgniteTx tx = ignite().transactions().txStart()) {
ignite().log().debug("IgnitePutGetTxBenchmark: txStart()");

Object val = cache.get(key);

ignite().log().debug("IgnitePutGetTxBenchmark - get():" + val);

if (val != null)
key = nextRandom(args.range() / 2, args.range());

cache.put(key, new SampleValue(key));

tx.commit();

ignite().log().debug("IgnitePutGetTxBenchmark - txCommit");
}

return true;
}

/** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("tx");
return ignite().jcache("tx");
}
}
Expand Up @@ -38,6 +38,6 @@ public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark {

/** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("tx");
return ignite().jcache("tx");
}
}
Expand Up @@ -42,7 +42,7 @@ public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark {

long start = System.nanoTime();

try (IgniteDataLoader<Integer, Person> dataLdr = grid().dataLoader(cache.getName())) {
try (IgniteDataLoader<Integer, Person> dataLdr = ignite().dataLoader(cache.getName())) {
for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); i++) {
dataLdr.addData(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000));

Expand Down Expand Up @@ -89,6 +89,6 @@ private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary, do

/** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("query");
return ignite().jcache("query");
}
}
Expand Up @@ -42,7 +42,7 @@ public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark {

long start = System.nanoTime();

try (IgniteDataLoader<Object, Object> dataLdr = grid().dataLoader(cache.getName())) {
try (IgniteDataLoader<Object, Object> dataLdr = ignite().dataLoader(cache.getName())) {
final int orgRange = args.range() / 10;

// Populate organizations.
Expand Down Expand Up @@ -113,6 +113,6 @@ private Collection<List<?>> executeQueryJoin(double minSalary, double maxSalary)

/** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("query");
return ignite().jcache("query");
}
}
Expand Up @@ -81,6 +81,6 @@ private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary, do

/** {@inheritDoc} */
@Override protected IgniteCache<Integer, Object> cache() {
return grid().jcache("query");
return ignite().jcache("query");
}
}
Expand Up @@ -29,7 +29,7 @@
public class IgniteAffinityCallBenchmark extends IgniteAbstractBenchmark {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().affinityCall("compute", ThreadLocalRandom.current().nextInt(), new NoopCallable());
ignite().compute().affinityCall("compute", ThreadLocalRandom.current().nextInt(), new NoopCallable());

return true;
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ public class IgniteApplyBenchmark extends IgniteAbstractBenchmark {

/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().apply(new NoopClosure(), applyArgs);
ignite().compute().apply(new NoopClosure(), applyArgs);

return true;
}
Expand Down
Expand Up @@ -28,7 +28,7 @@
public class IgniteBroadcastBenchmark extends IgniteAbstractBenchmark {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().broadcast(new NoopCallable());
ignite().compute().broadcast(new NoopCallable());

return true;
}
Expand Down
Expand Up @@ -28,7 +28,7 @@
public class IgniteExecuteBenchmark extends IgniteAbstractBenchmark {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().execute(new NoopTask(args.jobs()), null);
ignite().compute().execute(new NoopTask(args.jobs()), null);

return true;
}
Expand Down
Expand Up @@ -44,7 +44,7 @@ public class IgniteRunBenchmark extends IgniteAbstractBenchmark {

/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
grid().compute().run(jobs);
ignite().compute().run(jobs);

return true;
}
Expand Down

0 comments on commit fa4ac59

Please sign in to comment.