ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [33/50] [abbrv] incubator-ignite git commit: sprint-3 - Updated cache examples.
Date Thu, 09 Apr 2015 12:14:08 GMT
sprint-3 - Updated cache examples.


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

Branch: refs/heads/ignite-688
Commit: 6e84a3b3e4284b4818aec03a51988bdc51de7d54
Parents: 3e6da9c
Author: Dmitiry Setrakyan <dsetrakyan@gridgain.com>
Authored: Thu Apr 9 01:05:54 2015 -0700
Committer: Dmitiry Setrakyan <dsetrakyan@gridgain.com>
Committed: Thu Apr 9 01:05:54 2015 -0700

----------------------------------------------------------------------
 .../ignite/examples/datagrid/CacheAffinityExample.java    |  9 +--------
 .../apache/ignite/examples/datagrid/CacheApiExample.java  |  9 +--------
 .../ignite/examples/datagrid/CacheAsyncApiExample.java    |  9 +--------
 .../examples/datagrid/CacheContinuousQueryExample.java    |  8 +-------
 .../examples/datagrid/CacheDataStreamerExample.java       |  9 +--------
 .../ignite/examples/datagrid/CacheEventsExample.java      |  9 +--------
 .../ignite/examples/datagrid/CachePutGetExample.java      | 10 +---------
 .../ignite/examples/datagrid/CacheTransactionExample.java |  8 ++------
 .../datagrid/hibernate/HibernateL2CacheExample.java       |  5 +----
 .../datagrid/starschema/CacheStarSchemaExample.java       | 10 ++++------
 .../datagrid/store/auto/CacheAutoStoreExample.java        |  8 ++++----
 .../store/auto/CacheAutoStoreLoadDataExample.java         |  5 ++++-
 .../ignite/examples/datagrid/store/auto/CacheConfig.java  |  4 ++--
 .../datagrid/store/dummy/CacheDummyStoreExample.java      |  5 ++++-
 .../store/hibernate/CacheHibernateStoreExample.java       |  5 ++++-
 .../datagrid/store/jdbc/CacheJdbcStoreExample.java        |  5 ++++-
 .../ignite/examples/streaming/StreamVisitorExample.java   |  5 +----
 17 files changed, 37 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java
index 7780e2e..a389dcb 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java
@@ -18,9 +18,7 @@
 package org.apache.ignite.examples.datagrid;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.examples.*;
 import org.apache.ignite.lang.*;
 
@@ -55,12 +53,7 @@ public final class CacheAffinityExample {
             System.out.println();
             System.out.println(">>> Cache affinity example started.");
 
-            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
-
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
-
-            try (IgniteCache<Integer, String> cache = ignite.createCache(cfg)) {
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME))
{
                 for (int i = 0; i < KEY_CNT; i++)
                     cache.put(i, Integer.toString(i));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java
index 35b7ac6..3d06b2e 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java
@@ -18,8 +18,6 @@
 package org.apache.ignite.examples.datagrid;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.examples.*;
 
 import javax.cache.processor.*;
@@ -49,12 +47,7 @@ public class CacheApiExample {
             System.out.println();
             System.out.println(">>> Cache API example started.");
 
-            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
-
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
-
-            try (IgniteCache<Integer, String> cache = ignite.createCache(cfg)) {
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME))
{
                 // Demonstrate atomic map operations.
                 atomicMapOperations(cache);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java
index e7daa09..e9d6e04 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAsyncApiExample.java
@@ -18,8 +18,6 @@
 package org.apache.ignite.examples.datagrid;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.examples.*;
 import org.apache.ignite.lang.*;
 
@@ -49,12 +47,7 @@ public class CacheAsyncApiExample {
             System.out.println();
             System.out.println(">>> Cache asynchronous API example started.");
 
-            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
-
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
-
-            try (IgniteCache<Integer, String> cache = ignite.createCache(cfg)) {
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME))
{
                 // Enable asynchronous mode.
                 IgniteCache<Integer, String> asyncCache = cache.withAsync();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java
index 34014c8..a209d42 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java
@@ -20,7 +20,6 @@ package org.apache.ignite.examples.datagrid;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.query.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.examples.*;
 import org.apache.ignite.lang.*;
 
@@ -51,12 +50,7 @@ public class CacheContinuousQueryExample {
             System.out.println();
             System.out.println(">>> Cache continuous query example started.");
 
-            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
-
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
-
-            try (IgniteCache<Integer, String> cache = ignite.createCache(cfg)) {
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME))
{
                 int keyCnt = 20;
 
                 // These entries will be queried by initial predicate.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheDataStreamerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheDataStreamerExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheDataStreamerExample.java
index db00bab..4994388 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheDataStreamerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheDataStreamerExample.java
@@ -18,8 +18,6 @@
 package org.apache.ignite.examples.datagrid;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.examples.*;
 
 /**
@@ -57,12 +55,7 @@ public class CacheDataStreamerExample {
             System.out.println();
             System.out.println(">>> Cache data streamer example started.");
 
-            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
-
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
-
-            try (IgniteCache<Integer, String> cache = ignite.createCache(cfg)) {
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME))
{
                 long start = System.currentTimeMillis();
 
                 try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(CACHE_NAME))
{

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java
index 1c9e29e..32fab75 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java
@@ -18,8 +18,6 @@
 package org.apache.ignite.examples.datagrid;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.examples.*;
 import org.apache.ignite.lang.*;
@@ -53,12 +51,7 @@ public class CacheEventsExample {
             System.out.println();
             System.out.println(">>> Cache events example started.");
 
-            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
-
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
-
-            try (IgniteCache<Integer, String> cache = ignite.createCache(cfg)) {
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME))
{
                 // This optional local callback is called for each event notification
                 // that passed remote predicate listener.
                 IgniteBiPredicate<UUID, CacheEvent> locLsnr = new IgniteBiPredicate<UUID,
CacheEvent>() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePutGetExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePutGetExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePutGetExample.java
index acb46ed..8fd5376 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePutGetExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePutGetExample.java
@@ -18,8 +18,6 @@
 package org.apache.ignite.examples.datagrid;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.examples.*;
 
 import java.util.*;
@@ -45,13 +43,7 @@ public class CachePutGetExample {
      */
     public static void main(String[] args) throws IgniteException {
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
-
-            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
-
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
-
-            try (IgniteCache<Integer, String> cache = ignite.createCache(cfg)) {
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(CACHE_NAME))
{
                 // Individual puts and gets.
                 putGet(cache);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java
index c24ada1..67f6376 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java
@@ -52,15 +52,11 @@ public class CacheTransactionExample {
             System.out.println();
             System.out.println(">>> Cache transaction example started.");
 
-            CacheConfiguration<Integer, Account> cfg = new CacheConfiguration<>();
+            CacheConfiguration<Integer, Account> cfg = new CacheConfiguration<>(CACHE_NAME);
 
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
             cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
 
-            NearCacheConfiguration<Integer, Account> nearCacheCfg = new NearCacheConfiguration<>();
-
-            try (IgniteCache<Integer, Account> cache = ignite.createCache(cfg, nearCacheCfg))
{
+            try (IgniteCache<Integer, Account> cache = ignite.getOrCreateCache(cfg,
new NearCacheConfiguration<>())) {
                 // Initialize.
                 cache.put(1, new Account(1, 100));
                 cache.put(2, new Account(1, 200));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
index 6bb3f33..af2decf 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
@@ -31,7 +31,6 @@ import java.net.*;
 import java.util.*;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
 
 /**
@@ -188,10 +187,8 @@ public class HibernateL2CacheExample {
      * @return Cache configuration.
      */
     private static IgniteCache createCache(String name, CacheAtomicityMode atomicityMode)
{
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(name);
 
-        ccfg.setName(name);
-        ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
index 302d963..bef2457 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
@@ -73,25 +73,23 @@ public class CacheStarSchemaExample {
             System.out.println();
             System.out.println(">>> Cache star schema example started.");
 
-            CacheConfiguration<Integer, FactPurchase> factCacheCfg = new CacheConfiguration<>();
+            CacheConfiguration<Integer, FactPurchase> factCacheCfg = new CacheConfiguration<>(PARTITIONED_CACHE_NAME);
 
             factCacheCfg.setCacheMode(CacheMode.PARTITIONED);
-            factCacheCfg.setName(PARTITIONED_CACHE_NAME);
             factCacheCfg.setIndexedTypes(
                 Integer.class, FactPurchase.class
             );
 
-            CacheConfiguration<Integer, Object> dimCacheCfg = new CacheConfiguration<>();
+            CacheConfiguration<Integer, Object> dimCacheCfg = new CacheConfiguration<>(REPLICATED_CACHE_NAME);
 
             dimCacheCfg.setCacheMode(CacheMode.REPLICATED);
-            dimCacheCfg.setName(REPLICATED_CACHE_NAME);
             dimCacheCfg.setIndexedTypes(
                 Integer.class, DimStore.class,
                 Integer.class, DimProduct.class
             );
 
-            try (IgniteCache<Integer, FactPurchase> factCache = ignite.createCache(factCacheCfg);
-                 IgniteCache<Integer, Object> dimCache = ignite.createCache(dimCacheCfg))
{
+            try (IgniteCache<Integer, FactPurchase> factCache = ignite.getOrCreateCache(factCacheCfg);
+                 IgniteCache<Integer, Object> dimCache = ignite.getOrCreateCache(dimCacheCfg))
{
                 populateDimensions(dimCache);
                 populateFacts(factCache);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
index abc5fc5..0176451 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
@@ -19,7 +19,6 @@ package org.apache.ignite.examples.datagrid.store.auto;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.store.jdbc.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.examples.*;
 import org.apache.ignite.examples.datagrid.store.*;
 import org.apache.ignite.transactions.*;
@@ -45,6 +44,9 @@ import java.util.*;
  * start node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheAutoStoreExample {
+    /** Cache name. */
+    public static final String CACHE_NAME = CacheAutoStoreLoadDataExample.class.getSimpleName();
+
     /** Global person ID to use across entire example. */
     private static final Long id = Math.abs(UUID.randomUUID().getLeastSignificantBits());
 
@@ -60,9 +62,7 @@ public class CacheAutoStoreExample {
             System.out.println();
             System.out.println(">>> Cache auto store example started.");
 
-            CacheConfiguration<Long, Person> cacheCfg = CacheConfig.jdbcPojoStoreCache();
-
-            try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheCfg))
{
+            try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(CacheConfig.jdbcPojoStoreCache(CACHE_NAME)))
{
                 try (Transaction tx = ignite.transactions().txStart()) {
                     Person val = cache.get(id);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
index 8a3b5c0..4cfd520 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
@@ -42,6 +42,9 @@ import org.apache.ignite.examples.datagrid.store.*;
  * start node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheAutoStoreLoadDataExample {
+    /** Cache name. */
+    public static final String CACHE_NAME = CacheAutoStoreLoadDataExample.class.getSimpleName();
+
     /** Heap size required to run this example. */
     public static final int MIN_MEMORY = 1024 * 1024 * 1024;
 
@@ -58,7 +61,7 @@ public class CacheAutoStoreLoadDataExample {
             System.out.println();
             System.out.println(">>> Cache auto store load data example started.");
 
-            CacheConfiguration<Long, Person> cacheCfg = CacheConfig.jdbcPojoStoreCache();
+            CacheConfiguration<Long, Person> cacheCfg = CacheConfig.jdbcPojoStoreCache(CACHE_NAME);
 
             try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheCfg))
{
                 // Load cache on all data nodes with custom SQL statement.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
index 5c63694..6c148a6 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
@@ -37,8 +37,8 @@ public class CacheConfig {
     /**
      * Configure cache with store.
      */
-    public static CacheConfiguration<Long, Person> jdbcPojoStoreCache() {
-        CacheConfiguration<Long, Person> cfg = new CacheConfiguration<>();
+    public static CacheConfiguration<Long, Person> jdbcPojoStoreCache(String name)
{
+        CacheConfiguration<Long, Person> cfg = new CacheConfiguration<>(name);
 
         // Set atomicity as transaction, since we are showing transactions in the example.
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
index ce103d8..d79b895 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
@@ -37,6 +37,9 @@ import static org.apache.ignite.cache.CacheAtomicityMode.*;
  * start node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheDummyStoreExample {
+    /** Cache name. */
+    private static final String CACHE_NAME = CacheDummyStoreExample.class.getSimpleName();
+
     /** Heap size required to run this example. */
     public static final int MIN_MEMORY = 1024 * 1024 * 1024;
 
@@ -60,7 +63,7 @@ public class CacheDummyStoreExample {
             System.out.println();
             System.out.println(">>> Cache store example started.");
 
-            CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>();
+            CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>(CACHE_NAME);
 
             // Set atomicity as transaction, since we are showing transactions in example.
             cacheCfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
index 7dc80c6..a37bac4 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
@@ -40,6 +40,9 @@ import static org.apache.ignite.cache.CacheAtomicityMode.*;
  * start node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheHibernateStoreExample {
+    /** Cache name. */
+    private static final String CACHE_NAME = CacheHibernateStoreExample.class.getSimpleName();
+
     /** Heap size required to run this example. */
     public static final int MIN_MEMORY = 1024 * 1024 * 1024;
 
@@ -63,7 +66,7 @@ public class CacheHibernateStoreExample {
             System.out.println();
             System.out.println(">>> Cache store example started.");
 
-            CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>();
+            CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>(CACHE_NAME);
 
             // Set atomicity as transaction, since we are showing transactions in example.
             cacheCfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
index 8e68f59..ff8e143 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
@@ -40,6 +40,9 @@ import static org.apache.ignite.cache.CacheAtomicityMode.*;
  * start node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheJdbcStoreExample {
+    /** Cache name. */
+    private static final String CACHE_NAME = CacheJdbcStoreExample.class.getSimpleName();
+
     /** Heap size required to run this example. */
     public static final int MIN_MEMORY = 1024 * 1024 * 1024;
 
@@ -63,7 +66,7 @@ public class CacheJdbcStoreExample {
             System.out.println();
             System.out.println(">>> Cache store example started.");
 
-            CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>();
+            CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>(CACHE_NAME);
 
             // Set atomicity as transaction, since we are showing transactions in example.
             cacheCfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6e84a3b3/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
index 01259ff..0fbce68 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamVisitorExample.java
@@ -55,9 +55,6 @@ public class StreamVisitorExample {
             if (!ExamplesUtils.hasServerNodes(ignite))
                 return;
 
-            // Market data cache with default configuration.
-            CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<>("marketTicks");
-
             // Financial instrument cache configuration.
             CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
 
@@ -67,7 +64,7 @@ public class StreamVisitorExample {
 
             // Auto-close caches at the end of the example.
             try (
-                IgniteCache<String, Double> mktCache = ignite.getOrCreateCache(mktDataCfg);
+                IgniteCache<String, Double> mktCache = ignite.getOrCreateCache("marketTicks");
// Default config.
                 IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(instCfg)
             ) {
                 try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName()))
{


Mime
View raw message