IGNITE-341 - Fixing peek() method.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e832467f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e832467f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e832467f Branch: refs/heads/ignite-341 Commit: e832467fd44666a45e844dbab712f4735b7f82f5 Parents: 0ade085 Author: Alexey Goncharuk <agoncha...@gridgain.com> Authored: Wed Mar 25 16:54:48 2015 -0700 Committer: Alexey Goncharuk <agoncha...@gridgain.com> Committed: Wed Mar 25 16:54:48 2015 -0700 ---------------------------------------------------------------------- .../processors/cache/GridCacheMapEntry.java | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e832467f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index e96305d..d78b452 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -3157,12 +3157,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx { return val0; } - GridCacheSwapEntry swapEntry = cctx.swap().read(key, true, true); - - if (swapEntry == null) - return null; - - return swapEntry.value(); + return null; } /** {@inheritDoc} */ @@ -3721,8 +3716,8 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx { } /** - * This method will return current value only if clearIndex(V) will require previous value (this is the case - * for Mongo caches). If previous value is not required, this method will return {@code null}. + * This method will return current value only if clearIndex(V) will require previous value. + * If previous value is not required, this method will return {@code null}. * * @return Previous value or {@code null}. * @throws IgniteCheckedException If failed to retrieve previous value. @@ -3733,7 +3728,18 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx { if (cctx.queries() == null) return null; - return rawGetOrUnmarshalUnlocked(false); + CacheObject val = rawGetOrUnmarshalUnlocked(false); + + if (val == null) { + GridCacheSwapEntry swapEntry = cctx.swap().read(key, true, true); + + if (swapEntry == null) + return null; + + return swapEntry.value(); + } + + return val; } /** {@inheritDoc} */