# ignite-308 removed GridCache.loadCache with ttl

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

Branch: refs/heads/ignite-185
Commit: 62de5afc94074d0d2509b67cbb1519861c9cba72
Parents: b14aafb
Author: sboikov <sboi...@gridgain.com>
Authored: Thu Feb 19 17:57:04 2015 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Thu Feb 19 17:57:04 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/cache/GridCache.java | 48 --------------------
 .../processors/cache/GridCacheAdapter.java      |  7 ++-
 .../processors/cache/GridCacheProjectionEx.java | 47 +++++++++++++++++++
 .../cache/GridCacheProjectionImpl.java          | 11 +++++
 .../processors/cache/GridCacheProxyImpl.java    |  8 ++--
 .../processors/cache/IgniteCacheProxy.java      |  4 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |  4 +-
 .../distributed/near/GridNearCacheAdapter.java  |  8 ++--
 .../IgniteCacheExpiryStoreLoadSelfTest.java     |  6 +--
 9 files changed, 76 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62de5afc/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java 
b/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java
index bb48ee4..8bbea1f 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java
@@ -184,54 +184,6 @@ public interface GridCache<K, V> extends 
CacheProjection<K, V> {
     public Iterator<Map.Entry<K, V>> offHeapIterator() throws 
IgniteCheckedException;
 
     /**
-     * Delegates to {@link 
CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...)} method
-     * to load state from the underlying persistent storage. The loaded values
-     * will then be given to the optionally passed in predicate, and, if the 
predicate returns
-     * {@code true}, will be stored in cache. If predicate is {@code null}, 
then
-     * all loaded values will be stored in cache.
-     * <p>
-     * Note that this method does not receive keys as a parameter, so it is up 
to
-     * {@link CacheStore} implementation to provide all the data to be loaded.
-     * <p>
-     * This method is not transactional and may end up loading a stale value 
into
-     * cache if another thread has updated the value immediately after it has 
been
-     * loaded. It is mostly useful when pre-loading the cache from underlying
-     * data store before start, or for read-only caches.
-     *
-     * @param p Optional predicate (may be {@code null}). If provided, will be 
used to
-     *      filter values to be put into cache.
-     * @param ttl Time to live for loaded entries ({@code 0} for infinity).
-     * @param args Optional user arguments to be passed into
-     *      {@link 
CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} 
method.
-     * @throws IgniteCheckedException If loading failed.
-     */
-    public void loadCache(@Nullable IgniteBiPredicate<K, V> p, long ttl, 
@Nullable Object... args) throws IgniteCheckedException;
-
-    /**
-     * Asynchronously delegates to {@link 
CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} 
method
-     * to reload state from the underlying persistent storage. The reloaded 
values
-     * will then be given to the optionally passed in predicate, and if the 
predicate returns
-     * {@code true}, will be stored in cache. If predicate is {@code null}, 
then
-     * all reloaded values will be stored in cache.
-     * <p>
-     * Note that this method does not receive keys as a parameter, so it is up 
to
-     * {@link CacheStore} implementation to provide all the data to be loaded.
-     * <p>
-     * This method is not transactional and may end up loading a stale value 
into
-     * cache if another thread has updated the value immediately after it has 
been
-     * loaded. It is mostly useful when pre-loading the cache from underlying
-     * data store before start, or for read-only caches.
-     *
-     * @param p Optional predicate (may be {@code null}). If provided, will be 
used to
-     *      filter values to be put into cache.
-     * @param ttl Time to live for loaded entries ({@code 0} for infinity).
-     * @param args Optional user arguments to be passed into
-     *      {@link 
CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...)} 
method.
-     * @return Future to be completed whenever loading completes.
-     */
-    public IgniteInternalFuture<?> loadCacheAsync(@Nullable 
IgniteBiPredicate<K, V> p, long ttl, @Nullable Object... args);
-
-    /**
      * Gets a random entry out of cache. In the worst cache scenario this 
method
      * has complexity of <pre>O(S * N/64)</pre> where {@code N} is the size of 
internal hash
      * table and {@code S} is the number of hash table buckets to sample, 
which is {@code 5}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62de5afc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 75b8e43..f5927c9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -3865,7 +3865,7 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
     }
 
     /** {@inheritDoc} */
-    @Override public void loadCache(final IgniteBiPredicate<K, V> p, final 
long ttl, Object[] args)
+    @Override public void localLoadCache(final IgniteBiPredicate<K, V> p, 
Object[] args)
         throws IgniteCheckedException {
         final boolean replicate = ctx.isDrEnabled();
         final long topVer = ctx.affinity().affinityTopologyVersion();
@@ -3957,14 +3957,13 @@ public abstract class GridCacheAdapter<K, V> implements 
GridCache<K, V>,
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> loadCacheAsync(final 
IgniteBiPredicate<K, V> p,
-        final long ttl,
+    @Override public IgniteInternalFuture<?> localLoadCacheAsync(final 
IgniteBiPredicate<K, V> p,
         final Object[] args)
     {
         return ctx.closures().callLocalSafe(
             ctx.projectSafe(new Callable<Object>() {
                 @Nullable @Override public Object call() throws 
IgniteCheckedException {
-                    loadCache(p, ttl, args);
+                    localLoadCache(p, args);
 
                     return null;
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62de5afc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
index 7cb3de5..546208a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionEx.java
@@ -458,4 +458,51 @@ public interface GridCacheProjectionEx<K, V> extends 
CacheProjection<K, V> {
      * @return Context.
      */
     public GridCacheContext<K, V> context();
+
+    /**
+     * Delegates to {@link 
CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...)} method
+     * to load state from the underlying persistent storage. The loaded values
+     * will then be given to the optionally passed in predicate, and, if the 
predicate returns
+     * {@code true}, will be stored in cache. If predicate is {@code null}, 
then
+     * all loaded values will be stored in cache.
+     * <p>
+     * Note that this method does not receive keys as a parameter, so it is up 
to
+     * {@link CacheStore} implementation to provide all the data to be loaded.
+     * <p>
+     * This method is not transactional and may end up loading a stale value 
into
+     * cache if another thread has updated the value immediately after it has 
been
+     * loaded. It is mostly useful when pre-loading the cache from underlying
+     * data store before start, or for read-only caches.
+     *
+     * @param p Optional predicate (may be {@code null}). If provided, will be 
used to
+     *      filter values to be put into cache.
+     * @param args Optional user arguments to be passed into
+     *      {@link 
CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} 
method.
+     * @throws IgniteCheckedException If loading failed.
+     */
+    public void localLoadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable 
Object... args)
+        throws IgniteCheckedException;
+
+    /**
+     * Asynchronously delegates to {@link 
CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} 
method
+     * to reload state from the underlying persistent storage. The reloaded 
values
+     * will then be given to the optionally passed in predicate, and if the 
predicate returns
+     * {@code true}, will be stored in cache. If predicate is {@code null}, 
then
+     * all reloaded values will be stored in cache.
+     * <p>
+     * Note that this method does not receive keys as a parameter, so it is up 
to
+     * {@link CacheStore} implementation to provide all the data to be loaded.
+     * <p>
+     * This method is not transactional and may end up loading a stale value 
into
+     * cache if another thread has updated the value immediately after it has 
been
+     * loaded. It is mostly useful when pre-loading the cache from underlying
+     * data store before start, or for read-only caches.
+     *
+     * @param p Optional predicate (may be {@code null}). If provided, will be 
used to
+     *      filter values to be put into cache.
+     * @param args Optional user arguments to be passed into
+     *      {@link 
CacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...)} 
method.
+     * @return Future to be completed whenever loading completes.
+     */
+    public IgniteInternalFuture<?> localLoadCacheAsync(@Nullable 
IgniteBiPredicate<K, V> p, @Nullable Object... args);
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62de5afc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
index aa47d48..c8187f4 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java
@@ -1328,6 +1328,17 @@ public class GridCacheProjectionImpl<K, V> implements 
GridCacheProjectionEx<K, V
     }
 
     /** {@inheritDoc} */
+    @Override public void localLoadCache(@Nullable IgniteBiPredicate<K, V> p, 
@Nullable Object... args)
+        throws IgniteCheckedException {
+        cache.localLoadCache(p, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> localLoadCacheAsync(@Nullable 
IgniteBiPredicate<K, V> p, @Nullable Object... args) {
+        return cache.localLoadCacheAsync(p, args);
+    }
+
+    /** {@inheritDoc} */
     @Override public GridCacheProjectionEx<K, V> withExpiryPolicy(ExpiryPolicy 
plc) {
         return new GridCacheProjectionImpl<>(
             this,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62de5afc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index 55a9daf..23ec81b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -225,11 +225,11 @@ public class GridCacheProxyImpl<K, V> implements 
GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public void loadCache(IgniteBiPredicate<K, V> p, long ttl, 
@Nullable Object[] args) throws IgniteCheckedException {
+    @Override public void localLoadCache(IgniteBiPredicate<K, V> p, @Nullable 
Object[] args) throws IgniteCheckedException {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {
-            cache.loadCache(p, ttl, args);
+            cache.localLoadCache(p, args);
         }
         finally {
             gate.leave(prev);
@@ -237,11 +237,11 @@ public class GridCacheProxyImpl<K, V> implements 
GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> 
loadCacheAsync(IgniteBiPredicate<K, V> p, long ttl, @Nullable Object[] args) {
+    @Override public IgniteInternalFuture<?> 
localLoadCacheAsync(IgniteBiPredicate<K, V> p, @Nullable Object[] args) {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {
-            return cache.loadCacheAsync(p, ttl, args);
+            return cache.localLoadCacheAsync(p, args);
         }
         finally {
             gate.leave(prev);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62de5afc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 19bc444..67bc5b9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -194,9 +194,9 @@ public class IgniteCacheProxy<K, V> extends 
AsyncSupportAdapter<IgniteCache<K, V
 
             try {
                 if (isAsync())
-                    setFuture(delegate.<K, V>cache().loadCacheAsync(p, 0, 
args));
+                    setFuture(delegate.localLoadCacheAsync(p, args));
                 else
-                    delegate.<K, V>cache().loadCache(p, 0, args);
+                    delegate.localLoadCache(p, args);
             }
             finally {
                 gate.leave(prev);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62de5afc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 0527ab1..2ef157c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -384,9 +384,9 @@ public abstract class GridDhtCacheAdapter<K, V> extends 
GridDistributedCacheAdap
     }
 
     /** {@inheritDoc} */
-    @Override public void loadCache(final IgniteBiPredicate<K, V> p, final 
long ttl, Object[] args) throws IgniteCheckedException {
+    @Override public void localLoadCache(final IgniteBiPredicate<K, V> p, 
Object[] args) throws IgniteCheckedException {
         if (ctx.store().isLocalStore()) {
-            super.loadCache(p, ttl, args);
+            super.localLoadCache(p, args);
 
             return;
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62de5afc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index df5d66d..94d2e96 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -305,8 +305,8 @@ public abstract class GridNearCacheAdapter<K, V> extends 
GridDistributedCacheAda
     }
 
     /** {@inheritDoc} */
-    @Override public void loadCache(IgniteBiPredicate<K, V> p, long ttl, 
Object[] args) throws IgniteCheckedException {
-        dht().loadCache(p, ttl, args);
+    @Override public void localLoadCache(IgniteBiPredicate<K, V> p, Object[] 
args) throws IgniteCheckedException {
+        dht().localLoadCache(p, args);
     }
 
     /** {@inheritDoc} */
@@ -315,8 +315,8 @@ public abstract class GridNearCacheAdapter<K, V> extends 
GridDistributedCacheAda
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> 
loadCacheAsync(IgniteBiPredicate<K, V> p, long ttl, Object[] args) {
-        return dht().loadCacheAsync(p, ttl, args);
+    @Override public IgniteInternalFuture<?> 
localLoadCacheAsync(IgniteBiPredicate<K, V> p, Object[] args) {
+        return dht().localLoadCacheAsync(p, args);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62de5afc/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
index 9e8ad2b..e32e3d2 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
@@ -109,7 +109,7 @@ public class IgniteCacheExpiryStoreLoadSelfTest extends 
GridCacheAbstractSelfTes
 
         Thread.sleep(TIME_TO_LIVE + WAIT_TIME);
 
-        assertEquals(0, cache.size(CachePeekMode.PRIMARY));
+        assertEquals(0, cache.size());
     }
 
     /**
@@ -150,7 +150,7 @@ public class IgniteCacheExpiryStoreLoadSelfTest extends 
GridCacheAbstractSelfTes
 
         Thread.sleep(TIME_TO_LIVE + WAIT_TIME);
 
-        assertEquals(0, cache.localSize(CachePeekMode.PRIMARY));
+        assertEquals(0, cache.localSize());
     }
 
     /**
@@ -176,7 +176,7 @@ public class IgniteCacheExpiryStoreLoadSelfTest extends 
GridCacheAbstractSelfTes
 
         Thread.sleep(TIME_TO_LIVE + WAIT_TIME);
 
-        assertEquals(0, cache.size(CachePeekMode.PRIMARY));
+        assertEquals(0, cache.size());
     }
 
     /**

Reply via email to