ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/2] ignite git commit: IgniteCacheRandomOperationBenchmark: minor code style changes.
Date Fri, 17 Jun 2016 11:28:43 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-3211 [created] 29a8eaf3a


IgniteCacheRandomOperationBenchmark: minor code style changes.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0fd1ab6d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0fd1ab6d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0fd1ab6d

Branch: refs/heads/ignite-3211
Commit: 0fd1ab6d21447ae63e09535057cec6326539520f
Parents: a527bf8
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Jun 17 12:04:13 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Jun 17 12:53:53 2016 +0300

----------------------------------------------------------------------
 .../IgniteCacheRandomOperationBenchmark.java    | 539 ++++++++++---------
 .../cache/load/model/key/Identifier.java        |   6 +
 .../yardstick/cache/load/model/key/Mark.java    |   7 +
 .../yardstick/cache/load/model/value/Car.java   |   6 +
 .../yardstick/cache/load/model/value/Truck.java |  12 +-
 .../ignite/yardstick/cache/model/Account.java   |   6 +
 .../ignite/yardstick/cache/model/Person1.java   |   2 +-
 .../ignite/yardstick/cache/model/Person2.java   |   2 +-
 .../ignite/yardstick/cache/model/SampleKey.java |   2 +-
 .../yardstick/cache/model/SampleValue.java      |   2 +-
 10 files changed, 309 insertions(+), 275 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
index 8a775ee..e676b38 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
@@ -38,9 +38,7 @@ import javax.cache.event.CacheEntryEvent;
 import javax.cache.event.CacheEntryListenerException;
 import javax.cache.event.CacheEntryUpdatedListener;
 import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.EntryProcessorException;
 import javax.cache.processor.MutableEntry;
-
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCompute;
@@ -94,13 +92,13 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
     private static final int SCAN_QUERY_PARTITION_AMOUNT = 10;
 
     /** List off all available cache. */
-    private List<IgniteCache> availableCaches;
+    private List<IgniteCache<Object, Object>> availableCaches;
 
     /** List of available transactional cache. */
-    private List<IgniteCache> txCaches;
+    private List<IgniteCache<Object, Object>> txCaches;
 
     /** List of affinity cache. */
-    private List<IgniteCache> affCaches;
+    private List<IgniteCache<Object, Object>> affCaches;
 
     /** Map cache name on key classes. */
     private Map<String, Class[]> keysCacheClasses;
@@ -162,14 +160,21 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
 
     /** {@inheritDoc} */
     @Override public void tearDown() throws Exception {
-        BenchmarkUtils.println("Benchmark statistics");
-        for (String cacheName : ignite().cacheNames()) {
-            BenchmarkUtils.println(String.format("Operations over cache '%s'", cacheName));
-            for (Operation op : Operation.values())
-                BenchmarkUtils.println(cfg, String.format("%s: %s", op,
-                    operationStatistics.get(op + "_" + cacheName)));
+        try {
+            BenchmarkUtils.println("Benchmark statistics");
+
+            for (String cacheName : ignite().cacheNames()) {
+                BenchmarkUtils.println(String.format("Operations over cache '%s'", cacheName));
+
+                for (Operation op : Operation.values()) {
+                    BenchmarkUtils.println(cfg, String.format("%s: %s", op,
+                        operationStatistics.get(op + "_" + cacheName)));
+                }
+            }
+        }
+        finally {
+            super.tearDown();
         }
-        super.tearDown();
     }
 
     /**
@@ -373,7 +378,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
 
             threads[i] = new Thread() {
                 @Override public void run() {
-                    try (IgniteDataStreamer dataLdr = ignite().dataStreamer(cacheName)) {
+                    try (IgniteDataStreamer<Object, Object> dataLdr = ignite().dataStreamer(cacheName))
{
                         for (int i = 0; i < args.preloadAmount() && !isInterrupted();
i++)
                             dataLdr.addData(createRandomKey(i, cacheName), createRandomValue(i,
cacheName));
                     }
@@ -395,30 +400,30 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      */
     private Map<UUID, List<Integer>> personCachePartitions(String cacheName)
{
         // Getting affinity for person cache.
-        Affinity affinity = ignite().affinity(cacheName);
+        Affinity<Object> affinity = ignite().affinity(cacheName);
 
         // Building a list of all partitions numbers.
-        List<Integer> randmPartitions = new ArrayList<>(10);
+        List<Integer> rndParts = new ArrayList<>(10);
 
         if (affinity.partitions() <= SCAN_QUERY_PARTITION_AMOUNT)
             for (int i = 0; i < affinity.partitions(); i++)
-                randmPartitions.add(i);
+                rndParts.add(i);
         else {
             for (int i = 0; i < SCAN_QUERY_PARTITION_AMOUNT; i++) {
                 int partNum;
 
                 do
                     partNum = nextRandom(affinity.partitions());
-                while (randmPartitions.contains(partNum));
+                while (rndParts.contains(partNum));
 
-                randmPartitions.add(partNum);
+                rndParts.add(partNum);
             }
         }
 
-        Collections.sort(randmPartitions);
+        Collections.sort(rndParts);
 
         // Getting partition to node mapping.
-        Map<Integer, ClusterNode> partPerNodes = affinity.mapPartitionsToNodes(randmPartitions);
+        Map<Integer, ClusterNode> partPerNodes = affinity.mapPartitionsToNodes(rndParts);
 
         // Building node to partitions mapping.
         Map<UUID, List<Integer>> nodesToPart = new HashMap<>();
@@ -497,7 +502,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      * @throws Exception If fail.
      */
     private void executeOutOfTx(Map<Object, Object> map, boolean withoutTransactionCache)
throws Exception {
-        for (IgniteCache cache : availableCaches) {
+        for (IgniteCache<Object, Object> cache : availableCaches) {
             if (withoutTransactionCache && txCaches.contains(cache))
                 continue;
 
@@ -510,7 +515,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      * @param cache Ignite cache.
      * @throws Exception If fail.
      */
-    private void executeRandomOperation(Map<Object, Object> map, IgniteCache cache)
throws Exception {
+    private void executeRandomOperation(Map<Object, Object> map, IgniteCache<Object,
Object> cache) throws Exception {
         Operation op = nextRandomOperation();
 
         switch (op) {
@@ -629,9 +634,8 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
             TransactionIsolation.fromOrdinal(nextRandom(TransactionIsolation.values().length)),
 
             new Callable<Object>() {
-                @Override
-                public Object call() throws Exception {
-                    for (IgniteCache cache : txCaches)
+                @Override public Object call() throws Exception {
+                    for (IgniteCache<Object, Object> cache : txCaches)
                         if (nextBoolean())
                             executeRandomOperation(map, cache);
 
@@ -644,7 +648,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doPut(IgniteCache cache) throws Exception {
+    private void doPut(IgniteCache<Object, Object> cache) throws Exception {
         int i = nextRandom(args.range());
 
         cache.put(createRandomKey(i, cache.getName()), createRandomValue(i, cache.getName()));
@@ -654,8 +658,8 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doPutAll(IgniteCache cache) throws Exception {
-        Map putMap = new TreeMap();
+    private void doPutAll(IgniteCache<Object, Object> cache) throws Exception {
+        Map<Object, Object> putMap = new TreeMap<>();
 
         Class keyCass = randomKeyClass(cache.getName());
 
@@ -672,7 +676,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doGet(IgniteCache cache) throws Exception {
+    private void doGet(IgniteCache<Object, Object> cache) throws Exception {
         int i = nextRandom(args.range());
 
         cache.get(createRandomKey(i, cache.getName()));
@@ -682,8 +686,8 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doGetAll(IgniteCache cache) throws Exception {
-        Set keys = new TreeSet();
+    private void doGetAll(IgniteCache<Object, Object> cache) throws Exception {
+        Set<Object> keys = new TreeSet<>();
 
         Class keyCls = randomKeyClass(cache.getName());
 
@@ -700,7 +704,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doInvoke(final IgniteCache cache) throws Exception {
+    private void doInvoke(final IgniteCache<Object, Object> cache) throws Exception
{
         final int i = nextRandom(args.range());
 
         if (nextBoolean())
@@ -711,54 +715,54 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
 
     }
 
-/**
- * Entry processor for local benchmark replace value task.
- */
-private static class BenchmarkReplaceValueEntryProcessor implements EntryProcessor, Serializable
{
     /**
-     * New value for update during process by default.
+     * Entry processor for local benchmark replace value task.
      */
-    private Object newVal;
+    private static class BenchmarkReplaceValueEntryProcessor implements EntryProcessor<Object,
Object, Object>, Serializable {
+        /**
+         * New value for update during process by default.
+         */
+        private Object newVal;
+
+        /**
+         * @param newVal default new value
+         */
+        private BenchmarkReplaceValueEntryProcessor(Object newVal) {
+            this.newVal = newVal;
+        }
 
-    /**
-     * @param newVal default new value
-     */
-    private BenchmarkReplaceValueEntryProcessor(Object newVal) {
-        this.newVal = newVal;
-    }
+        /** {@inheritDoc} */
+        @Override public Object process(MutableEntry<Object, Object> entry, Object...
arguments) {
+            Object newVal = arguments == null || arguments[0] == null ? this.newVal : arguments[0];
 
-    /** {@inheritDoc} */
-    @Override public Object process(MutableEntry entry, Object... arguments) throws EntryProcessorException
{
-        Object newVal = arguments == null || arguments[0] == null ? this.newVal : arguments[0];
+            Object oldVal = entry.getValue();
 
-        Object oldVal = entry.getValue();
+            entry.setValue(newVal);
 
-        entry.setValue(newVal);
-
-        return oldVal;
+            return oldVal;
+        }
     }
-}
 
-/**
- * Entry processor for local benchmark remove entry task.
- */
-private static class BenchmarkRemoveEntryProcessor implements EntryProcessor, Serializable
{
-    /** {@inheritDoc} */
-    @Override public Object process(MutableEntry entry, Object... arguments) throws EntryProcessorException
{
-        Object oldVal = entry.getValue();
+    /**
+     * Entry processor for local benchmark remove entry task.
+     */
+    private static class BenchmarkRemoveEntryProcessor implements EntryProcessor<Object,
Object, Object>, Serializable {
+        /** {@inheritDoc} */
+        @Override public Object process(MutableEntry<Object, Object> entry, Object...
arguments) {
+            Object oldVal = entry.getValue();
 
-        entry.remove();
+            entry.remove();
 
-        return oldVal;
+            return oldVal;
+        }
     }
-}
 
     /**
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doInvokeAll(final IgniteCache cache) throws Exception {
-        Map<Object, EntryProcessor> map = new TreeMap<>();
+    private void doInvokeAll(IgniteCache<Object, Object> cache) throws Exception {
+        Map<Object, EntryProcessor<Object, Object, Object>> map = new TreeMap<>();
 
         Class keyCls = randomKeyClass(cache.getName());
 
@@ -781,7 +785,7 @@ private static class BenchmarkRemoveEntryProcessor implements EntryProcessor,
Se
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doRemove(IgniteCache cache) throws Exception {
+    private void doRemove(IgniteCache<Object, Object> cache) throws Exception {
         int i = nextRandom(args.range());
 
         cache.remove(createRandomKey(i, cache.getName()));
@@ -791,8 +795,9 @@ private static class BenchmarkRemoveEntryProcessor implements EntryProcessor,
Se
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doRemoveAll(IgniteCache cache) throws Exception {
-        Set keys = new TreeSet();
+    private void doRemoveAll(IgniteCache<Object, Object> cache) throws Exception {
+        Set<Object> keys = new TreeSet<>();
+
         Class keyCls = randomKeyClass(cache.getName());
 
         for (int cnt = 0; cnt < args.batch(); cnt++) {
@@ -808,7 +813,7 @@ private static class BenchmarkRemoveEntryProcessor implements EntryProcessor,
Se
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doPutIfAbsent(IgniteCache cache) throws Exception {
+    private void doPutIfAbsent(IgniteCache<Object, Object> cache) throws Exception
{
         int i = nextRandom(args.range());
 
         cache.putIfAbsent(createRandomKey(i, cache.getName()), createRandomValue(i, cache.getName()));
@@ -818,7 +823,7 @@ private static class BenchmarkRemoveEntryProcessor implements EntryProcessor,
Se
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doReplace(IgniteCache cache) throws Exception {
+    private void doReplace(IgniteCache<Object, Object> cache) throws Exception {
         int i = nextRandom(args.range());
 
         cache.replace(createRandomKey(i, cache.getName()),
@@ -830,7 +835,7 @@ private static class BenchmarkRemoveEntryProcessor implements EntryProcessor,
Se
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doScanQuery(IgniteCache cache) throws Exception {
+    private void doScanQuery(IgniteCache<Object, Object> cache) throws Exception {
         if (!affCaches.contains(cache))
             return;
 
@@ -849,7 +854,7 @@ private static class BenchmarkRemoveEntryProcessor implements EntryProcessor,
Se
      * @param cache Ignite cache.
      * @throws Exception If failed.
      */
-    private void doSqlQuery(IgniteCache cache) throws Exception {
+    private void doSqlQuery(IgniteCache<Object, Object> cache) throws Exception {
         List<SqlCacheDescriptor> descriptors = cacheSqlDescriptors.get(cache.getName());
 
         if (descriptors != null && !descriptors.isEmpty()) {
@@ -864,8 +869,9 @@ private static class BenchmarkRemoveEntryProcessor implements EntryProcessor,
Se
                 sq = new SqlFieldsQuery(queries.get(nextRandom(queries.size())));
 
             try (QueryCursor cursor = cache.query(sq)) {
-                for (Object obj : cursor)
-                    ;
+                for (Object obj : cursor) {
+                    // No-op.
+                }
             }
         }
     }
@@ -875,7 +881,7 @@ private static class BenchmarkRemoveEntryProcessor implements EntryProcessor,
Se
      * @param map Parameters map.
      * @throws Exception If failed.
      */
-    private void doContinuousQuery(IgniteCache cache, Map<Object, Object> map) throws
Exception {
+    private void doContinuousQuery(IgniteCache<Object, Object> cache, Map<Object,
Object> map) throws Exception {
         List<QueryCursor> cursors = (ArrayList<QueryCursor>)map.get(cache.getName());
 
         if (cursors == null) {
@@ -898,260 +904,257 @@ private static class BenchmarkRemoveEntryProcessor implements EntryProcessor,
Se
         cursors.add(cache.query(qry));
     }
 
-/**
- * Continuous query updater class.
- */
-private static class ContinuousQueryUpdater implements CacheEntryUpdatedListener, Serializable
{
-
-    /** {@inheritDoc} */
-    @Override public void onUpdated(Iterable iterable) throws CacheEntryListenerException
{
-        for (Object o : iterable)
-            ;
+    /**
+     * @return Nex random boolean value.
+     */
+    private boolean nextBoolean() {
+        return ThreadLocalRandom.current().nextBoolean();
     }
-}
-
-/**
- * Continuous query filter class.
- */
-private static class ContinuousQueryFilter implements CacheEntryEventSerializableFilter,
Serializable {
 
     /**
-     * Flag.
+     * Continuous query updater class.
      */
-    private boolean flag = true;
+    private static class ContinuousQueryUpdater implements CacheEntryUpdatedListener, Serializable
{
 
-    /** {@inheritDoc} */
-    @Override public boolean evaluate(CacheEntryEvent evt) throws CacheEntryListenerException
{
-        return flag =! flag;
+        /** {@inheritDoc} */
+        @Override public void onUpdated(Iterable iterable) throws CacheEntryListenerException
{
+            for (Object o : iterable) {
+                // No-op.
+            }
+        }
     }
-}
 
-/**
- * Closure for scan query executing.
- */
-private static class ScanQueryBroadcastClosure implements IgniteRunnable {
     /**
-     * Ignite node.
+     * Continuous query filter class.
      */
-    @IgniteInstanceResource
-    private Ignite node;
+    private static class ContinuousQueryFilter implements CacheEntryEventSerializableFilter,
Serializable {
+        /** */
+        private boolean flag = true;
 
-    /**
-     * Information about partition.
-     */
-    private Map<UUID, List<Integer>> cachePart;
+        /** {@inheritDoc} */
+        @Override public boolean evaluate(CacheEntryEvent evt) throws CacheEntryListenerException
{
+            return flag =! flag;
+        }
+    }
 
     /**
-     * Name of Ignite cache.
+     * Closure for scan query executing.
      */
-    private String cacheName;
+    private static class ScanQueryBroadcastClosure implements IgniteRunnable {
+        /**
+         * Ignite node.
+         */
+        @IgniteInstanceResource
+        private Ignite node;
+
+        /**
+         * Information about partition.
+         */
+        private Map<UUID, List<Integer>> cachePart;
+
+        /**
+         * Name of Ignite cache.
+         */
+        private String cacheName;
+
+        /**
+         * @param cacheName Name of Ignite cache.
+         * @param cachePart Partition by node for Ignite cache.
+         */
+        private ScanQueryBroadcastClosure(String cacheName, Map<UUID, List<Integer>>
cachePart) {
+            this.cachePart = cachePart;
+            this.cacheName = cacheName;
+        }
 
-    /**
-     * @param cacheName Name of Ignite cache.
-     * @param cachePart Partition by node for Ignite cache.
-     */
-    private ScanQueryBroadcastClosure(String cacheName, Map<UUID, List<Integer>>
cachePart) {
-        this.cachePart = cachePart;
-        this.cacheName = cacheName;
-    }
+        /** {@inheritDoc} */
+        @Override public void run() {
+            IgniteCache cache = node.cache(cacheName);
 
-    /** {@inheritDoc} */
-    @Override public void run() {
-        IgniteCache cache = node.cache(cacheName);
+            // Getting a list of the partitions owned by this node.
+            List<Integer> myPartitions = cachePart.get(node.cluster().localNode().id());
 
-        // Getting a list of the partitions owned by this node.
-        List<Integer> myPartitions = cachePart.get(node.cluster().localNode().id());
+            for (Integer part : myPartitions) {
 
-        for (Integer part : myPartitions) {
+                ScanQuery scanQry = new ScanQuery();
 
-            ScanQuery scanQry = new ScanQuery();
+                scanQry.setPartition(part);
 
-            scanQry.setPartition(part);
+                scanQry.setFilter(igniteBiPred);
 
-            scanQry.setFilter(igniteBiPred);
+                try (QueryCursor cursor = cache.query(scanQry)) {
+                    for (Object obj : cursor) {
+                        // No-op.
+                    }
+                }
 
-            try (QueryCursor cursor = cache.query(scanQry)) {
-                for (Object obj : cursor)
-                    ;
             }
-
         }
     }
-}
-
-/**
- * Scan query predicate class.
- */
-private static class BenchmarkIgniteBiPredicate implements IgniteBiPredicate {
 
     /**
-     * @param key Cache key.
-     * @param val Cache value.
-     * @return true If is hit.
+     * Scan query predicate class.
      */
-    @Override public boolean apply(Object key, Object val) {
-        return true;
+    private static class BenchmarkIgniteBiPredicate implements IgniteBiPredicate {
+        /**
+         * @param key Cache key.
+         * @param val Cache value.
+         * @return true If is hit.
+         */
+        @Override public boolean apply(Object key, Object val) {
+            return true;
+        }
     }
-}
-
-/**
- * Query descriptor.
- */
-private static class SqlCacheDescriptor {
 
     /**
-     * Class of value.
+     * Query descriptor.
      */
-    private Class valCls;
-
-    /**
-     * Select fields.
-     */
-    private Set<String> fields;
-
-    /**
-     * Indexed fields.
-     */
-    private Map<String, Class> indexedFieldsByCls;
-
-    /**
-     * @param valCls Class of value.
-     * @param fields All select fields.
-     * @param indexedFieldsByCls Indexed fields.
-     */
-    SqlCacheDescriptor(Class valCls, Set<String> fields,
-        Map<String, Class> indexedFieldsByCls) {
-        this.valCls = valCls;
-        this.fields = fields;
-        this.indexedFieldsByCls = indexedFieldsByCls;
-    }
+    private static class SqlCacheDescriptor {
+        /**
+         * Class of value.
+         */
+        private Class valCls;
+
+        /**
+         * Select fields.
+         */
+        private Set<String> fields;
+
+        /**
+         * Indexed fields.
+         */
+        private Map<String, Class> indexedFieldsByCls;
+
+        /**
+         * @param valCls Class of value.
+         * @param fields All select fields.
+         * @param indexedFieldsByCls Indexed fields.
+         */
+        SqlCacheDescriptor(Class valCls, Set<String> fields,
+            Map<String, Class> indexedFieldsByCls) {
+            this.valCls = valCls;
+            this.fields = fields;
+            this.indexedFieldsByCls = indexedFieldsByCls;
+        }
 
-    /**
-     * @param id Query id.
-     * @return Condition string.
-     */
-    private String makeQuerySelect(int id) {
-        return StringUtils.collectionToDelimitedString(fields, ", ");
-    }
+        /**
+         * @param id Query id.
+         * @return Condition string.
+         */
+        private String makeQuerySelect(int id) {
+            return StringUtils.collectionToDelimitedString(fields, ", ");
+        }
 
-    /**
-     * @param id Query id.
-     * @return Condition string.
-     */
-    private String makeQueryCondition(int id) {
-        StringBuilder sb = new StringBuilder();
+        /**
+         * @param id Query id.
+         * @return Condition string.
+         */
+        private String makeQueryCondition(int id) {
+            StringBuilder sb = new StringBuilder();
 
-        for (String iField : indexedFieldsByCls.keySet()) {
-            Class cl = indexedFieldsByCls.get(iField);
+            for (String iField : indexedFieldsByCls.keySet()) {
+                Class cl = indexedFieldsByCls.get(iField);
 
-            if (!Number.class.isAssignableFrom(cl) && !String.class.equals(cl))
-                continue;
+                if (!Number.class.isAssignableFrom(cl) && !String.class.equals(cl))
+                    continue;
 
-            if (sb.length() != 0) {
-                switch (id % 3 % 2) {
-                    case 0:
-                        sb.append(" OR ");
-                        break;
-                    case 1:
-                        sb.append(" AND ");
-                        break;
+                if (sb.length() != 0) {
+                    switch (id % 3 % 2) {
+                        case 0:
+                            sb.append(" OR ");
+                            break;
+                        case 1:
+                            sb.append(" AND ");
+                            break;
+                    }
                 }
-            }
 
-            if (Number.class.isAssignableFrom(cl)) {
-                sb.append(iField);
-                switch (id % 2) {
-                    case 0:
-                        sb.append(" > ");
-                        break;
-                    case 1:
-                        sb.append(" < ");
-                        break;
+                if (Number.class.isAssignableFrom(cl)) {
+                    sb.append(iField);
+                    switch (id % 2) {
+                        case 0:
+                            sb.append(" > ");
+                            break;
+                        case 1:
+                            sb.append(" < ");
+                            break;
+                    }
+                    sb.append(id);
                 }
-                sb.append(id);
+                else if (String.class.equals(cl))
+                    sb.append("lower(").append(iField).append(") LIKE lower('%").append(id).append("%')");
+
             }
-            else if (String.class.equals(cl))
-                sb.append("lower(").append(iField).append(") LIKE lower('%").append(id).append("%')");
+            return sb.toString();
+        }
 
+        /**
+         * @param id Query id.
+         * @return SQL query object.
+         */
+        SqlQuery getSqlQuery(int id) {
+            return new SqlQuery(valCls, makeQueryCondition(id));
         }
-        return sb.toString();
-    }
 
-    /**
-     * @param id Query id.
-     * @return SQL query object.
-     */
-    SqlQuery getSqlQuery(int id) {
-        return new SqlQuery(valCls, makeQueryCondition(id));
-    }
+        /**
+         * @param id Query id.
+         * @return SQL filed query object.
+         */
+        SqlFieldsQuery getSqlFieldsQuery(int id) {
+            return new SqlFieldsQuery(String.format("SELECT %s FROM %s WHERE %s",
+                makeQuerySelect(id), valCls.getSimpleName(), makeQueryCondition(id)));
+        }
 
-    /**
-     * @param id Query id.
-     * @return SQL filed query object.
-     */
-    SqlFieldsQuery getSqlFieldsQuery(int id) {
-        return new SqlFieldsQuery(String.format("SELECT %s FROM %s WHERE %s",
-            makeQuerySelect(id), valCls.getSimpleName(), makeQueryCondition(id)));
     }
 
-}
-
     /**
-     * @return Nex random boolean value.
+     * Cache operation enum.
      */
-    private boolean nextBoolean() {
-        return ThreadLocalRandom.current().nextBoolean();
-    }
-
-/**
- * Cache operation enum.
- */
-private static enum Operation {
-    /** Put operation. */
-    PUT,
+    private enum Operation {
+        /** Put operation. */
+        PUT,
 
-    /** Put all operation. */
-    PUT_ALL,
+        /** Put all operation. */
+        PUT_ALL,
 
-    /** Get operation. */
-    GET,
+        /** Get operation. */
+        GET,
 
-    /** Get all operation. */
-    GET_ALL,
+        /** Get all operation. */
+        GET_ALL,
 
-    /** Invoke operation. */
-    INVOKE,
+        /** Invoke operation. */
+        INVOKE,
 
-    /** Invoke all operation. */
-    INVOKE_ALL,
+        /** Invoke all operation. */
+        INVOKE_ALL,
 
-    /** Remove operation. */
-    REMOVE,
+        /** Remove operation. */
+        REMOVE,
 
-    /** Remove all operation. */
-    REMOVE_ALL,
+        /** Remove all operation. */
+        REMOVE_ALL,
 
-    /** Put if absent operation. */
-    PUT_IF_ABSENT,
+        /** Put if absent operation. */
+        PUT_IF_ABSENT,
 
-    /** Replace operation. */
-    REPLACE,
+        /** Replace operation. */
+        REPLACE,
 
-    /** Scan query operation. */
-    SCAN_QUERY,
+        /** Scan query operation. */
+        SCAN_QUERY,
 
-    /** SQL query operation. */
-    SQL_QUERY,
+        /** SQL query operation. */
+        SQL_QUERY,
 
-    /** Continuous Query. */
-    CONTINUOUS_QUERY;
+        /** Continuous Query. */
+        CONTINUOUS_QUERY;
 
-    /**
-     * @param num Number of operation.
-     * @return Operation.
-     */
-    public static Operation valueOf(int num) {
-        return values()[num];
+        /**
+         * @param num Number of operation.
+         * @return Operation.
+         */
+        public static Operation valueOf(int num) {
+            return values()[num];
+        }
     }
 }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Identifier.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Identifier.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Identifier.java
index 4954c9c..c7c7f2d 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Identifier.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Identifier.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.yardstick.cache.load.model.key;
 
 import java.io.Serializable;
+import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Key cache class
@@ -104,4 +105,9 @@ public class Identifier implements Comparable<Identifier>, Serializable
{
     @Override public int compareTo(Identifier o) {
         return Integer.compare(id, o.id);
     }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(Identifier.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Mark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Mark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Mark.java
index fdc9393..35acef3 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Mark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/key/Mark.java
@@ -19,6 +19,7 @@ package org.apache.ignite.yardstick.cache.load.model.key;
 
 import java.io.Serializable;
 import java.util.UUID;
+import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Cache value class
@@ -38,6 +39,7 @@ public class Mark implements Comparable<Mark>, Serializable {
      * Empty constructor
      */
     public Mark() {
+        // No-op.
     }
 
     /**
@@ -105,4 +107,9 @@ public class Mark implements Comparable<Mark>, Serializable {
     @Override public int compareTo(Mark o) {
         return id - o.id;
     }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(Mark.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Car.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Car.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Car.java
index ad20a80..32be132 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Car.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Car.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.yardstick.cache.load.model.value;
 
 import java.io.Serializable;
+import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Value cache class
@@ -117,4 +118,9 @@ public class Car implements Serializable {
     public void setColor(Color color) {
         this.color = color;
     }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(Car.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Truck.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Truck.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Truck.java
index 4411e08..fd68562 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Truck.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/value/Truck.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.yardstick.cache.load.model.value;
 
 import java.io.Serializable;
+import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Cache value class
@@ -40,11 +41,11 @@ public class Truck extends Car implements Serializable {
      * @param make mark of truck
      * @param weight weight
      * @param color Color.
-     * @param capacity capacity
+     * @param cap capacity
      */
-    public Truck(int id, String make, double weight, Color color, double capacity) {
+    public Truck(int id, String make, double weight, Color color, double cap) {
         super(id, make, weight, color);
-        this.cap = capacity;
+        this.cap = cap;
     }
 
     /**
@@ -60,4 +61,9 @@ public class Truck extends Car implements Serializable {
     public void setCap(double cap) {
         this.cap = cap;
     }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(Truck.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Account.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Account.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Account.java
index 3d5d9f8..a857b9d 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Account.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Account.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.yardstick.cache.model;
 
 import java.io.Serializable;
+import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  *
@@ -39,4 +40,9 @@ public class Account implements Serializable {
     public int balance() {
         return balance;
     }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(Account.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
index 9e55850..5f412f4 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
@@ -49,6 +49,6 @@ public class Person1 implements Serializable {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return "IndexedValue1 [val1=" + val1 + ']';
+        return "Person1 [val1=" + val1 + ']';
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
index cf9628c..571fe83 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
@@ -61,6 +61,6 @@ public class Person2 implements Serializable {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return "IndexedValue2 [val1=" + val1 + ", val2=" + val2 + ']';
+        return "Person2 [val1=" + val1 + ", val2=" + val2 + ']';
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
index e089696..ac4b924 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java
@@ -100,6 +100,6 @@ public class SampleKey implements Externalizable, Binarylizable {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return "Key [id=" + id + ']';
+        return "SampleKey [id=" + id + ']';
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0fd1ab6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
index b28862c..20be370 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java
@@ -81,6 +81,6 @@ public class SampleValue implements Externalizable, Binarylizable {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return "Value [id=" + id + ']';
+        return "SampleValue [id=" + id + ']';
     }
 }
\ No newline at end of file


Mime
View raw message