ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [02/23] incubator-ignite git commit: # ignite-265
Date Mon, 16 Feb 2015 12:56:30 GMT
# ignite-265


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

Branch: refs/heads/ignite-public-api-cleanup
Commit: 9cd987c52c9bc64147d64d8cc9480c412a9ea7ee
Parents: 9f5b287
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Feb 16 11:10:44 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Feb 16 11:51:20 2015 +0300

----------------------------------------------------------------------
 .../store/dummy/CacheDummyPersonStore.java      | 11 +++
 .../hibernate/CacheHibernatePersonStore.java    | 12 +++
 .../store/jdbc/CacheJdbcPersonStore.java        | 11 ++-
 .../cache/store/CacheLoadOnlyStoreAdapter.java  |  2 +-
 .../apache/ignite/cache/store/CacheStore.java   | 31 +-------
 .../ignite/cache/store/CacheStoreAdapter.java   |  2 +-
 .../ignite/cache/store/CacheStoreSession.java   |  3 +
 .../store/jdbc/CacheAbstractJdbcStore.java      | 24 +++++-
 .../cache/store/jdbc/CacheJdbcBlobStore.java    | 11 +++
 .../configuration/CacheConfiguration.java       | 14 ++--
 .../cache/CacheStoreBalancingWrapper.java       |  2 +-
 .../cache/GridCacheLoaderWriterStore.java       |  2 +-
 .../processors/cache/GridCacheProcessor.java    |  2 +-
 .../processors/cache/GridCacheStoreManager.java | 84 ++++++++++++--------
 .../cache/GridCacheWriteBehindStore.java        |  2 +-
 .../processors/query/GridQueryProcessor.java    |  6 +-
 .../processors/resource/GridResourceIoc.java    | 48 ++++++++---
 .../resource/GridResourceProcessor.java         | 21 +++++
 .../resources/CacheStoreSessionResource.java    | 41 ++++++++++
 .../store/GridCacheBalancingStoreSelfTest.java  |  2 +-
 .../cache/store/GridGeneratingTestStore.java    |  2 +-
 .../store/jdbc/CacheJdbcPojoStoreTest.java      |  2 +-
 ...idCacheConfigurationConsistencySelfTest.java |  2 +-
 .../cache/GridCacheGenericTestStore.java        |  2 +-
 .../cache/GridCacheLifecycleAwareSelfTest.java  |  2 +-
 .../cache/GridCacheStorePutxSelfTest.java       |  2 +-
 .../processors/cache/GridCacheTestStore.java    | 15 +++-
 .../IgniteTxStoreExceptionAbstractSelfTest.java |  2 +-
 .../IgniteCrossCacheTxStoreSelfTest.java        | 14 +++-
 .../IgniteCacheStoreSessionAbstractTest.java    | 20 ++++-
 .../cache/GridAbstractCacheStoreSelfTest.java   |  2 +-
 .../hibernate/CacheHibernateBlobStore.java      | 11 +++
 .../cache/VisorCacheClearCommandSpec.scala      |  4 +-
 .../commands/cache/VisorCacheCommandSpec.scala  |  4 +-
 .../cache/VisorCacheCompactCommandSpec.scala    |  4 +-
 .../cswap/VisorCacheSwapCommandSpec.scala       |  4 +-
 36 files changed, 309 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
index ab836d1..640cbfd 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
@@ -40,6 +40,10 @@ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> {
     @CacheNameResource
     private String cacheName;
 
+    /** */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
     /** Dummy database. */
     private Map<Long, Person> dummyDB = new ConcurrentHashMap<>();
 
@@ -106,4 +110,11 @@ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> {
 
         return ses != null ? ses.transaction() : null;
     }
+
+    /**
+     * @return Store session.
+     */
+    private CacheStoreSession session() {
+        return ses;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
index d1cab09..9549598 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
@@ -20,6 +20,7 @@ package org.apache.ignite.examples.datagrid.store.hibernate;
 import org.apache.ignite.cache.store.*;
 import org.apache.ignite.examples.datagrid.store.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
 import org.apache.ignite.transactions.Transaction;
 import org.hibernate.*;
 import org.hibernate.cfg.*;
@@ -42,6 +43,10 @@ public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> {
     /** Session factory. */
     private SessionFactory sesFactory;
 
+    /** Auto-injected store session. */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
     /**
      * Default constructor.
      */
@@ -275,4 +280,11 @@ public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> {
 
         return ses != null ? ses.transaction() : null;
     }
+
+    /**
+     * @return Store session.
+     */
+    private CacheStoreSession session() {
+        return ses;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
index d17fc87..6388fbf 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.cache.store.*;
 import org.apache.ignite.examples.datagrid.store.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
 
@@ -38,6 +39,10 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
     /** Transaction metadata attribute name. */
     private static final String ATTR_NAME = "SIMPLE_STORE_CONNECTION";
 
+    /** Auto-injected store session. */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
     /**
      * Constructor.
      *
@@ -69,7 +74,7 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
     @Override public void txEnd(boolean commit) {
         Transaction tx = transaction();
 
-        Map<String, Connection> props = session().properties();
+        Map<String, Connection> props = ses.properties();
 
         try (Connection conn = props.remove(ATTR_NAME)) {
             if (conn != null) {
@@ -230,7 +235,7 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
      */
     private Connection connection(@Nullable Transaction tx) throws SQLException  {
         if (tx != null) {
-            Map<Object, Object> props = session().properties();
+            Map<Object, Object> props = ses.properties();
 
             Connection conn = (Connection)props.get(ATTR_NAME);
 
@@ -298,8 +303,6 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
      * @return Current transaction.
      */
     @Nullable private Transaction transaction() {
-        CacheStoreSession ses = session();
-
         return ses != null ? ses.transaction() : null;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java
index 9b6db74..b4bcd6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheLoadOnlyStoreAdapter.java
@@ -68,7 +68,7 @@ import static java.util.concurrent.TimeUnit.*;
  * @param <V> Value type.
  * @param <I> Input type.
  */
-public abstract class CacheLoadOnlyStoreAdapter<K, V, I> extends CacheStore<K, V> {
+public abstract class CacheLoadOnlyStoreAdapter<K, V, I> implements CacheStore<K, V> {
     /**
      * Default batch size (number of records read with {@link #inputIterator(Object...)}
      * and then submitted to internal pool at a time).

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java
index 3565f09..848df39 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java
@@ -17,10 +17,8 @@
 
 package org.apache.ignite.cache.store;
 
-import org.apache.ignite.*;
 import org.apache.ignite.cache.store.jdbc.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.resources.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
 
@@ -117,14 +115,7 @@ import static javax.cache.Cache.*;
  *
  * @see CacheStoreSession
  */
-public abstract class CacheStore<K, V> implements CacheLoader<K, V>, CacheWriter<K, V> {
-    /** */
-    private CacheStoreSession ses;
-
-    /** */
-    @IgniteInstanceResource
-    private Ignite ignite;
-
+public interface CacheStore<K, V> extends CacheLoader<K, V>, CacheWriter<K, V> {
     /**
      * Loads all values from underlying persistent storage. Note that keys are not
      * passed, so it is up to implementation to figure out what to load. This method
@@ -144,7 +135,7 @@ public abstract class CacheStore<K, V> implements CacheLoader<K, V>, CacheWriter
      *      {@link org.apache.ignite.cache.GridCache#loadCache(org.apache.ignite.lang.IgniteBiPredicate, long, Object...)} method.
      * @throws CacheLoaderException If loading failed.
      */
-    public abstract void loadCache(IgniteBiInClosure<K, V> clo, @Nullable Object... args) throws CacheLoaderException;
+    public void loadCache(IgniteBiInClosure<K, V> clo, @Nullable Object... args) throws CacheLoaderException;
 
     /**
      * Tells store to commit or rollback a transaction depending on the value of the {@code 'commit'}
@@ -155,21 +146,5 @@ public abstract class CacheStore<K, V> implements CacheLoader<K, V>, CacheWriter
      *      may bring cache transaction into {@link TransactionState#UNKNOWN} which will
      *      consequently cause all transacted entries to be invalidated.
      */
-    public abstract void txEnd(boolean commit) throws CacheWriterException;
-
-    /**
-     * Gets session for current cache operation. Returns {@code null} if store is used with atomic cache.
-     *
-     * @return Session for current cache operation.
-     */
-    public CacheStoreSession session() {
-        return ses;
-    }
-
-    /**
-     * @return {@link Ignite} instance.
-     */
-    public Ignite ignite() {
-        return ignite;
-    }
+    public void txEnd(boolean commit) throws CacheWriterException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreAdapter.java b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreAdapter.java
index c166480..794281b 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreAdapter.java
@@ -36,7 +36,7 @@ import java.util.*;
  * implementation because it is essentially up to the user to invoke it with
  * specific arguments.
  */
-public abstract class CacheStoreAdapter<K, V> extends CacheStore<K, V> {
+public abstract class CacheStoreAdapter<K, V> implements CacheStore<K, V> {
     /**
      * Default empty implementation. This method needs to be overridden only if
      * {@link org.apache.ignite.cache.GridCache#loadCache(IgniteBiPredicate, long, Object...)} method

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSession.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSession.java b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSession.java
index 2fdd68f..0bfc6fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSession.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStoreSession.java
@@ -17,12 +17,15 @@
 
 package org.apache.ignite.cache.store;
 
+import org.apache.ignite.resources.*;
 import org.apache.ignite.transactions.*;
 
 import java.util.*;
 
 /**
  * Session for the cache store operations.
+ *
+ * @see CacheStoreSessionResource
  */
 public interface CacheStoreSession {
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index 31ee5b5..7c6f060 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -76,7 +76,7 @@ import static java.sql.Statement.*;
  * <p>
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
  */
-public abstract class CacheAbstractJdbcStore<K, V> extends CacheStore<K, V> implements LifecycleAware {
+public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>, LifecycleAware {
     /** Max attempt write count. */
     protected static final int MAX_ATTEMPT_WRITE_COUNT = 2;
 
@@ -92,6 +92,14 @@ public abstract class CacheAbstractJdbcStore<K, V> extends CacheStore<K, V> impl
     /** Empty column value. */
     protected static final Object[] EMPTY_COLUMN_VALUE = new Object[] { null };
 
+    /** Auto-injected store session. */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
+    /** Auto injected ignite instance. */
+    @IgniteInstanceResource
+    private Ignite ignite;
+
     /** Auto-injected logger instance. */
     @LoggerResource
     protected IgniteLogger log;
@@ -1231,6 +1239,20 @@ public abstract class CacheAbstractJdbcStore<K, V> extends CacheStore<K, V> impl
     }
 
     /**
+     * @return Ignite instance.
+     */
+    protected Ignite ignite() {
+        return ignite;
+    }
+
+    /**
+     * @return Store session.
+     */
+    protected CacheStoreSession session() {
+        return ses;
+    }
+
+    /**
      * Entry mapping description.
      */
     protected static class EntryMapping {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java
index 3b247be..90d62b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java
@@ -142,6 +142,10 @@ public class CacheJdbcBlobStore<K, V> extends CacheStoreAdapter<K, V> {
     /** Flag for schema initialization. */
     private boolean initSchema = true;
 
+    /** Auto-injected store session. */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
     /** Log. */
     @LoggerResource
     private IgniteLogger log;
@@ -582,4 +586,11 @@ public class CacheJdbcBlobStore<K, V> extends CacheStoreAdapter<K, V> {
 
         return ses != null ? ses.transaction() : null;
     }
+
+    /**
+     * @return Store session.
+     */
+    protected CacheStoreSession session() {
+        return ses;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 84c047c..a45839b 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -41,7 +41,7 @@ import java.util.*;
  * properties are optional, so users should only change what they need.
  */
 @SuppressWarnings("RedundantFieldInitialization")
-public class CacheConfiguration extends MutableConfiguration {
+public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     /** Default size of preload thread pool. */
     public static final int DFLT_PRELOAD_THREAD_POOL_SIZE = 2;
 
@@ -686,9 +686,9 @@ public class CacheConfiguration extends MutableConfiguration {
 
     /**
      * Gets eviction filter to specify which entries should not be evicted
-     * (except explicit evict by calling {@link Entry#evict()}).
-     * If {@link org.apache.ignite.cache.eviction.CacheEvictionFilter#evictAllowed(Entry)} method returns
-     * {@code false} then eviction policy will not be notified and entry will
+     * (except explicit evict by calling {@link IgniteCache#localEvict(Collection)}).
+     * If {@link org.apache.ignite.cache.eviction.CacheEvictionFilter#evictAllowed(javax.cache.Cache.Entry)} method
+     * returns {@code false} then eviction policy will not be notified and entry will
      * never be evicted.
      * <p>
      * If not provided, any entry may be evicted depending on
@@ -697,7 +697,7 @@ public class CacheConfiguration extends MutableConfiguration {
      * @return Eviction filter or {@code null}.
      */
     @SuppressWarnings("unchecked")
-    public <K, V> CacheEvictionFilter<K, V> getEvictionFilter() {
+    public CacheEvictionFilter<K, V> getEvictionFilter() {
         return (CacheEvictionFilter<K, V>)evictFilter;
     }
 
@@ -706,7 +706,7 @@ public class CacheConfiguration extends MutableConfiguration {
      *
      * @param evictFilter Eviction filter.
      */
-    public <K, V> void setEvictionFilter(CacheEvictionFilter<K, V> evictFilter) {
+    public void setEvictionFilter(CacheEvictionFilter<K, V> evictFilter) {
         this.evictFilter = evictFilter;
     }
 
@@ -717,7 +717,7 @@ public class CacheConfiguration extends MutableConfiguration {
      * When not set, default value is {@link #DFLT_EAGER_TTL}.
      * <p>
      * <b>Note</b> that this flag only matters for entries expiring based on
-     * {@link Entry#timeToLive()} value and should not be confused with entry
+     * {@link javax.cache.expiry.ExpiryPolicy} and should not be confused with entry
      * evictions based on configured {@link org.apache.ignite.cache.eviction.CacheEvictionPolicy}.
      *
      * @return Flag indicating whether Ignite will eagerly remove expired entries.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java
index 9013fcb..394bcfb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheStoreBalancingWrapper.java
@@ -33,7 +33,7 @@ import java.util.concurrent.*;
 /**
  * Cache store wrapper that ensures that there will be no more that one thread loading value from underlying store.
  */
-public class CacheStoreBalancingWrapper<K, V> extends CacheStore<K, V> {
+public class CacheStoreBalancingWrapper<K, V> implements CacheStore<K, V> {
     /** */
     public static final int DFLT_LOAD_ALL_THRESHOLD = 5;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java
index 291afe6..30c84e9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java
@@ -29,7 +29,7 @@ import java.util.*;
 /**
  * Store implementation wrapping {@link CacheLoader} and {@link CacheWriter}.
  */
-class GridCacheLoaderWriterStore<K, V> extends CacheStore<K, V> implements LifecycleAware {
+class GridCacheLoaderWriterStore<K, V> implements CacheStore<K, V>, LifecycleAware {
     /** */
     private final CacheLoader<K, V> ldr;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index c03ecbb..d038e91 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -587,7 +587,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         IdentityHashMap<CacheStore, ThreadLocal> sesHolders = new IdentityHashMap<>();
 
         for (int i = 0; i < cfgs.length; i++) {
-            CacheConfiguration cfg = new CacheConfiguration(cfgs[i]);
+            CacheConfiguration<?, ?> cfg = new CacheConfiguration(cfgs[i]);
 
             // Initialize defaults.
             initialize(cfg);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
index 5a17b4f..54420e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
@@ -48,9 +48,6 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
     private static final String SES_ATTR = "STORE_SES";
 
     /** */
-    private static final String SES_FIELD_NAME = "ses";
-
-    /** */
     private final CacheStore<K, Object> store;
 
     /** */
@@ -69,6 +66,9 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
     private final boolean writeThrough;
 
     /** */
+    private final boolean sesEnabled;
+
+    /** */
     private boolean convertPortable;
 
     /**
@@ -94,32 +94,33 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
 
         ThreadLocal<SessionData> sesHolder0 = null;
 
-        if (cfgStore != null) {
-            try {
-                if (!sesHolders.containsKey(cfgStore)) {
-                    sesHolder0 = new ThreadLocal<>();
+        boolean sesEnabled0 = false;
 
-                    Field sesField = CacheStore.class.getDeclaredField(SES_FIELD_NAME);
-
-                    sesField.setAccessible(true);
+        if (cfgStore != null) {
+            if (!sesHolders.containsKey(cfgStore)) {
+                sesHolder0 = new ThreadLocal<>();
 
-                    sesField.set(cfgStore, new ThreadLocalSession(sesHolder0));
+                sesEnabled0 = ctx.resource().injectStoreSession(cfgStore, new ThreadLocalSession(sesHolder0));
 
+                if (sesEnabled0)
                     sesHolders.put(cfgStore, sesHolder0);
-                }
                 else
-                    sesHolder0 = sesHolders.get(cfgStore);
+                    sesHolder0 = null;
             }
-            catch (IllegalAccessException | NoSuchFieldException e) {
-                throw new IgniteCheckedException(e);
+            else {
+                sesHolder0 = sesHolders.get(cfgStore);
+
+                sesEnabled0 = true;
             }
         }
 
+        sesEnabled = sesEnabled0;
+
         sesHolder = sesHolder0;
 
         locStore = U.hasAnnotation(cfgStore, CacheLocalStore.class);
 
-        assert sesHolder != null || cfgStore == null;
+        assert sesHolder != null || !sesEnabled;
     }
 
     /**
@@ -271,7 +272,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
             if (log.isDebugEnabled())
                 log.debug("Loading value from store for key: " + key);
 
-            initSession(tx);
+            boolean ses = initSession(tx);
 
             Object val = null;
 
@@ -288,7 +289,8 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                 throw new IgniteCheckedException(new CacheLoaderException(e));
             }
             finally {
-                sesHolder.set(null);
+                if (ses)
+                    sesHolder.set(null);
             }
 
             if (log.isDebugEnabled())
@@ -413,7 +415,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
             if (log.isDebugEnabled())
                 log.debug("Loading values from store for keys: " + keys0);
 
-            initSession(tx);
+            boolean ses = initSession(tx);
 
             try {
                 IgniteBiInClosure<K,Object> c = new CI2<K, Object>() {
@@ -459,7 +461,8 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                 throw new IgniteCheckedException(new CacheLoaderException(e));
             }
             finally {
-                sesHolder.set(null);
+                if (ses)
+                    sesHolder.set(null);
             }
 
             if (log.isDebugEnabled())
@@ -482,7 +485,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
             if (log.isDebugEnabled())
                 log.debug("Loading all values from store.");
 
-            initSession(null);
+            boolean ses = initSession(null);
 
             try {
                 store.loadCache(new IgniteBiInClosure<K, Object>() {
@@ -510,7 +513,8 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                 throw new IgniteCheckedException(new CacheLoaderException(e));
             }
             finally {
-                sesHolder.set(null);
+                if (ses)
+                    sesHolder.set(null);
             }
 
             if (log.isDebugEnabled())
@@ -551,7 +555,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
             if (log.isDebugEnabled())
                 log.debug("Storing value in cache store [key=" + key + ", val=" + val + ']');
 
-            initSession(tx);
+            boolean ses = initSession(tx);
 
             try {
                 store.write(new CacheEntryImpl<>(key, locStore ? F.t(val, ver) : val));
@@ -566,7 +570,8 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                 throw new IgniteCheckedException(new CacheWriterException(e));
             }
             finally {
-                sesHolder.set(null);
+                if (ses)
+                    sesHolder.set(null);
             }
 
             if (log.isDebugEnabled())
@@ -603,7 +608,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                 if (log.isDebugEnabled())
                     log.debug("Storing values in cache store [entries=" + entries + ']');
 
-                initSession(tx);
+                boolean ses = initSession(tx);
 
                 try {
                     store.writeAll(entries);
@@ -627,7 +632,8 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                     throw new IgniteCheckedException(e);
                 }
                 finally {
-                    sesHolder.set(null);
+                    if (ses)
+                        sesHolder.set(null);
                 }
 
                 if (log.isDebugEnabled())
@@ -659,7 +665,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
             if (log.isDebugEnabled())
                 log.debug("Removing value from cache store [key=" + key + ']');
 
-            initSession(tx);
+            boolean ses = initSession(tx);
 
             try {
                 store.delete(key);
@@ -674,7 +680,8 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                 throw new IgniteCheckedException(new CacheWriterException(e));
             }
             finally {
-                sesHolder.set(null);
+                if (ses)
+                    sesHolder.set(null);
             }
 
             if (log.isDebugEnabled())
@@ -710,7 +717,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
             if (log.isDebugEnabled())
                 log.debug("Removing values from cache store [keys=" + keys0 + ']');
 
-            initSession(tx);
+            boolean ses = initSession(tx);
 
             try {
                 store.deleteAll(keys0);
@@ -728,7 +735,8 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
                 throw new IgniteCheckedException(e);
             }
             finally {
-                sesHolder.set(null);
+                if (ses)
+                    sesHolder.set(null);
             }
 
             if (log.isDebugEnabled())
@@ -763,15 +771,17 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
     public void txEnd(IgniteInternalTx tx, boolean commit) throws IgniteCheckedException {
         assert store != null;
 
-        initSession(tx);
+        boolean ses = initSession(tx);
 
         try {
             store.txEnd(commit);
         }
         finally {
-            sesHolder.set(null);
+            if (ses) {
+                sesHolder.set(null);
 
-            tx.removeMeta(SES_ATTR);
+                tx.removeMeta(SES_ATTR);
+            }
         }
     }
 
@@ -792,8 +802,12 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
 
     /**
      * @param tx Current transaction.
+     * @return {@code True} if session
      */
-    private void initSession(@Nullable IgniteInternalTx<?, ?> tx) {
+    private boolean initSession(@Nullable IgniteInternalTx<?, ?> tx) {
+        if (!sesEnabled)
+            return false;
+
         SessionData ses;
 
         if (tx != null) {
@@ -812,6 +826,8 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
             ses = new SessionData(null, cctx.name());
 
         sesHolder.set(ses);
+
+        return true;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java
index 084ebbd..eb6120a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java
@@ -55,7 +55,7 @@ import static javax.cache.Cache.*;
  * Since write operations to the cache store are deferred, transaction support is lost; no
  * transaction objects are passed to the underlying store.
  */
-public class GridCacheWriteBehindStore<K, V> extends CacheStore<K, V> implements LifecycleAware {
+public class GridCacheWriteBehindStore<K, V> implements CacheStore<K, V>, LifecycleAware {
     /** Default write cache initial capacity. */
     public static final int DFLT_INITIAL_CAPACITY = 1024;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 415f76d..1a68619 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -107,7 +107,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
             idx.start(ctx);
 
-            for (CacheConfiguration ccfg : ctx.config().getCacheConfiguration()){
+            for (CacheConfiguration<?, ?> ccfg : ctx.config().getCacheConfiguration()){
                 CacheQueryConfiguration qryCfg = ccfg.getQueryConfiguration();
 
                 if (qryCfg != null) {
@@ -647,7 +647,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         if (portableIds == null) {
             portableIds = new HashMap<>();
 
-            for (CacheConfiguration ccfg : ctx.config().getCacheConfiguration()){
+            for (CacheConfiguration<?, ?> ccfg : ctx.config().getCacheConfiguration()){
                 CacheQueryConfiguration qryCfg = ccfg.getQueryConfiguration();
 
                 if (qryCfg != null) {
@@ -673,7 +673,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         if (declaredTypesById == null) {
             declaredTypesById = new HashMap<>();
 
-            for (CacheConfiguration ccfg : ctx.config().getCacheConfiguration()){
+            for (CacheConfiguration<?, ?> ccfg : ctx.config().getCacheConfiguration()){
                 CacheQueryConfiguration qryCfg = ccfg.getQueryConfiguration();
 
                 if (qryCfg != null) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index 4b47545..03d81f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -99,16 +99,25 @@ class GridResourceIoc {
      * @param dep Deployment.
      * @param depCls Deployment class.
      * @throws IgniteCheckedException Thrown in case of any errors during injection.
+     * @return {@code True} if resource was injected.
      */
-    void inject(Object target, Class<? extends Annotation> annCls, GridResourceInjector injector,
-        @Nullable GridDeployment dep, @Nullable Class<?> depCls) throws IgniteCheckedException {
+    @SuppressWarnings("SimplifiableIfStatement")
+    boolean inject(Object target,
+        Class<? extends Annotation> annCls,
+        GridResourceInjector injector,
+        @Nullable GridDeployment dep,
+        @Nullable Class<?> depCls)
+        throws IgniteCheckedException
+    {
         assert target != null;
         assert annCls != null;
         assert injector != null;
 
         if (isAnnotationPresent(target, annCls, dep))
             // Use identity hash set to compare via referential equality.
-            injectInternal(target, annCls, injector, dep, depCls, new GridIdentityHashSet<>(3));
+            return injectInternal(target, annCls, injector, dep, depCls, new GridIdentityHashSet<>(3));
+
+        return false;
     }
 
     /**
@@ -119,9 +128,16 @@ class GridResourceIoc {
      * @param depCls Deployment class.
      * @param checkedObjs Set of already inspected objects to avoid indefinite recursion.
      * @throws IgniteCheckedException Thrown in case of any errors during injection.
+     * @return {@code True} if resource was injected.
      */
-    private void injectInternal(Object target, Class<? extends Annotation> annCls, GridResourceInjector injector,
-        @Nullable GridDeployment dep, @Nullable Class<?> depCls, Set<Object> checkedObjs) throws IgniteCheckedException {
+    private boolean injectInternal(Object target,
+        Class<? extends Annotation> annCls,
+        GridResourceInjector injector,
+        @Nullable GridDeployment dep,
+        @Nullable Class<?> depCls,
+        Set<Object> checkedObjs)
+        throws IgniteCheckedException
+    {
         assert target != null;
         assert annCls != null;
         assert injector != null;
@@ -133,16 +149,18 @@ class GridResourceIoc {
 
         // Skip this class if it does not need to be injected.
         if (skipClss != null && skipClss.contains(targetCls))
-            return;
+            return false;
 
         // Check if already inspected to avoid indefinite recursion.
         if (checkedObjs.contains(target))
-            return;
+            return false;
 
         checkedObjs.add(target);
 
         int annCnt = 0;
 
+        boolean injected = false;
+
         for (GridResourceField field : getFieldsWithAnnotation(dep, targetCls, annCls)) {
             Field f = field.getField();
 
@@ -152,24 +170,32 @@ class GridResourceIoc {
                 try {
                     Object obj = f.get(target);
 
-                    if (obj != null)
+                    if (obj != null) {
                         // Recursion.
-                        injectInternal(obj, annCls, injector, dep, depCls, checkedObjs);
+                        boolean injected0 = injectInternal(obj, annCls, injector, dep, depCls, checkedObjs);
+
+                        injected |= injected0;
+                    }
                 }
                 catch (IllegalAccessException e) {
                     throw new IgniteCheckedException("Failed to inject resource [field=" + f.getName() +
                         ", target=" + target + ']', e);
                 }
             }
-            else
+            else {
                 injector.inject(field, target, depCls, dep);
 
+                injected = true;
+            }
+
             annCnt++;
         }
 
         for (GridResourceMethod mtd : getMethodsWithAnnotation(dep, targetCls, annCls)) {
             injector.inject(mtd, target, depCls, dep);
 
+            injected = true;
+
             annCnt++;
         }
 
@@ -181,6 +207,8 @@ class GridResourceIoc {
 
             skipClss.add(targetCls);
         }
+
+        return injected;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
index 83ee983..555754f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.resource;
 
 import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.managers.deployment.*;
@@ -200,6 +201,26 @@ public class GridResourceProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * Injects cache store session into given object.
+     *
+     * @param obj Object.
+     * @param ses Session to inject.
+     * @return {@code True} if session was injected.
+     * @throws IgniteCheckedException If failed to inject.
+     */
+    public boolean injectStoreSession(Object obj, CacheStoreSession ses) throws IgniteCheckedException {
+        assert obj != null;
+
+        if (log.isDebugEnabled())
+            log.debug("Injecting cache store session: " + obj);
+
+        // Unwrap Proxy object.
+        obj = unwrapTarget(obj);
+
+        return ioc.inject(obj, CacheStoreSessionResource.class, new GridResourceBasicInjector<>(ses), null, null);
+    }
+
+    /**
      * @param obj Object to inject.
      * @throws IgniteCheckedException If failed to inject.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/main/java/org/apache/ignite/resources/CacheStoreSessionResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/CacheStoreSessionResource.java b/modules/core/src/main/java/org/apache/ignite/resources/CacheStoreSessionResource.java
new file mode 100644
index 0000000..b75b796
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/resources/CacheStoreSessionResource.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.resources;
+
+import java.lang.annotation.*;
+
+/**
+ * Annotates a field or a setter method for injection of current {@link org.apache.ignite.cache.store.CacheStoreSession}
+ * instance. It can be injected into {@link org.apache.ignite.cache.store.CacheStore}.
+ * <p>
+ * Here is how injection would typically happen:
+ * <pre name="code" class="java">
+ * public class MyCacheStore implements CacheStore {
+ *      ...
+ *      &#64;CacheStoreSessionResource
+ *      private CacheStoreSession ses;
+ *      ...
+ *  }
+ * </pre>
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.FIELD})
+public @interface CacheStoreSessionResource {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
index 38055dc..d53e275 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
@@ -114,7 +114,7 @@ public class GridCacheBalancingStoreSelfTest extends GridCommonAbstractTest {
     /**
      *
      */
-    private static class VerifyStore extends CacheStore<Integer, Integer> {
+    private static class VerifyStore implements CacheStore<Integer, Integer> {
         /** */
         private Lock[] locks;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/cache/store/GridGeneratingTestStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/GridGeneratingTestStore.java b/modules/core/src/test/java/org/apache/ignite/cache/store/GridGeneratingTestStore.java
index 944320b..b7e2da7 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/GridGeneratingTestStore.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/GridGeneratingTestStore.java
@@ -29,7 +29,7 @@ import java.util.*;
 /**
  * Test store that generates objects on demand.
  */
-public class GridGeneratingTestStore extends CacheStore<String, String> {
+public class GridGeneratingTestStore implements CacheStore<String, String> {
     /** Number of entries to be generated. */
     private static final int DFLT_GEN_CNT = 100;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
index 3c04ea4..e870fd6 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java
@@ -111,7 +111,7 @@ public class CacheJdbcPojoStoreTest extends GridCommonAbstractTest {
     protected void inject(CacheAbstractJdbcStore store) throws Exception {
         getTestResources().inject(store);
 
-        GridTestUtils.setFieldValue(store, CacheStore.class, "ses", ses);
+        GridTestUtils.setFieldValue(store, CacheAbstractJdbcStore.class, "ses", ses);
 
         URL cfgUrl;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
index d2ea7d2..3bd42dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
@@ -1016,7 +1016,7 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
     }
 
     /** */
-    private static class TestStore extends CacheStore<Object,Object> {
+    private static class TestStore implements CacheStore<Object,Object> {
         /** {@inheritDoc} */
         @Nullable @Override public Object load(Object key) {
             return null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGenericTestStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGenericTestStore.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGenericTestStore.java
index 6fabc87..5b7d130 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGenericTestStore.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGenericTestStore.java
@@ -34,7 +34,7 @@ import static javax.cache.Cache.*;
  * Test store.
  */
 @SuppressWarnings({"TypeParameterExtendsFinalClass"})
-public class GridCacheGenericTestStore<K, V> extends CacheStore<K, V> {
+public class GridCacheGenericTestStore<K, V> implements CacheStore<K, V> {
     /** Store. */
     private final Map<K, V> map = new ConcurrentHashMap<>();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
index 52fae7c..9f4b8f2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
@@ -53,7 +53,7 @@ public class GridCacheLifecycleAwareSelfTest extends GridAbstractLifecycleAwareS
 
     /**
      */
-    private static class TestStore extends CacheStore implements LifecycleAware {
+    private static class TestStore implements CacheStore, LifecycleAware {
         /** */
         private final TestLifecycleAware lifecycleAware = new TestLifecycleAware(CACHE_NAME);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java
index c441b96..093ad0e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java
@@ -112,7 +112,7 @@ public class GridCacheStorePutxSelfTest extends GridCommonAbstractTest {
     }
 
     /** */
-    private static class TestStore extends CacheStore<Integer, Integer> {
+    private static class TestStore implements CacheStore<Integer, Integer> {
         /** {@inheritDoc} */
         @Nullable @Override public Integer load(Integer key) {
             loads.incrementAndGet();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestStore.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestStore.java
index 95b6d9b..3cd925a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestStore.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestStore.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.cache.transactions.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
 import org.apache.ignite.testframework.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
@@ -39,7 +40,11 @@ import static junit.framework.Assert.*;
 /**
  * Test store.
  */
-public final class GridCacheTestStore extends CacheStore<Integer, String> {
+public final class GridCacheTestStore implements CacheStore<Integer, String> {
+    /** */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
     /** Store. */
     private final Map<Integer, String> map;
 
@@ -318,6 +323,7 @@ public final class GridCacheTestStore extends CacheStore<Integer, String> {
 
     /**
      * @param ses Session.
+     * @param load {@code True} is {@link #loadAll method is called.}
      */
     private void checkTx(@Nullable CacheStoreSession ses, boolean load) {
         Transaction tx = ses != null ? ses.transaction() : null;
@@ -337,4 +343,11 @@ public final class GridCacheTestStore extends CacheStore<Integer, String> {
         if (tx0.dht() && !load)
             throw new IgniteException("Tx is DHT: " + tx);
     }
+
+    /**
+     * @return Store session.
+     */
+    private CacheStoreSession session() {
+        return ses;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
index 1634476..b378b97 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
@@ -596,7 +596,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
     /**
      *
      */
-    private static class TestStore extends CacheStore<Object, Object> {
+    private static class TestStore implements CacheStore<Object, Object> {
         /** Fail flag. */
         private volatile boolean fail;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java
index 544ffbf..89ac933 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
 import org.apache.ignite.spi.communication.tcp.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.apache.ignite.transactions.*;
@@ -229,10 +230,14 @@ public class IgniteCrossCacheTxStoreSelfTest extends GridCommonAbstractTest {
     /**
      *
      */
-    private static class TestStore extends CacheStore<Object, Object> {
+    private static class TestStore implements CacheStore<Object, Object> {
         /** */
         private Queue<String> evts = new ConcurrentLinkedDeque<>();
 
+        /** Auto-injected store session. */
+        @CacheStoreSessionResource
+        private CacheStoreSession ses;
+
         /**
          *
          */
@@ -295,5 +300,12 @@ public class IgniteCrossCacheTxStoreSelfTest extends GridCommonAbstractTest {
 
             evts.add("deleteAll " + cacheName + " " + keys.size());
         }
+
+        /**
+         * @return Store session.
+         */
+        private CacheStoreSession session() {
+            return ses;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
index 055ca1b..749f468 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
@@ -23,6 +23,7 @@ import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
 import org.jetbrains.annotations.*;
 
 import javax.cache.*;
@@ -226,7 +227,15 @@ public abstract class IgniteCacheStoreSessionAbstractTest extends IgniteCacheAbs
     /**
      *
      */
-    private class TestStore extends CacheStore<Object, Object> {
+    private class TestStore implements CacheStore<Object, Object> {
+        /** Auto-injected store session. */
+        @CacheStoreSessionResource
+        private CacheStoreSession ses;
+
+        /** */
+        @IgniteInstanceResource
+        protected Ignite ignite;
+
         /** {@inheritDoc} */
         @Override public void loadCache(IgniteBiInClosure<Object, Object> clo, @Nullable Object... args) {
             log.info("Load cache [tx=" + session().transaction() + ']');
@@ -293,10 +302,17 @@ public abstract class IgniteCacheStoreSessionAbstractTest extends IgniteCacheAbs
         }
 
         /**
+         * @return Store session.
+         */
+        private CacheStoreSession session() {
+            return ses;
+        }
+
+        /**
          * @param mtd Called stored method.
          */
         private void checkSession(String mtd) {
-            assertNotNull(ignite());
+            assertNotNull(ignite);
 
             assertFalse(expData.isEmpty());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
index 8682caa..ccb8b7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
@@ -410,7 +410,7 @@ public abstract class GridAbstractCacheStoreSelfTest<T extends CacheStore<Object
     protected void inject(T store) throws Exception {
         getTestResources().inject(store);
 
-        GridTestUtils.setFieldValue(store, CacheStore.class, "ses", ses);
+        GridTestUtils.setFieldValue(store, "ses", ses);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
index 87e8816..b6a4155 100644
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
+++ b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
@@ -188,6 +188,10 @@ public class CacheHibernateBlobStore<K, V> extends CacheStoreAdapter<K, V> {
     @LoggerResource
     private IgniteLogger log;
 
+    /** Auto-injected store session. */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
     /** Ignite instance. */
     @IgniteInstanceResource
     private Ignite ignite;
@@ -591,4 +595,11 @@ public class CacheHibernateBlobStore<K, V> extends CacheStoreAdapter<K, V> {
 
         return ses != null ? ses.transaction() : null;
     }
+
+    /**
+     * @return Store session.
+     */
+    private CacheStoreSession session() {
+        return ses;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
index 93c332f..13e7040 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
@@ -65,8 +65,8 @@ class VisorCacheClearCommandSpec extends VisorRuntimeBaseSpec(2) {
      * @param name Cache name.
      * @return Cache Configuration.
      */
-    def cacheConfig(@Nullable name: String): CacheConfiguration = {
-        val cfg = new CacheConfiguration
+    def cacheConfig(@Nullable name: String): CacheConfiguration[Object, Object] = {
+        val cfg = new CacheConfiguration[Object, Object]
 
         cfg.setCacheMode(REPLICATED)
         cfg.setAtomicityMode(TRANSACTIONAL)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
index 4b1f9b8..94e9374 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
@@ -44,8 +44,8 @@ class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(1) {
      * @param name Cache name.
      * @return Cache Configuration.
      */
-    def cacheConfig(@Nullable name: String): CacheConfiguration = {
-        val cfg = new CacheConfiguration
+    def cacheConfig(@Nullable name: String): CacheConfiguration[Object, Object] = {
+        val cfg = new CacheConfiguration[Object, Object]
 
         cfg.setCacheMode(REPLICATED)
         cfg.setAtomicityMode(TRANSACTIONAL)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCompactCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCompactCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCompactCommandSpec.scala
index ed3cf9c..ee184ad 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCompactCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCompactCommandSpec.scala
@@ -64,8 +64,8 @@ class VisorCacheCompactCommandSpec extends VisorRuntimeBaseSpec(2) {
      * @param name Cache name.
      * @return Cache Configuration.
      */
-    def cacheConfig(@Nullable name: String): CacheConfiguration = {
-        val cfg = new CacheConfiguration
+    def cacheConfig(@Nullable name: String): CacheConfiguration[Object, Object] = {
+        val cfg = new CacheConfiguration[Object, Object]
 
         cfg.setCacheMode(REPLICATED)
         cfg.setName(name)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cd987c5/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala
index 56a4bec..1bc3001 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala
@@ -59,8 +59,8 @@ class VisorCacheSwapCommandSpec extends VisorRuntimeBaseSpec(2) {
      * @param name Cache name.
      * @return Cache Configuration.
      */
-    def cacheConfig(@Nullable name: String): CacheConfiguration = {
-        val cfg = new CacheConfiguration
+    def cacheConfig(@Nullable name: String): CacheConfiguration[Object, Object] = {
+        val cfg = new CacheConfiguration[Object, Object]
 
         cfg.setName(name)
         cfg.setCacheMode(CacheMode.PARTITIONED)


Mime
View raw message