ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [17/50] [abbrv] incubator-ignite git commit: # ignite-sprint-2 Fixed TTL usage for cache-load.
Date Fri, 20 Feb 2015 08:43:34 GMT
# ignite-sprint-2 Fixed TTL usage for cache-load.


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

Branch: refs/heads/ignite-217
Commit: 83d073f366fd8d851a06fdc8882eb37067f12cbd
Parents: e0a087c
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Thu Feb 19 10:12:25 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Thu Feb 19 10:12:25 2015 +0700

----------------------------------------------------------------------
 .../internal/visor/cache/VisorCacheLoadTask.java    | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/83d073f3/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
index 5ec5b0e..e818bd3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
@@ -61,13 +61,23 @@ public class VisorCacheLoadTask extends
             Long ttl = arg.get2();
             Object[] ldrArgs = arg.get3();
 
-            Map<String, Integer> res = new HashMap<>();
+            assert cacheNames != null && !cacheNames.isEmpty();
+            assert ttl != null;
 
-            ExpiryPolicy plc = new CreatedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS,
ttl));
+            Map<String, Integer> res = U.newHashMap(cacheNames.size());
+
+            ExpiryPolicy plc = null;
 
             for (String cacheName: cacheNames) {
-                IgniteCache cache = ignite.jcache(cacheName).withExpiryPolicy(plc);
+                IgniteCache cache = ignite.jcache(cacheName);
+
+                if (ttl > 0) {
+                    if (plc == null)
+                        plc = new CreatedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS,
ttl));
 
+                    cache = cache.withExpiryPolicy(plc);
+                }
+                
                 cache.loadCache(null, ldrArgs);
 
                 res.put(cacheName, cache.size());


Mime
View raw message