You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/09/29 12:41:42 UTC
[14/20] ignite git commit: ignite-2833 Need call 'touch' for cache
entry if it was obtained using 'entryEx'.
ignite-2833 Need call 'touch' for cache entry if it was obtained using 'entryEx'.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/17c2fc0b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/17c2fc0b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/17c2fc0b
Branch: refs/heads/ignite-comm-opts2
Commit: 17c2fc0b69abd023b2a1e5da344e67951fd49408
Parents: ec9ddcd
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 28 12:56:17 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 28 12:56:17 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheTtlManager.java | 32 +++++++++++---------
.../cache/GridCacheAbstractFullApiSelfTest.java | 2 +-
2 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/17c2fc0b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
index 996544f..0f855fe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
@@ -129,26 +129,28 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
if (log.isTraceEnabled())
log.trace("Trying to remove expired entry from cache: " + e);
- boolean touch = false;
+ boolean touch = e.ctx.isSwapOrOffheapEnabled();
- GridCacheEntryEx entry = e.ctx.cache().entryEx(e.key);
+ GridCacheEntryEx entry = touch ? e.ctx.cache().entryEx(e.key) : e.ctx.cache().peekEx(e.key);
- while (true) {
- try {
- if (entry.onTtlExpired(obsoleteVer))
- touch = false;
+ if (entry != null) {
+ while (true) {
+ try {
+ if (entry.onTtlExpired(obsoleteVer))
+ touch = false;
- break;
- }
- catch (GridCacheEntryRemovedException e0) {
- entry = entry.context().cache().entryEx(entry.key());
+ break;
+ }
+ catch (GridCacheEntryRemovedException e0) {
+ entry = entry.context().cache().entryEx(entry.key());
- touch = true;
+ touch = true;
+ }
}
- }
- if (touch)
- entry.context().evicts().touch(entry, null);
+ if (touch)
+ entry.context().evicts().touch(entry, null);
+ }
}
}
@@ -216,7 +218,7 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
private final GridCacheContext ctx;
/** Cache Object Key */
- private final CacheObject key;
+ private final KeyCacheObject key;
/**
* @param entry Cache entry to create wrapper for.
http://git-wip-us.apache.org/repos/asf/ignite/blob/17c2fc0b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index c0318c8..f2cf414 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -4059,7 +4059,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
// Peek will actually remove entry from cache.
assertNull(cache.localPeek(key));
- assert cache.localSize() == 0;
+ assertEquals(0, cache.localSize());
// Clear readers, if any.
cache.remove(key);