ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [29/38] incubator-ignite git commit: # ignite-41
Date Tue, 23 Dec 2014 08:23:05 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 14620a6..8e742fd 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -667,7 +667,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
                                             Duration duration = cached.hasValue() ?
                                                 expiry.getExpiryForUpdate() : expiry.getExpiryForCreation();
 
-                                            txEntry.ttl(GridCacheUtils.toTtl(duration));
+                                            txEntry.ttl(CU.toTtl(duration));
                                         }
                                     }
 
@@ -783,10 +783,17 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
                                             nearCached.innerReload(CU.<K, V>empty());
                                     }
                                     else if (op == READ) {
-                                        Duration duration = expiryForAccess(txEntry);
+                                        ExpiryPolicy expiry = txEntry.expiry();
 
-                                        if (duration != null)
-                                            cached.updateTtl(null, GridCacheUtils.toTtl(duration));
+                                        if (expiry == null)
+                                            expiry = txEntry.context().expiry();
+
+                                        if (expiry != null) {
+                                            Duration duration = expiry.getExpiryForAccess();
+
+                                            if (duration != null)
+                                                cached.updateTtl(null, CU.toTtl(duration));
+                                        }
 
                                         if (log.isDebugEnabled())
                                             log.debug("Ignoring READ entry when committing: " + txEntry);
@@ -863,28 +870,12 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
                         }
                     }
                 }
-
-                if (!near()) {
-                    for (IgniteTxEntry<K, V> txEntry : readEntries()) {
-                        Duration duration = expiryForAccess(txEntry);
-
-                        if (duration != null)
-                            txEntry.cached().updateTtl(null, GridCacheUtils.toTtl(duration));
-                    }
-                }
             }
             finally {
                 cctx.tm().txContextReset();
             }
         }
         else {
-            for (IgniteTxEntry<K, V> txEntry : readEntries()) {
-                Duration duration = expiryForAccess(txEntry);
-
-                if (duration != null)
-                    txEntry.cached().updateTtl(null, GridCacheUtils.toTtl(duration));
-            }
-
             GridCacheStoreManager<K, V> store = store();
 
             if (store != null && (!internal() || groupLock())) {
@@ -919,19 +910,6 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
     }
 
     /**
-     * @param txEntry Tx entry.
-     * @return New duration.
-     */
-    @Nullable private Duration expiryForAccess(IgniteTxEntry<K, V> txEntry) {
-        ExpiryPolicy expiry = txEntry.expiry();
-
-        if (expiry == null)
-            expiry = txEntry.context().expiry();
-
-        return expiry != null ? expiry.getExpiryForAccess() : null;
-    }
-
-    /**
      * Commits transaction to transaction manager. Used for one-phase commit transactions only.
      */
     public void tmCommit() {
@@ -1022,9 +1000,10 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
      * Checks if there is a cached or swapped value for
      * {@link #getAllAsync(GridCacheContext, Collection, GridCacheEntryEx, boolean, IgnitePredicate[])} method.
      *
-     *
+     * @param cacheCtx Cache context.
      * @param keys Key to enlist.
      * @param cached Cached entry, if called from entry wrapper.
+     * @param expiryPlc Explicitly specified expiry policy for entry.
      * @param map Return map.
      * @param missed Map of missed keys.
      * @param keysCnt Keys count (to avoid call to {@code Collection.size()}).
@@ -1038,6 +1017,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
         final GridCacheContext<K, V> cacheCtx,
         Collection<? extends K> keys,
         @Nullable GridCacheEntryEx<K, V> cached,
+        @Nullable ExpiryPolicy expiryPlc,
         Map<K, V> map,
         Map<K, GridCacheVersion> missed,
         int keysCnt,
@@ -1207,7 +1187,16 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
                             missed.put(key, ver);
 
                         if (!readCommitted()) {
-                            txEntry = addEntry(READ, val, null, entry, null, filter, true, -1L, -1L, null);
+                            txEntry = addEntry(READ,
+                                val,
+                                null,
+                                entry,
+                                expiryPlc,
+                                filter,
+                                true,
+                                -1L,
+                                -1L,
+                                null);
 
                             if (groupLock())
                                 txEntry.groupLockEntry(true);
@@ -1232,7 +1221,16 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
                             // Value for which failure occurred.
                             V val = e.<V>value();
 
-                            txEntry = addEntry(READ, val, null, entry, null, CU.<K, V>empty(), false, -1L, -1L, null);
+                            txEntry = addEntry(READ,
+                                val,
+                                null,
+                                entry,
+                                expiryPlc,
+                                CU.<K, V>empty(),
+                                false,
+                                -1L,
+                                -1L,
+                                null);
 
                             // Mark as checked immediately for non-pessimistic.
                             if (val != null && !pessimistic())
@@ -1486,8 +1484,17 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
 
             final Map<K, GridCacheVersion> missed = new GridLeanMap<>(pessimistic() ? keysCnt : 0);
 
-            final Collection<K> lockKeys = enlistRead(cacheCtx, keys, cached, retMap, missed, keysCnt,
-                deserializePortable, filter);
+            GridCacheProjectionImpl<K, V> prj = cacheCtx.projectionPerCall();
+
+            final Collection<K> lockKeys = enlistRead(cacheCtx,
+                keys,
+                cached,
+                prj != null ? prj.expiry() : null,
+                retMap,
+                missed,
+                keysCnt,
+                deserializePortable,
+                filter);
 
             if (single && missed.isEmpty())
                 return new GridFinishedFuture<>(cctx.kernalContext(), retMap);
@@ -2037,6 +2044,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
     /**
      * Post lock processing for put or remove.
      *
+     * @param cacheCtx Context.
      * @param keys Keys.
      * @param failed Collection of potentially failed keys (need to populate in this method).
      * @param transformed Output map where transformed values will be placed.
@@ -2044,6 +2052,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
      * @param ret Return value.
      * @param rmv {@code True} if remove.
      * @param retval Flag to return value or not.
+     * @param read {@code True} if read.
      * @param filter Filter to check entries.
      * @return Failed keys.
      * @throws IgniteCheckedException If error.
@@ -2057,6 +2066,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
         GridCacheReturn<V> ret,
         boolean rmv,
         boolean retval,
+        boolean read,
         IgnitePredicate<GridCacheEntry<K, V>>[] filter
     ) throws IgniteCheckedException {
         for (K k : keys) {
@@ -2128,6 +2138,8 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
                     if (onePhaseCommit())
                         txEntry.filtersPassed(pass);
 
+                    boolean updateTtl = read;
+
                     if (pass) {
                         txEntry.markValid();
 
@@ -2142,10 +2154,14 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
                         txEntry.filters(CU.<K, V>empty());
                         txEntry.filtersSet(false);
 
+                        updateTtl = true;
+                    }
+
+                    if (updateTtl) {
                         ExpiryPolicy expiryPlc = txEntry.expiry() != null ? txEntry.expiry() : cacheCtx.expiry();
 
                         if (expiryPlc != null)
-                            txEntry.ttl(GridCacheUtils.toTtl(expiryPlc.getExpiryForAccess()));
+                            txEntry.ttl(CU.toTtl(expiryPlc.getExpiryForAccess()));
                     }
 
                     break; // While.
@@ -2170,6 +2186,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
      * Internal method for all put and transform operations. Only one of {@code map}, {@code transformMap}
      * maps must be non-null.
      *
+     * @param cacheCtx Context.
      * @param map Key-value map to store.
      * @param transformMap Transform map.
      * @param drMap DR map.
@@ -2329,8 +2346,16 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
 
                         Map<K, V> transformed = null;
 
-                        postLockWrite(cacheCtx, keys, loaded, transformed, transformMap0, ret,
-                            /*remove*/false, retval, filter);
+                        postLockWrite(cacheCtx,
+                            keys,
+                            loaded,
+                            transformed,
+                            transformMap0,
+                            ret,
+                            /*remove*/false,
+                            retval,
+                            /*read*/false,
+                            filter);
 
                         return ret;
                     }
@@ -2513,8 +2538,16 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V>
                         if (log.isDebugEnabled())
                             log.debug("Acquired transaction lock for remove on keys: " + passedKeys);
 
-                        postLockWrite(cacheCtx, passedKeys, loadFut.get(), null, null, ret,
-                            /*remove*/true, retval, filter);
+                        postLockWrite(cacheCtx,
+                            passedKeys,
+                            loadFut.get(),
+                            null,
+                            null,
+                            ret,
+                            /*remove*/true,
+                            retval,
+                            /*read*/false,
+                            filter);
 
                         return ret;
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index b3e5d76..ee32cae 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -34,6 +34,7 @@ import java.io.*;
 import java.util.*;
 import java.util.concurrent.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.apache.ignite.transactions.IgniteTxConcurrency.*;
 import static org.apache.ignite.transactions.IgniteTxIsolation.*;
 import static org.gridgain.grid.kernal.processors.rest.GridRestCommand.*;
@@ -931,7 +932,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
         /** {@inheritDoc} */
         @Override public IgniteFuture<?> applyx(GridCacheProjection<Object, Object> c, GridKernalContext ctx) {
             if (ttl != null && ttl > 0) {
-                Duration duration = new Duration(TimeUnit.MILLISECONDS, ttl);
+                Duration duration = new Duration(MILLISECONDS, ttl);
 
                 c = ((GridCacheProjectionEx<Object, Object>)c).withExpiryPolicy(new ModifiedExpiryPolicy(duration));
             }
@@ -968,7 +969,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
         /** {@inheritDoc} */
         @Override public IgniteFuture<?> applyx(GridCacheProjection<Object, Object> c, GridKernalContext ctx) {
             if (ttl != null && ttl > 0) {
-                Duration duration = new Duration(TimeUnit.MILLISECONDS, ttl);
+                Duration duration = new Duration(MILLISECONDS, ttl);
 
                 c = ((GridCacheProjectionEx<Object, Object>)c).withExpiryPolicy(new ModifiedExpiryPolicy(duration));
             }
@@ -1005,7 +1006,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
         /** {@inheritDoc} */
         @Override public IgniteFuture<?> applyx(GridCacheProjection<Object, Object> c, GridKernalContext ctx) {
             if (ttl != null && ttl > 0) {
-                Duration duration = new Duration(TimeUnit.MILLISECONDS, ttl);
+                Duration duration = new Duration(MILLISECONDS, ttl);
 
                 c = ((GridCacheProjectionEx<Object, Object>)c).withExpiryPolicy(new ModifiedExpiryPolicy(duration));
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java
index b238600..9ff2d96 100644
--- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java
+++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java
@@ -45,7 +45,7 @@ public class GridTcpCommunicationMessageFactory {
     private static final Map<Byte, GridTcpCommunicationMessageProducer> CUSTOM = new ConcurrentHashMap8<>();
 
     /** */
-    public static final int MAX_COMMON_TYPE = 100;
+    public static final int MAX_COMMON_TYPE = 82;
 
     static {
         registerCommon(new GridTcpCommunicationMessageProducer() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
index e1e54a6..ac5514d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
@@ -11,12 +11,19 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
 import org.apache.ignite.configuration.*;
+import org.apache.ignite.lang.*;
 import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.transactions.*;
 import org.gridgain.grid.cache.*;
+import org.gridgain.grid.cache.store.*;
 import org.gridgain.testframework.junits.common.*;
+import org.jdk8.backport.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
 
 import static org.gridgain.grid.cache.GridCacheAtomicityMode.*;
 import static org.gridgain.grid.cache.GridCacheMode.*;
@@ -29,6 +36,9 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
     /** */
     private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
+    /** */
+    protected static final Map<Object, Object> storeMap = new ConcurrentHashMap8<>();
+
     /**
      * @return Grids count to start.
      */
@@ -55,6 +65,8 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
     /** {@inheritDoc} */
     @Override protected void afterTestsStopped() throws Exception {
         stopAllGrids();
+
+        storeMap.clear();
     }
 
     /** {@inheritDoc} */
@@ -101,6 +113,8 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
         cfg.setDistributionMode(distributionMode());
         cfg.setPortableEnabled(portableEnabled());
 
+        cfg.setStore(cacheStore());
+
         if (cacheMode() == PARTITIONED)
             cfg.setBackups(1);
 
@@ -108,6 +122,13 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @return Cache store.
+     */
+    protected GridCacheStore<?, ?> cacheStore() {
+        return null;
+    }
+
+    /**
      * @return Default cache mode.
      */
     protected abstract GridCacheMode cacheMode();
@@ -164,4 +185,30 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
     protected <K, V> IgniteCache<K, V> jcache(int idx) {
         return grid(idx).jcache(null);
     }
+
+    /**
+     *
+     */
+    public class TestStore extends GridCacheStoreAdapter<Object, Object> {
+        /** {@inheritDoc} */
+        @Override public void loadCache(IgniteBiInClosure<Object, Object> clo, Object... args) {
+            for (Map.Entry<Object, Object> e : storeMap.entrySet())
+                clo.apply(e.getKey(), e.getValue());
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object load(IgniteTx tx, Object key) {
+            return storeMap.get(key);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(IgniteTx tx, Object key, @Nullable Object val) {
+            storeMap.put(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void remove(IgniteTx tx, Object key) {
+            storeMap.remove(key);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java
new file mode 100644
index 0000000..5f55aaa
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java
@@ -0,0 +1,23 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.internal.processors.cache.expiry;
+
+import org.gridgain.grid.cache.store.*;
+
+/**
+ *
+ */
+public class IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest extends
+    IgniteCacheAtomicPrimaryWriteOrderExpiryPolicyTest{
+    /** {@inheritDoc} */
+    @Override protected GridCacheStore<?, ?> cacheStore() {
+        return new TestStore();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicWithStoreExpiryPolicyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicWithStoreExpiryPolicyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicWithStoreExpiryPolicyTest.java
new file mode 100644
index 0000000..b64215b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicWithStoreExpiryPolicyTest.java
@@ -0,0 +1,22 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.internal.processors.cache.expiry;
+
+import org.gridgain.grid.cache.store.*;
+
+/**
+ *
+ */
+public class IgniteCacheAtomicWithStoreExpiryPolicyTest extends IgniteCacheAtomicExpiryPolicyTest {
+    /** {@inheritDoc} */
+    @Override protected GridCacheStore<?, ?> cacheStore() {
+        return new TestStore();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
index 2bb3bce..6100479 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
@@ -29,6 +29,7 @@ import java.util.concurrent.*;
 
 import static org.apache.ignite.transactions.IgniteTxConcurrency.*;
 import static org.apache.ignite.transactions.IgniteTxIsolation.*;
+import static org.gridgain.grid.cache.GridCacheAtomicWriteOrderMode.*;
 import static org.gridgain.grid.cache.GridCacheAtomicityMode.*;
 import static org.gridgain.grid.cache.GridCacheDistributionMode.*;
 import static org.gridgain.grid.cache.GridCacheMode.*;
@@ -57,6 +58,8 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         stopAllGrids();
+
+        storeMap.clear();
     }
 
     /**
@@ -165,6 +168,8 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
 
                 txGet(key);
             }
+
+            txGetAll();
         }
     }
 
@@ -189,6 +194,29 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    private void txGetAll() throws Exception {
+        IgniteCache<Integer, Integer> cache = jcache(0);
+
+        Map<Integer, Integer> vals = new HashMap<>();
+
+        for (int i = 0; i < 1000; i++)
+            vals.put(i, i);
+
+        cache.putAll(vals);
+
+        try (IgniteTx tx = ignite(0).transactions().txStart()) {
+            assertEquals(vals, cache.getAll(vals.keySet()));
+
+            tx.commit();
+        }
+
+        for (Integer key : vals.keySet())
+            checkTtl(key, 62_000L);
+    }
+
+    /**
      * @param key Key.
      * @throws Exception If failed.
      */
@@ -564,11 +592,17 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
 
         IgniteCache<Integer, Integer> cache1 = jcache(1);
 
+        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+            Thread.sleep(100);
+
         // Update from another node.
         cache1.put(key, 2);
 
         checkTtl(key, 61_000L);
 
+        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+            Thread.sleep(100);
+
         // Update from another node with provided TTL.
         cache1.withExpiryPolicy(new TestPolicy(null, TTL_FOR_EXPIRE, null)).put(key, 3);
 
@@ -581,6 +615,9 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
 
         checkTtl(key, 60_000L);
 
+        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+            Thread.sleep(100);
+
         // Update from near node with provided TTL.
         cache0.withExpiryPolicy(new TestPolicy(null, TTL_FOR_EXPIRE + 1, null)).put(key, 2);
 
@@ -607,6 +644,9 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
         for (Integer key : vals.keySet())
             checkTtl(key, 60_000L);
 
+        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+            Thread.sleep(100);
+
         IgniteCache<Integer, Integer> cache1 = jcache(1);
 
         // Update from another node.
@@ -615,6 +655,9 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
         for (Integer key : vals.keySet())
             checkTtl(key, 61_000L);
 
+        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+            Thread.sleep(100);
+
         // Update from another node with provided TTL.
         cache1.withExpiryPolicy(new TestPolicy(null, 1000L, null)).putAll(vals);
 
@@ -626,6 +669,9 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
         // Try create again.
         cache0.putAll(vals);
 
+        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+            Thread.sleep(100);
+
         // Update from near node with provided TTL.
         cache1.withExpiryPolicy(new TestPolicy(null, 1101L, null)).putAll(vals);
 
@@ -752,6 +798,8 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
             }
         }
 
+        storeMap.clear();
+
         for (int i = 0; i < gridCount(); i++) {
             for (Integer key : keys)
                 assertNull("Unexpected non-null value for grid " + i, jcache(i).get(key));
@@ -787,7 +835,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
                 e = cache.context().near().dht().peekEx(key);
 
             if (e == null)
-                assertTrue(!cache.affinity().isPrimaryOrBackup(grid.localNode(), key));
+                assertTrue("Not found " + key, !cache.affinity().isPrimaryOrBackup(grid.localNode(), key));
             else {
                 found = true;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java
index 36e4890..9b9e3e9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java
@@ -24,11 +24,14 @@ public class IgniteCacheExpiryPolicyTestSuite extends TestSuite {
 
         suite.addTestSuite(IgniteCacheAtomicLocalExpiryPolicyTest.class);
         suite.addTestSuite(IgniteCacheAtomicExpiryPolicyTest.class);
+        suite.addTestSuite(IgniteCacheAtomicWithStoreExpiryPolicyTest.class);
         suite.addTestSuite(IgniteCacheAtomicPrimaryWriteOrderExpiryPolicyTest.class);
+        suite.addTestSuite(IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.class);
         suite.addTestSuite(IgniteCacheAtomicReplicatedExpiryPolicyTest.class);
 
         suite.addTestSuite(IgniteCacheTxLocalExpiryPolicyTest.class);
         suite.addTestSuite(IgniteCacheTxExpiryPolicyTest.class);
+        suite.addTestSuite(IgniteCacheTxWithStoreExpiryPolicyTest.class);
         suite.addTestSuite(IgniteCacheTxReplicatedExpiryPolicyTest.class);
 
         return suite;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheTxWithStoreExpiryPolicyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheTxWithStoreExpiryPolicyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheTxWithStoreExpiryPolicyTest.java
new file mode 100644
index 0000000..902d1dd
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheTxWithStoreExpiryPolicyTest.java
@@ -0,0 +1,22 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.internal.processors.cache.expiry;
+
+import org.gridgain.grid.cache.store.*;
+
+/**
+ *
+ */
+public class IgniteCacheTxWithStoreExpiryPolicyTest extends IgniteCacheTxExpiryPolicyTest {
+    /** {@inheritDoc} */
+    @Override protected GridCacheStore<?, ?> cacheStore() {
+        return new TestStore();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index f7d630c..059bb80 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -29,6 +29,7 @@ import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.gridgain.grid.cache.GridCacheMode.*;
 import static org.gridgain.grid.cache.GridCachePeekMode.*;
 import static org.apache.ignite.transactions.IgniteTxConcurrency.*;
@@ -4144,7 +4145,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         long ttl = 500;
 
-        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl));
+        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
         grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
 
@@ -4191,7 +4192,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         int ttl = 500;
 
-        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl));
+        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
         grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
 
@@ -4215,7 +4216,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             int ttl = 500;
 
             try (IgniteTx tx = grid(0).ignite().transactions().txStart()) {
-                final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl));
+                final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
                 grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
 
@@ -4260,7 +4261,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     private void checkTtl(boolean inTx, boolean oldEntry) throws Exception {
         int ttl = 1000;
 
-        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl));
+        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
         final GridCache<String, Integer> c = cache();
 
@@ -4666,7 +4667,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         long ttl = 500;
 
-        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl));
+        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
         grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
index f56309c..cb28427 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
@@ -27,6 +27,7 @@ import javax.cache.expiry.*;
 import java.util.*;
 import java.util.concurrent.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.apache.ignite.events.IgniteEventType.*;
 
 /**
@@ -498,7 +499,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
 
         ignite.events().localListen(lsnr, EVTS_CACHE);
 
-        ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, 200L));
+        ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, 200L));
 
         try {
             int key = (int)System.currentTimeMillis();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheRefreshAheadAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheRefreshAheadAbstractSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheRefreshAheadAbstractSelfTest.java
index bc0003d..69bb566 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheRefreshAheadAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheRefreshAheadAbstractSelfTest.java
@@ -15,7 +15,6 @@ import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.transactions.*;
-import org.gridgain.grid.cache.*;
 import org.gridgain.grid.cache.store.*;
 import org.gridgain.grid.util.tostring.*;
 import org.gridgain.grid.util.typedef.internal.*;
@@ -66,9 +65,7 @@ public abstract class GridCacheRefreshAheadAbstractSelfTest extends GridCommonAb
     public void testReadAhead() throws Exception {
         store.testThread(Thread.currentThread());
 
-        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, 1000L));
-
-        GridCache<Integer, String> cache = grid(0).cache(null);
+        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, 1000L));
 
         grid(0).jcache(null).withExpiryPolicy(expiry).put(1, "1");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestEntryEx.java
index ef79005..64218d2 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestEntryEx.java
@@ -404,7 +404,7 @@ public class GridCacheTestEntryEx<K, V> extends GridMetadataAwareAdapter impleme
         Object transformClo,
         String taskName,
         IgnitePredicate<GridCacheEntry<K, V>>[] filter,
-        @Nullable GridCacheExpiryPolicy expiryPlc) {
+        @Nullable IgniteCacheExpiryPolicy expiryPlc) {
         return val;
     }
 
@@ -449,7 +449,7 @@ public class GridCacheTestEntryEx<K, V> extends GridMetadataAwareAdapter impleme
         @Nullable byte[] valBytes,
         boolean writeThrough,
         boolean retval,
-        @Nullable GridCacheExpiryPolicy expiryPlc,
+        @Nullable IgniteCacheExpiryPolicy expiryPlc,
         boolean evt,
         boolean metrics,
         boolean primary,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerLoadTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerLoadTest.java
index ccc5a84..1a52646 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerLoadTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerLoadTest.java
@@ -18,6 +18,7 @@ import javax.cache.expiry.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.gridgain.grid.cache.GridCacheMode.*;
 
 /**
@@ -38,7 +39,7 @@ public class GridCacheTtlManagerLoadTest extends GridCacheTtlManagerSelfTest {
             IgniteFuture<?> fut = multithreadedAsync(new Callable<Object>() {
                 @Override public Object call() throws Exception {
                     IgniteCache<Object,Object> cache = g.jcache(null).
-                        withExpiryPolicy(new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, 1000)));
+                        withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, 1000)));
 
                     long key = 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerSelfTest.java
index fe8d09b..e0ebe84 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManagerSelfTest.java
@@ -24,6 +24,7 @@ import org.gridgain.testframework.junits.common.*;
 import javax.cache.expiry.*;
 import java.util.concurrent.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.gridgain.grid.cache.GridCacheMode.*;
 
 /**
@@ -90,7 +91,7 @@ public class GridCacheTtlManagerSelfTest extends GridCommonAbstractTest {
             final String key = "key";
 
             g.jcache(null).withExpiryPolicy(
-                    new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, 1000))).put(key, 1);
+                    new TouchedExpiryPolicy(new Duration(MILLISECONDS, 1000))).put(key, 1);
 
             assertEquals(1, g.jcache(null).get(key));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
index 929159f..428ac9c 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
@@ -324,7 +324,7 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
 
         long ttl = 500;
 
-        cache1.withExpiryPolicy(new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl))).put("key", "val");
+        cache1.withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put("key", "val");
 
         assert cache1.get("key") != null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
index 5576ca7..81ade22 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
@@ -22,6 +22,7 @@ import javax.cache.expiry.*;
 import java.util.*;
 import java.util.concurrent.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.gridgain.grid.cache.GridCachePreloadMode.*;
 import static org.apache.ignite.events.IgniteEventType.*;
 
@@ -72,7 +73,7 @@ public abstract class GridCacheExpiredEntriesPreloadAbstractSelfTest extends Gri
         for (int i = 0; i < KEYS_NUM; i++)
             cache0.put(String.valueOf(i), 0);
 
-        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, 100L));
+        final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, 100L));
 
         IgniteCache cache = grid(0).jcache(null).withExpiryPolicy(expiry);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
index 042a09d..b66ab89 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
@@ -20,6 +20,7 @@ import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.gridgain.grid.cache.GridCacheAtomicityMode.*;
 import static org.gridgain.grid.cache.GridCacheDistributionMode.*;
 import static org.apache.ignite.events.IgniteEventType.*;
@@ -227,7 +228,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache
         long ttl = 500;
 
         grid(0).jcache(null).
-            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl))).put(key, 1);
+            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);
 
         Thread.sleep(ttl + 100);
 
@@ -336,7 +337,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache
         long ttl = 500;
 
         grid(0).jcache(null).
-            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl))).put(key, 1);
+            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);
 
         Thread.sleep(ttl + 100);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
index 94d1384..0bf8000 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
@@ -16,6 +16,7 @@ import javax.cache.expiry.*;
 import java.util.*;
 import java.util.concurrent.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.gridgain.grid.cache.GridCacheAtomicityMode.ATOMIC;
 import static org.gridgain.grid.cache.GridCacheDistributionMode.*;
 
@@ -155,7 +156,7 @@ public class GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest extends GridCacheNe
         long ttl = 500;
 
         grid(0).jcache(null).
-            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl))).put(key, 1);
+            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);
 
         Thread.sleep(ttl + 100);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java
index fd958db..75fff93 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java
@@ -24,8 +24,8 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.gridgain.grid.util.typedef.*;
 
 import javax.cache.expiry.*;
-import java.util.concurrent.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.gridgain.grid.cache.GridCacheMode.*;
 import static org.apache.ignite.transactions.IgniteTxIsolation.*;
 import static org.apache.ignite.transactions.IgniteTxConcurrency.*;
@@ -163,7 +163,7 @@ public class GridCachePartitionedEvictionSelfTest extends GridCacheAbstractSelfT
 
         GridCacheAffinity<String> aff = dht0.affinity();
 
-        TouchedExpiryPolicy plc = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, 10));
+        TouchedExpiryPolicy plc = new TouchedExpiryPolicy(new Duration(MILLISECONDS, 10));
 
         for (int kv = 0; kv < KEY_CNT; kv++) {
             String key = String.valueOf(kv);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/jobtracker/GridHadoopJobTracker.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/jobtracker/GridHadoopJobTracker.java b/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/jobtracker/GridHadoopJobTracker.java
index 239c7a9..75cc266 100644
--- a/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/jobtracker/GridHadoopJobTracker.java
+++ b/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/jobtracker/GridHadoopJobTracker.java
@@ -121,7 +121,7 @@ public class GridHadoopJobTracker extends GridHadoopComponent {
                     jobMetaPrj = prj = sysCache.projection(GridHadoopJobId.class, GridHadoopJobMetadata.class);
 
                     if (ctx.configuration().getFinishedJobInfoTtl() > 0) {
-                        TouchedExpiryPolicy finishedJobPlc = new TouchedExpiryPolicy(
+                        ExpiryPolicy finishedJobPlc = new ModifiedExpiryPolicy(
                             new Duration(MILLISECONDS, ctx.configuration().getFinishedJobInfoTtl()));
 
                         finishedJobMetaPrj = ((GridCacheProjectionEx<GridHadoopJobId, GridHadoopJobMetadata>)prj).

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java
index 597e5bc..1c3d71f 100644
--- a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java
@@ -288,7 +288,7 @@ public abstract class GridCacheAbstractQuerySelfTest extends GridCommonAbstractT
      */
     public void testExpiration() throws Exception {
         ignite.jcache(null).
-            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, 1000))).put("key1", 1);
+            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, 1000))).put("key1", 1);
 
         GridCache<String, Integer> cache = ignite.cache(null);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionFilter.java
----------------------------------------------------------------------
diff --git a/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionFilter.java b/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionFilter.java
index 9556c83..6f7a5b2 100644
--- a/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionFilter.java
+++ b/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionFilter.java
@@ -383,8 +383,9 @@ public class GridWebSessionFilter implements Filter {
                     GridCacheProjection<String, GridWebSession> cache0;
 
                     if (cached.getMaxInactiveInterval() > 0) {
-                        ExpiryPolicy plc =
-                            new TouchedExpiryPolicy(new Duration(MILLISECONDS, cached.getMaxInactiveInterval() * 1000));
+                        long ttl = cached.getMaxInactiveInterval() * 1000;
+
+                        ExpiryPolicy plc = new ModifiedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
                         cache0 = ((GridCacheProjectionEx<String, GridWebSession>)cache).withExpiryPolicy(plc);
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/783e5270/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionListener.java
----------------------------------------------------------------------
diff --git a/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionListener.java b/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionListener.java
index 0408e19..401b7ff 100644
--- a/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionListener.java
+++ b/modules/web/src/main/java/org/gridgain/grid/cache/websession/GridWebSessionListener.java
@@ -87,8 +87,9 @@ class GridWebSessionListener {
                     GridCacheProjection<String, GridWebSession> cache0;
 
                     if (maxInactiveInterval > 0) {
-                        ExpiryPolicy plc =
-                            new TouchedExpiryPolicy(new Duration(MILLISECONDS, maxInactiveInterval * 1000));
+                        long ttl = maxInactiveInterval * 1000;
+
+                        ExpiryPolicy plc = new ModifiedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
                         cache0 = ((GridCacheProjectionEx<String, GridWebSession>)cache).withExpiryPolicy(plc);
                     }


Mime
View raw message