ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [24/50] [abbrv] incubator-ignite git commit: # ignite-42
Date Thu, 22 Jan 2015 20:54:52 GMT
# ignite-42


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

Branch: refs/heads/ignite-53
Commit: 8d9c72c100b5d22a59d03985cbb9bffc850346b7
Parents: 3f082cf
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Jan 22 12:11:04 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Jan 22 12:11:04 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheLoaderWriterStore.java       | 14 ++++
 .../processors/cache/GridCacheProcessor.java    | 12 +++-
 .../processors/cache/GridCacheStoreManager.java |  2 +-
 .../IgniteCacheLoaderWriterAbstractTest.java    | 68 +++++++++++++++++++-
 .../IgniteCacheTxStoreSessionTest.java          |  1 +
 5 files changed, 93 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d9c72c1/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheLoaderWriterStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheLoaderWriterStore.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheLoaderWriterStore.java
index 70a7880..2ab84d4 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheLoaderWriterStore.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheLoaderWriterStore.java
@@ -48,6 +48,20 @@ class GridCacheLoaderWriterStore<K, V> extends CacheStore<K, V>
implements Lifec
         this.writer = writer;
     }
 
+    /**
+     * @return Cache loader.
+     */
+    CacheLoader<K, V> loader() {
+        return ldr;
+    }
+
+    /**
+     * @return Cache writer.
+     */
+    CacheWriter<K, V> writer() {
+        return writer;
+    }
+
     /** {@inheritDoc} */
     @Override public void start() throws IgniteCheckedException {
         if (ldr instanceof LifecycleAware)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d9c72c1/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java
index b129ac6..cb683d1 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProcessor.java
@@ -618,7 +618,17 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             if (!sysCaches.contains(cfg.getName()))
                 suggestOptimizations(cfg, cfgStore != null);
 
-            prepare(cfg, jta.tmLookup(), cfgStore);
+            List<Object> toPrepare = new ArrayList<>();
+
+            toPrepare.add(jta.tmLookup());
+            toPrepare.add(cfgStore);
+
+            if (cfgStore instanceof GridCacheLoaderWriterStore) {
+                toPrepare.add(((GridCacheLoaderWriterStore)cfgStore).loader());
+                toPrepare.add(((GridCacheLoaderWriterStore)cfgStore).writer());
+            }
+
+            prepare(cfg, toPrepare.toArray(new Object[toPrepare.size()]));
 
             U.startLifecycleAware(lifecycleAwares(cfg, jta.tmLookup(), cfgStore));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d9c72c1/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java
index 728dd57..a35f817 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java
@@ -316,7 +316,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K,
V> {
     /**
      * @param tx Cache transaction.
      * @param keys Cache keys.
-     * @param vis Closer to cache loaded elements.
+     * @param vis Closure to apply for loaded elements.
      * @throws IgniteCheckedException If data loading failed.
      */
     public void localStoreLoadAll(@Nullable IgniteTx tx,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d9c72c1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
index 8bff838..17282f6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoaderWriterAbstractTest.java
@@ -19,6 +19,8 @@ package org.apache.ignite.internal.processors.cache.integration;
 
 import org.apache.ignite.*;
 import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.lifecycle.*;
+import org.apache.ignite.resources.*;
 import org.jdk8.backport.*;
 
 import javax.cache.*;
@@ -221,9 +223,32 @@ public abstract class IgniteCacheLoaderWriterAbstractTest extends IgniteCacheAbs
     /**
      *
      */
-    class TestLoader implements CacheLoader<Object, Object> {
+    class TestLoader implements CacheLoader<Object, Object>, LifecycleAware {
+        /** */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /** */
+        private boolean startCalled;
+
+        /** {@inheritDoc} */
+        @Override public void start() throws IgniteCheckedException {
+            startCalled = true;
+
+            assertNotNull(ignite);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void stop() throws IgniteCheckedException {
+            // No-op.
+        }
+
         /** {@inheritDoc} */
         @Override public Object load(Object key) {
+            assertTrue(startCalled);
+
+            assertNotNull(ignite);
+
             log.info("Load: " + key);
 
             ldrCallCnt.incrementAndGet();
@@ -233,6 +258,10 @@ public abstract class IgniteCacheLoaderWriterAbstractTest extends IgniteCacheAbs
 
         /** {@inheritDoc} */
         @Override public Map<Object, Object> loadAll(Iterable<?> keys) {
+            assertTrue(startCalled);
+
+            assertNotNull(ignite);
+
             log.info("LoadAll: " + keys);
 
             ldrCallCnt.incrementAndGet();
@@ -253,9 +282,32 @@ public abstract class IgniteCacheLoaderWriterAbstractTest extends IgniteCacheAbs
     /**
      *
      */
-    class TestWriter implements CacheWriter<Integer, Integer> {
+    class TestWriter implements CacheWriter<Integer, Integer>, LifecycleAware {
+        /** */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /** */
+        private boolean startCalled;
+
+        /** {@inheritDoc} */
+        @Override public void start() throws IgniteCheckedException {
+            startCalled = true;
+
+            assertNotNull(ignite);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void stop() throws IgniteCheckedException {
+            // No-op.
+        }
+
         /** {@inheritDoc} */
         @Override public void write(Cache.Entry<? extends Integer, ? extends Integer>
e) {
+            assertTrue(startCalled);
+
+            assertNotNull(ignite);
+
             log.info("Write: " + e);
 
             writerCallCnt.incrementAndGet();
@@ -265,6 +317,10 @@ public abstract class IgniteCacheLoaderWriterAbstractTest extends IgniteCacheAbs
 
         /** {@inheritDoc} */
         @Override public void writeAll(Collection<Cache.Entry<? extends Integer, ?
extends Integer>> entries) {
+            assertTrue(startCalled);
+
+            assertNotNull(ignite);
+
             log.info("WriteAll: " + entries);
 
             writerCallCnt.incrementAndGet();
@@ -275,6 +331,10 @@ public abstract class IgniteCacheLoaderWriterAbstractTest extends IgniteCacheAbs
 
         /** {@inheritDoc} */
         @Override public void delete(Object key) {
+            assertTrue(startCalled);
+
+            assertNotNull(ignite);
+
             log.info("Delete: " + key);
 
             writerCallCnt.incrementAndGet();
@@ -284,6 +344,10 @@ public abstract class IgniteCacheLoaderWriterAbstractTest extends IgniteCacheAbs
 
         /** {@inheritDoc} */
         @Override public void deleteAll(Collection<?> keys) {
+            assertTrue(startCalled);
+
+            assertNotNull(ignite);
+
             log.info("DeleteAll: " + keys);
 
             writerCallCnt.incrementAndGet();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d9c72c1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
index 99900cb..f04dcca 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
@@ -248,6 +248,7 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
     /**
      * @throws Exception If failed.
      */
+    // TODO IGNITE-109: fix test when fixed.
     public void testSessionCrossCacheTx() throws Exception {
         IgniteCache<Object, Object> cache0 = ignite(0).jcache(null);
 


Mime
View raw message