ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [02/20] incubator-ignite git commit: ignite-96 wip
Date Fri, 06 Feb 2015 19:58:15 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryImpl.java
deleted file mode 100644
index b27dd2a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryImpl.java
+++ /dev/null
@@ -1,729 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.cache.distributed.dht.*;
-import org.apache.ignite.internal.processors.cache.transactions.*;
-import org.apache.ignite.internal.util.lang.*;
-import org.apache.ignite.internal.util.tostring.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import static org.apache.ignite.cache.CacheMode.*;
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
-import static org.apache.ignite.internal.processors.cache.GridCacheUtils.*;
-
-/**
- * Entry wrapper that never obscures obsolete entries from user.
- */
-public class GridCacheEntryImpl<K, V> implements CacheEntry<K, V>, Externalizable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Collection of one peek mode to avoid collection creation. */
-    public static final List<GridCachePeekMode> MODES_SMART = F.asList(SMART);
-
-    /** Cache context. */
-    protected GridCacheContext<K, V> ctx;
-
-    /** Parent projection. */
-    protected GridCacheProxyImpl<K, V> proxy;
-
-    /** Key. */
-    @GridToStringInclude
-    protected K key;
-
-    /** Cached entry. */
-    @GridToStringInclude
-    protected volatile GridCacheEntryEx<K, V> cached;
-
-    /** Time to live. If not set, leaves cache entry ttl unchanged. */
-    private long ttl = -1;
-
-    /**
-     * Empty constructor required for {@link Externalizable}.
-     */
-    public GridCacheEntryImpl() {
-        // No-op.
-    }
-
-    /**
-     * @param prj Parent projection or {@code null} if entry belongs to default cache.
-     * @param ctx Context.
-     * @param key key.
-     * @param cached Cached entry.
-     */
-    @SuppressWarnings({"TypeMayBeWeakened"})
-    protected GridCacheEntryImpl(GridCacheProjectionImpl<K, V> prj,
-        GridCacheContext<K, V> ctx, K key,
-        GridCacheEntryEx<K, V> cached) {
-        assert ctx != null;
-        assert key != null;
-
-        this.ctx = ctx;
-        this.key = key;
-        this.cached = cached;
-
-        proxy = new GridCacheProxyImpl<>(ctx, prj != null ? prj : ctx.cache(), prj);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheProjection<K, V> projection() {
-        return proxy;
-    }
-
-    /**
-     * @return Cache entry.
-     */
-    @Nullable public GridCacheEntryEx<K, V> unwrapNoCreate() {
-        GridCacheEntryEx<K, V> cached = this.cached;
-
-        if (cached == null || cached.obsolete())
-            this.cached = cached = peekEx(ctx.affinity().affinityTopologyVersion());
-
-        return cached;
-    }
-
-    /**
-     * Unwraps cache entry and returns tuple containing unwrapped entry and boolean flag
-     * indicating whether entry was actually created.
-     *
-     * @param create Flag to create entry if it does not exists.
-     * @return Tuple.
-     */
-    private IgniteBiTuple<GridCacheEntryEx<K, V>, Boolean> unwrapChecked(boolean create) {
-        GridCacheEntryEx<K, V> cached = this.cached;
-
-        try {
-            if (cached == null) {
-                long topVer = ctx.affinity().affinityTopologyVersion();
-
-                this.cached = cached = create ? entryEx(false, topVer) : peekEx(topVer);
-
-                return F.t(cached, create);
-            }
-            else
-                return F.t(cached, false);
-        }
-        catch (GridDhtInvalidPartitionException ignore) {
-            return F.t(null, false);
-        }
-    }
-
-    /**
-     * Gets cache entry for adding metadata. Will create entry only if {@code allowEmptyEntries} set to false
-     * on cache configuration.
-     *
-     * @return Cache entry.
-     */
-    private GridCacheEntryEx<K, V> unwrapForMeta() {
-        GridCacheEntryEx<K, V> cached = this.cached;
-
-        long topVer = ctx.affinity().affinityTopologyVersion();
-
-        if (cached == null || cached.obsolete())
-            this.cached = cached = peekEx(topVer);
-
-        // Try create only if cache allows empty entries.
-        if (cached == null)
-            throw new IgniteException("Failed to access cache entry metadata (entry is not present). " +
-                "Put value to cache before accessing metadata: " + key);
-
-        this.cached = cached = entryEx(true, topVer);
-
-        assert cached != null;
-
-        return cached;
-    }
-
-    /** {@inheritDoc} */
-    protected GridCacheEntryEx<K, V> entryEx(boolean touch, long topVer) {
-        return ctx.cache().entryEx(key, touch);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable protected GridCacheEntryEx<K, V> peekEx(long topVer) {
-        return ctx.cache().peekEx(key);
-    }
-
-    /**
-     * Reset cached value so it will be re-cached.
-     */
-    protected void reset() {
-        cached = null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public K getKey() {
-        return key;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V getValue() {
-        try {
-            return get();
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V setValue(V val) {
-        try {
-            return set(val, CU.<K, V>empty());
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public Object version() {
-        while (true) {
-            try {
-                GridCacheEntryEx<K, V> e = unwrapNoCreate();
-
-                return e == null ? ctx.versions().next() : e.version().drVersion();
-            }
-            catch (GridCacheEntryRemovedException ignore) {
-                reset();
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public long expirationTime() {
-        if (ttl >= 0L)
-            return CU.toExpireTime(ttl);
-
-        while (true) {
-            try {
-                GridCacheEntryEx<K, V> entry = unwrapNoCreate();
-
-                return entry != null ? entry.expireTime() : 0L;
-            }
-            catch (GridCacheEntryRemovedException ignore) {
-                reset();
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean primary() {
-        return ctx.config().getCacheMode() == LOCAL ||
-            ctx.affinity().primary(ctx.localNode(), key, ctx.affinity().affinityTopologyVersion());
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean backup() {
-        return ctx.config().getCacheMode() != LOCAL &&
-            ctx.affinity().backups(key, ctx.affinity().affinityTopologyVersion()).contains(ctx.localNode());
-    }
-
-    /** {@inheritDoc} */
-    @Override public int partition() {
-        GridCacheEntryEx<K, V> e = unwrapNoCreate();
-
-        return e == null ? ctx.cache().affinity().partition(key) : e.partition();
-    }
-
-    /** {@inheritDoc} */
-    @Override public V peek() {
-        try {
-            return peek(MODES_SMART);
-        }
-        catch (IgniteCheckedException e) {
-            // Should never happen.
-            throw new IgniteException("Unable to perform entry peek() operation.", e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public V peek(@Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException {
-        return peek0(modes, CU.<K, V>empty(), ctx.atomic() ? null : ctx.tm().localTxx());
-    }
-
-    /**
-     * @param mode Peek mode.
-     * @param filter Optional entry filter.
-     * @param tx Transaction to peek at (if mode is TX).
-     * @return Peeked value.
-     * @throws IgniteCheckedException If failed.
-     */
-    @SuppressWarnings({"unchecked"})
-    @Nullable private V peek0(@Nullable GridCachePeekMode mode,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter, @Nullable IgniteInternalTx<K, V> tx)
-        throws IgniteCheckedException {
-        assert tx == null || tx.local();
-
-        if (mode == null)
-            mode = SMART;
-
-        GridCacheProjectionImpl<K, V> prjPerCall = proxy.gateProjection();
-
-        if (prjPerCall != null)
-            filter = ctx.vararg(F.and(ctx.vararg(proxy.predicate()), filter));
-
-        GridCacheProjectionImpl<K, V> prev = ctx.gate().enter(prjPerCall);
-
-        try {
-            while (true) {
-                boolean created = false;
-
-                GridCacheEntryEx<K, V> entry = null;
-
-                try {
-                    if (mode == DB || mode == SWAP) {
-                        IgniteBiTuple<GridCacheEntryEx<K, V>, Boolean> tup = unwrapChecked(true);
-
-                        assert tup.get2() != null;
-
-                        created = tup.get2();
-
-                        entry = tup.get1();
-                    }
-                    else
-                        entry = unwrapNoCreate();
-
-                    if (entry != null) {
-                        GridTuple<V> peek = entry.peek0(false, mode, filter, tx);
-
-                        return peek != null ? ctx.cloneOnFlag(peek.get()) : null;
-                    }
-                    else
-                        return null;
-                }
-                catch (GridCacheEntryRemovedException ignored) {
-                    reset();
-                }
-                catch (GridCacheFilterFailedException ignored) {
-                    assert false;
-
-                    return null;
-                }
-                finally {
-                    if (created) {
-                        assert entry != null;
-
-                        if (entry.markObsolete(ctx.versions().next()))
-                            entry.context().cache().removeEntry(entry);
-                    }
-                }
-            }
-        }
-        finally {
-            ctx.gate().leave(prev);
-        }
-    }
-
-    /**
-     * @param modes Peek modes.
-     * @param filter Optional entry filter.
-     * @param tx Transaction to peek at (if modes contains TX value).
-     * @return Peeked value.
-     * @throws IgniteCheckedException If failed.
-     */
-    @Nullable private V peek0(@Nullable Collection<GridCachePeekMode> modes,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter, IgniteInternalTx<K, V> tx) throws IgniteCheckedException {
-        if (F.isEmpty(modes))
-            return peek0(SMART, filter, tx);
-
-        assert modes != null;
-
-        for (GridCachePeekMode mode : modes) {
-            V val = peek0(mode, filter, tx);
-
-            if (val != null)
-                return val;
-        }
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V reload() throws IgniteCheckedException {
-        GridCacheProjectionImpl<K, V> old = ctx.gate().enter(proxy.gateProjection());
-
-        try {
-            return proxy.reload(key);
-        }
-        finally {
-            ctx.gate().leave(old);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> reloadAsync() {
-        GridCacheProjectionImpl<K, V> old = ctx.gate().enter(proxy.gateProjection());
-
-        try {
-            return proxy.reloadAsync(key);
-        }
-        finally {
-            ctx.gate().leave(old);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean evict() {
-        return proxy.evict(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean clear() {
-        return proxy.clear(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean compact() throws IgniteCheckedException {
-        return proxy.compact(key);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V get() throws IgniteCheckedException {
-        return proxy.get(key, isNearEnabled(ctx) ? null : cached, !ctx.keepPortable());
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> getAsync() {
-        return proxy.getAsync(key);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V set(V val, IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        // Should not pass dht entries as to near cache.
-        return proxy.put(key, val, isNearEnabled(ctx) ? null : cached, ttl, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> setAsync(V val, IgnitePredicate<CacheEntry<K, V>>[] filter) {
-        // Should not pass dht entries as to near cache.
-        return proxy.putAsync(key, val, isNearEnabled(ctx) ? null : cached, ttl, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean setx(V val, IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        // Should not pass dht entries as to near cache.
-        return proxy.putx(key, val, isNearEnabled(ctx) ? null : cached, ttl, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> setxAsync(V val, IgnitePredicate<CacheEntry<K, V>>[] filter) {
-        // Should not pass dht entries as to near cache.
-        return proxy.putxAsync(key, val, isNearEnabled(ctx) ? null : cached, ttl, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V replace(V val) throws IgniteCheckedException {
-        return set(val, ctx.hasPeekArray());
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> replaceAsync(V val) {
-        return setAsync(val, ctx.hasPeekArray());
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean replace(V oldVal, V newVal) throws IgniteCheckedException {
-        return setx(newVal, ctx.equalsPeekArray(newVal));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> replaceAsync(V oldVal, V newVal) {
-        return setxAsync(newVal, ctx.equalsPeekArray(newVal));
-    }
-
-    /** {@inheritDoc} */
-    @Override public long timeToLive() {
-        if (ttl >= 0L)
-            return ttl;
-
-        while (true) {
-            try {
-                GridCacheEntryEx<K, V> entry = unwrapNoCreate();
-
-                return entry != null ? entry.ttl() : 0L;
-            }
-            catch (GridCacheEntryRemovedException ignore) {
-                reset();
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"IfMayBeConditional"})
-    @Override public void timeToLive(long ttl) {
-        A.ensure(ttl >= 0, "ttl should not be negative");
-
-        this.ttl = ttl;
-
-        // Make sure to update only user transaction.
-        IgniteTxLocalAdapter<K, V> tx;
-
-        if (ctx.isDht())
-            tx = ctx.dht().near().context().tm().localTx();
-        else
-            tx = ctx.tm().localTx();
-
-        if (tx != null)
-            tx.entryTtl(ctx.txKey(key), ttl);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V setIfAbsent(V val) throws IgniteCheckedException {
-        return set(val, ctx.noPeekArray());
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> setIfAbsentAsync(V val) {
-        return setAsync(val, ctx.noPeekArray());
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean setxIfAbsent(V val) throws IgniteCheckedException {
-        return setx(val, ctx.noPeekArray());
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> setxIfAbsentAsync(V val) {
-        return setxAsync(val, ctx.noPeekArray());
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean replacex(V val) throws IgniteCheckedException {
-        return setx(val, ctx.hasPeekArray());
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> replacexAsync(V val) {
-        return setxAsync(val, ctx.hasPeekArray());
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V remove(IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        return proxy.remove(key, isNearEnabled(ctx) ? null : cached, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> removeAsync(IgnitePredicate<CacheEntry<K, V>>[] filter) {
-        return proxy.removeAsync(key, isNearEnabled(ctx) ? null : cached, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean removex(IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        return proxy.removex(key, isNearEnabled(ctx) ? null : cached, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removexAsync(IgnitePredicate<CacheEntry<K, V>>[] filter) {
-        return proxy.removexAsync(key, isNearEnabled(ctx) ? null : cached, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean remove(V val) throws IgniteCheckedException {
-        return proxy.remove(key, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removeAsync(V val) {
-        return proxy.removeAsync(key, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V1> V1 addMeta(String name, V1 val) {
-        GridCacheEntryEx<K, V> cached = unwrapForMeta();
-
-        return cached.addMeta(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"unchecked"})
-    @Override public <V1> V1 meta(String name) {
-        GridCacheEntryEx<K, V> e = unwrapForMeta();
-
-        return e.meta(name);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"unchecked"})
-    @Override public <V1> V1 removeMeta(String name) {
-        GridCacheEntryEx<K, V> e = unwrapForMeta();
-
-        return e.removeMeta(name);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V1> V1 putMetaIfAbsent(String name, V1 val) {
-        GridCacheEntryEx<K, V> cached = unwrapForMeta();
-
-        return cached.putMetaIfAbsent(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V1> V1 putMetaIfAbsent(String name, Callable<V1> c) {
-        GridCacheEntryEx<K, V> cached = unwrapForMeta();
-
-        return cached.putMetaIfAbsent(name, c);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V1> boolean replaceMeta(String name, V1 curVal, V1 newVal) {
-        GridCacheEntryEx<K, V> cached = unwrapForMeta();
-
-        return cached.replaceMeta(name, curVal, newVal);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V1> boolean removeMeta(String name, V1 val) {
-        GridCacheEntryEx e = unwrapForMeta();
-
-        return e.removeMeta(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLocked() {
-        while (true) {
-            try {
-                GridCacheEntryEx<K, V> e = unwrapNoCreate();
-
-                return e != null && e.lockedByAny();
-            }
-            catch (GridCacheEntryRemovedException ignore) {
-                reset();
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLockedByThread() {
-        while (true) {
-            try {
-                GridCacheEntryEx<K, V> e = unwrapNoCreate();
-
-                if (e == null)
-                    return false;
-
-                // Delegate to near if dht.
-                if (e.isDht() && isNearEnabled(ctx)) {
-                    GridCache<K, V> near = ctx.isDht() ? ctx.dht().near() : ctx.near();
-
-                    return near.isLockedByThread(key) || e.lockedByThread();
-                }
-
-                return e.lockedByThread();
-            }
-            catch (GridCacheEntryRemovedException ignore) {
-                reset();
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean lock(long timeout,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        return proxy.lock(key, timeout, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> lockAsync(long timeout,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) {
-        return proxy.lockAsync(key, timeout, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlock(IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        proxy.unlock(key, filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isCached() {
-        GridCacheEntryEx<K, V> cached = unwrapNoCreate();
-
-        return cached != null && !cached.obsolete();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(ctx);
-        out.writeObject(proxy);
-        out.writeObject(key);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"unchecked"})
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        ctx = (GridCacheContext<K, V>)in.readObject();
-        proxy = (GridCacheProxyImpl<K, V>)in.readObject();
-        key = (K)in.readObject();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int memorySize() throws IgniteCheckedException {
-        GridCacheEntryEx<K, V> cached = this.cached;
-
-        if (cached == null)
-            this.cached = cached = entryEx(true, ctx.affinity().affinityTopologyVersion());
-
-        return cached.memorySize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public <T> T unwrap(Class<T> clazz) {
-        if(clazz.isAssignableFrom(getClass()))
-            return clazz.cast(this);
-
-        throw new IllegalArgumentException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        return key.hashCode();
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"unchecked"})
-    @Override public boolean equals(Object obj) {
-        if (obj == this)
-            return true;
-
-        if (!(obj instanceof GridCacheEntryImpl))
-            return false;
-
-        GridCacheEntryImpl<K, V> other = (GridCacheEntryImpl<K, V>)obj;
-
-        V v1 = peek();
-        V v2 = other.peek();
-
-        return key.equals(other.key) && F.eq(ctx.cache().name(), other.ctx.cache().name()) && F.eq(v1, v2);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridCacheEntryImpl.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEntry.java
index 91fc7ef..2ce1e17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEntry.java
@@ -30,6 +30,7 @@ import org.jetbrains.annotations.*;
 
 import java.io.*;
 import java.util.*;
+import java.util.Map.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
@@ -39,7 +40,7 @@ import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
 /**
  * Entry wrapper that never obscures obsolete entries from user.
  */
-public class GridCacheEvictionEntry<K, V> implements CacheEntry<K, V>, Externalizable {
+public class GridCacheEvictionEntry<K, V> implements Entry<K, V>, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
index 7e7d526..e73cfc0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.CacheEntry;
 import org.apache.ignite.cache.eviction.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.events.*;
@@ -43,6 +42,7 @@ import org.jdk8.backport.*;
 import org.jetbrains.annotations.*;
 import sun.misc.*;
 
+import javax.cache.Cache.*;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
@@ -650,7 +650,7 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
      * @throws IgniteCheckedException If failed to evict entry.
      */
     private boolean evict0(GridCacheAdapter<K, V> cache, GridCacheEntryEx<K, V> entry, GridCacheVersion obsoleteVer,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter, boolean explicit) throws IgniteCheckedException {
+        @Nullable IgnitePredicate<Entry<K, V>>[] filter, boolean explicit) throws IgniteCheckedException {
         assert cache != null;
         assert entry != null;
         assert obsoleteVer != null;
@@ -849,7 +849,7 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
      * @throws IgniteCheckedException In case of error.
      */
     public boolean evict(@Nullable GridCacheEntryEx<K, V> entry, @Nullable GridCacheVersion obsoleteVer,
-        boolean explicit, @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
+        boolean explicit, @Nullable IgnitePredicate<Entry<K, V>>[] filter) throws IgniteCheckedException {
         if (entry == null)
             return true;
 
@@ -863,7 +863,7 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
         if (evictSyncAgr) {
             assert !cctx.isNear(); // Make sure cache is not NEAR.
 
-            if (entry.wrap(false).backup() && evictSync)
+            if (/*entry.wrap(false).backup() && TODO ignite-96*/evictSync)
                 // Do not track backups if evicts are synchronized.
                 return !explicit;
 
@@ -982,7 +982,7 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
      * @param filter Filter.
      * @throws GridCacheEntryRemovedException If entry got removed.
      */
-    private void enqueue(GridCacheEntryEx<K, V> entry, IgnitePredicate<CacheEntry<K, V>>[] filter)
+    private void enqueue(GridCacheEntryEx<K, V> entry, IgnitePredicate<Entry<K, V>>[] filter)
         throws GridCacheEntryRemovedException {
         Node<EvictionInfo> node = entry.meta(meta);
 
@@ -1227,11 +1227,11 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
      * @param info Eviction info.
      * @return Version aware filter.
      */
-    private IgnitePredicate<CacheEntry<K, V>>[] versionFilter(final EvictionInfo info) {
+    private IgnitePredicate<Entry<K, V>>[] versionFilter(final EvictionInfo info) {
         // If version has changed since we started the whole process
         // then we should not evict entry.
-        return cctx.vararg(new P1<CacheEntry<K, V>>() {
-            @Override public boolean apply(CacheEntry<K, V> e) {
+        return cctx.vararg(new P1<Entry<K, V>>() {
+            @Override public boolean apply(Entry<K, V> e) {
                 GridCacheVersion ver = (GridCacheVersion)e.version();
 
                 return info.version().equals(ver) && F.isAll(info.filter());
@@ -1452,7 +1452,7 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
         private GridCacheVersion ver;
 
         /** Filter to pass before entry will be evicted. */
-        private IgnitePredicate<CacheEntry<K, V>>[] filter;
+        private IgnitePredicate<Entry<K, V>>[] filter;
 
         /**
          * @param entry Entry.
@@ -1460,7 +1460,7 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
          * @param filter Filter.
          */
         EvictionInfo(GridCacheEntryEx<K, V> entry, GridCacheVersion ver,
-            IgnitePredicate<CacheEntry<K, V>>[] filter) {
+            IgnitePredicate<Entry<K, V>>[] filter) {
             assert entry != null;
             assert ver != null;
 
@@ -1486,7 +1486,7 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
         /**
          * @return Filter.
          */
-        IgnitePredicate<CacheEntry<K, V>>[] filter() {
+        IgnitePredicate<Entry<K, V>>[] filter() {
             return filter;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheFilterEvaluationEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheFilterEvaluationEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheFilterEvaluationEntry.java
deleted file mode 100644
index 9e4c684..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheFilterEvaluationEntry.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
-
-/**
- * Entry implementation for passing raw cache map entries through filters.
- * Needed to protect original entry from invalidation by filter's peek.
- */
-@SuppressWarnings("unchecked")
-public class GridCacheFilterEvaluationEntry<K, V> implements CacheEntry<K, V> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Allow transactional peeks flag. */
-    private boolean allowTx;
-
-    /** Key. */
-    private K key;
-
-    /** Value. */
-    private V val;
-
-    /** Entry implementation. */
-    private GridCacheEntryEx<K, V> impl;
-
-    /**
-     * @param key Key.
-     * @param val Value.
-     * @param impl Entry implementation.
-     * @param allowTx Whether value access is allowed in transactional mode.
-     */
-    public GridCacheFilterEvaluationEntry(K key, V val, GridCacheEntryEx<K, V> impl, boolean allowTx) {
-        this(key, val, impl);
-
-        this.allowTx = allowTx;
-    }
-
-    /**
-     * @param key Key.
-     * @param val Value.
-     * @param impl Entry implementation.
-     */
-    public GridCacheFilterEvaluationEntry(K key, V val, GridCacheEntryEx<K, V> impl) {
-        assert key != null;
-
-        this.key = key;
-        this.val = val;
-        this.impl = impl;
-    }
-
-    /** {@inheritDoc} */
-    @Override public K getKey() {
-        return key;
-    }
-
-    /** {@inheritDoc} */
-    @Override public V getValue() {
-        return val;
-    }
-
-    /** {@inheritDoc} */
-    @Override public V setValue(V val) {
-        throw new UnsupportedOperationException("setValue");
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V peek() {
-        return val;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V peek(@Nullable Collection<GridCachePeekMode> modes) {
-        for (GridCachePeekMode mode : modes) {
-            V val = peek(mode);
-
-            if (val != null)
-                return val;
-        }
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable private  V peek(@Nullable GridCachePeekMode mode) {
-        return !allowTx && mode == TX ? null : val;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V get() throws IgniteCheckedException {
-        throw new UnsupportedOperationException("get");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> getAsync() {
-        throw new UnsupportedOperationException("getAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheProjection<K, V> projection() {
-        throw new UnsupportedOperationException("parent");
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V reload() throws IgniteCheckedException {
-        throw new UnsupportedOperationException("reload");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> reloadAsync() {
-        throw new UnsupportedOperationException("reloadAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLocked() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLockedByThread() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Object version() {
-        try {
-            return impl.version().drVersion();
-        }
-        catch (GridCacheEntryRemovedException e) {
-            assert false : "Entry should not become obsolete while holding lock";
-
-            throw new IgniteException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public long expirationTime() {
-        try {
-            return impl.expireTime();
-        }
-        catch (GridCacheEntryRemovedException e) {
-            assert false : "Entry should not become obsolete while holding lock";
-
-            throw new IgniteException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public long timeToLive() {
-        try {
-            return impl.ttl();
-        }
-        catch (GridCacheEntryRemovedException e) {
-            assert false : "Entry should not become obsolete while holding lock";
-
-            throw new IgniteException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void timeToLive(long ttl) {
-        throw new UnsupportedOperationException("timeToLive(long)");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean primary() {
-        throw new UnsupportedOperationException("primary");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean backup() {
-        throw new UnsupportedOperationException("backup");
-    }
-
-    /** {@inheritDoc} */
-    @Override public int partition() {
-        return impl.partition();
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V set(V val, @Nullable IgnitePredicate<CacheEntry<K, V>>... filter)
-        throws IgniteCheckedException {
-        throw new UnsupportedOperationException("set");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> setAsync(V val, @Nullable IgnitePredicate<CacheEntry<K, V>>... filter) {
-        throw new UnsupportedOperationException("setAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V setIfAbsent(V val) throws IgniteCheckedException {
-        throw new UnsupportedOperationException("setIfAbsent");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> setIfAbsentAsync(V val) {
-        throw new UnsupportedOperationException("setIfAbsentAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean setx(V val, @Nullable IgnitePredicate<CacheEntry<K, V>>... filter)
-        throws IgniteCheckedException {
-        throw new UnsupportedOperationException("setx");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> setxAsync(V val,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter) {
-        throw new UnsupportedOperationException("setxAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean setxIfAbsent(@Nullable V val) throws IgniteCheckedException {
-        throw new UnsupportedOperationException("setxIfAbsent");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> setxIfAbsentAsync(V val) {
-        throw new UnsupportedOperationException("setxIfAbsentAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V replace(V val) throws IgniteCheckedException {
-        throw new UnsupportedOperationException("replace");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> replaceAsync(V val) {
-        throw new UnsupportedOperationException("replaceAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean replacex(V val) throws IgniteCheckedException {
-        throw new UnsupportedOperationException("replacex");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> replacexAsync(V val) {
-        throw new UnsupportedOperationException("replacexAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean replace(V oldVal, V newVal) throws IgniteCheckedException {
-        throw new UnsupportedOperationException("replace");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> replaceAsync(V oldVal, V newVal) {
-        throw new UnsupportedOperationException("replaceAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public V remove(@Nullable IgnitePredicate<CacheEntry<K, V>>... filter)
-        throws IgniteCheckedException {
-        throw new UnsupportedOperationException("remove");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<V> removeAsync(@Nullable IgnitePredicate<CacheEntry<K, V>>... filter) {
-        throw new UnsupportedOperationException("removeAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean removex(@Nullable IgnitePredicate<CacheEntry<K, V>>... filter) throws IgniteCheckedException {
-        throw new UnsupportedOperationException("removex");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removexAsync(@Nullable IgnitePredicate<CacheEntry<K, V>>... filter) {
-        throw new UnsupportedOperationException("removexAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean remove(V val) throws IgniteCheckedException {
-        throw new UnsupportedOperationException("remove");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removeAsync(V val) {
-        throw new UnsupportedOperationException("removeAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean evict() {
-        throw new UnsupportedOperationException("evict");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean clear() {
-        throw new UnsupportedOperationException("clear");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean compact()
-        throws IgniteCheckedException {
-        throw new UnsupportedOperationException("compact");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean lock(long timeout, @Nullable IgnitePredicate<CacheEntry<K, V>>... filter)
-        throws IgniteCheckedException {
-        throw new UnsupportedOperationException("lock");
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> lockAsync(long timeout,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter) {
-        throw new UnsupportedOperationException("lockAsync");
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlock(IgnitePredicate<CacheEntry<K, V>>... filter) throws IgniteCheckedException {
-        throw new UnsupportedOperationException("unlock");
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isCached() {
-        return !impl.obsolete();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int memorySize() throws IgniteCheckedException {
-        return impl.memorySize();
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public <V> V addMeta(String name, V val) {
-        return impl.addMeta(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public <V> V putMetaIfAbsent(String name, V val) {
-        return impl.putMetaIfAbsent(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public <V> V putMetaIfAbsent(String name, Callable<V> c) {
-        return impl.putMetaIfAbsent(name, c);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V> V meta(String name) {
-        return impl.meta(name);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V> V removeMeta(String name) {
-        return impl.removeMeta(name);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V> boolean removeMeta(String name, V val) {
-        return impl.removeMeta(name, val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V> boolean replaceMeta(String name, V curVal, V newVal) {
-        return impl.replaceMeta(name, curVal, newVal);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <T> T unwrap(Class<T> clazz) {
-        if(clazz.isAssignableFrom(getClass()))
-            return clazz.cast(this);
-
-        throw new IllegalArgumentException();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridCacheFilterEvaluationEntry.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/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 6aafc5d..82bbc47 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
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.CacheEntry;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.internal.managers.deployment.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.*;
@@ -37,6 +36,7 @@ import org.apache.ignite.lang.*;
 import org.jetbrains.annotations.*;
 import sun.misc.*;
 
+import javax.cache.Cache.*;
 import javax.cache.expiry.*;
 import javax.cache.processor.*;
 import java.io.*;
@@ -510,7 +510,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
                     e = detached() ? cctx.swap().read(this, true, true, true) : cctx.swap().readAndRemove(this);
 
                 if (log.isDebugEnabled())
-                    log.debug("Read swap entry [swapEntry=" + e + ", cacheEntry=" + this + ']');
+                    log.debug("Read swap entry [swapEntry=" + e + ", Entry=" + this + ']');
 
                 flags |= IS_UNSWAPPED_MASK;
 
@@ -620,7 +620,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
      */
     @SuppressWarnings({"RedundantTypeArguments"})
     @Nullable protected V readThrough(@Nullable IgniteInternalTx<K, V> tx, K key, boolean reload,
-        IgnitePredicate<CacheEntry<K, V>>[] filter, UUID subjId, String taskName) throws IgniteCheckedException {
+        IgnitePredicate<Entry<K, V>>[] filter, UUID subjId, String taskName) throws IgniteCheckedException {
         return cctx.store().loadFromStore(tx, key);
     }
 
@@ -636,7 +636,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
         UUID subjId,
         Object transformClo,
         String taskName,
-        IgnitePredicate<CacheEntry<K, V>>[] filter,
+        IgnitePredicate<Entry<K, V>>[] filter,
         @Nullable IgniteCacheExpiryPolicy expirePlc)
         throws IgniteCheckedException, GridCacheEntryRemovedException, GridCacheFilterFailedException {
         cctx.denyOnFlag(LOCAL);
@@ -669,7 +669,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
         UUID subjId,
         Object transformClo,
         String taskName,
-        IgnitePredicate<CacheEntry<K, V>>[] filter,
+        IgnitePredicate<Entry<K, V>>[] filter,
         @Nullable IgniteCacheExpiryPolicy expiryPlc)
         throws IgniteCheckedException, GridCacheEntryRemovedException, GridCacheFilterFailedException {
         // Disable read-through if there is no store.
@@ -682,7 +682,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
         V ret = null;
 
         if (!F.isEmptyOrNulls(filter) && !cctx.isAll(
-            (new GridCacheFilterEvaluationEntry<>(key, rawGetOrUnmarshal(true), this, true)), filter))
+            (new CacheEntryImpl<>(key, rawGetOrUnmarshal(true))), filter))
             return CU.<V>failed(failFast);
 
         GridCacheVersion startVer;
@@ -935,7 +935,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
 
     /** {@inheritDoc} */
     @SuppressWarnings({"unchecked", "TooBroadScope"})
-    @Nullable @Override public final V innerReload(IgnitePredicate<CacheEntry<K, V>>[] filter)
+    @Nullable @Override public final V innerReload(IgnitePredicate<Entry<K, V>>[] filter)
         throws IgniteCheckedException, GridCacheEntryRemovedException {
         cctx.denyOnFlag(READ);
 
@@ -1048,7 +1048,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
         boolean evt,
         boolean metrics,
         long topVer,
-        IgnitePredicate<CacheEntry<K, V>>[] filter,
+        IgnitePredicate<Entry<K, V>>[] filter,
         GridDrType drType,
         long drExpireTime,
         @Nullable GridCacheVersion explicitVer,
@@ -1199,7 +1199,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
         boolean evt,
         boolean metrics,
         long topVer,
-        IgnitePredicate<CacheEntry<K, V>>[] filter,
+        IgnitePredicate<Entry<K, V>>[] filter,
         GridDrType drType,
         @Nullable GridCacheVersion explicitVer,
         @Nullable UUID subjId,
@@ -1397,7 +1397,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
         @Nullable ExpiryPolicy expiryPlc,
         boolean evt,
         boolean metrics,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter,
+        @Nullable IgnitePredicate<Entry<K, V>>[] filter,
         boolean intercept,
         @Nullable UUID subjId,
         String taskName
@@ -1639,7 +1639,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
         boolean metrics,
         boolean primary,
         boolean verCheck,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter,
+        @Nullable IgnitePredicate<Entry<K, V>>[] filter,
         GridDrType drType,
         long drTtl,
         long drExpireTime,
@@ -2213,7 +2213,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
 
     /** {@inheritDoc} */
     @Override public boolean clear(GridCacheVersion ver, boolean readers,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
+        @Nullable IgnitePredicate<Entry<K, V>>[] filter) throws IgniteCheckedException {
         cctx.denyOnFlag(READ);
 
         boolean ret;
@@ -2458,7 +2458,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
     }
 
     /** {@inheritDoc} */
-    @Override public boolean invalidate(@Nullable IgnitePredicate<CacheEntry<K, V>>[] filter)
+    @Override public boolean invalidate(@Nullable IgnitePredicate<Entry<K, V>>[] filter)
         throws GridCacheEntryRemovedException, IgniteCheckedException {
         if (F.isEmptyOrNulls(filter)) {
             synchronized (this) {
@@ -2498,7 +2498,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
     }
 
     /** {@inheritDoc} */
-    @Override public boolean compact(@Nullable IgnitePredicate<CacheEntry<K, V>>[] filter)
+    @Override public boolean compact(@Nullable IgnitePredicate<Entry<K, V>>[] filter)
         throws GridCacheEntryRemovedException, IgniteCheckedException {
         // For optimistic checking.
         GridCacheVersion startVer;
@@ -2673,7 +2673,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public V peek(GridCachePeekMode mode, IgnitePredicate<CacheEntry<K, V>>[] filter)
+    @Nullable @Override public V peek(GridCachePeekMode mode, IgnitePredicate<Entry<K, V>>[] filter)
         throws GridCacheEntryRemovedException {
         try {
             GridTuple<V> peek = peek0(false, mode, filter, cctx.tm().localTxx());
@@ -2723,7 +2723,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
     }
 
     /** {@inheritDoc} */
-    @Override public V peek(Collection<GridCachePeekMode> modes, IgnitePredicate<CacheEntry<K, V>>[] filter)
+    @Override public V peek(Collection<GridCachePeekMode> modes, IgnitePredicate<Entry<K, V>>[] filter)
         throws GridCacheEntryRemovedException {
         assert modes != null;
 
@@ -2749,7 +2749,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
 
     /** {@inheritDoc} */
     @Nullable @Override public V peekFailFast(GridCachePeekMode mode,
-        IgnitePredicate<CacheEntry<K, V>>[] filter)
+        IgnitePredicate<Entry<K, V>>[] filter)
         throws GridCacheEntryRemovedException, GridCacheFilterFailedException {
         try {
             GridTuple<V> peek = peek0(true, mode, filter, cctx.tm().localTxx());
@@ -2773,7 +2773,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
      */
     @SuppressWarnings({"RedundantTypeArguments"})
     @Nullable @Override public GridTuple<V> peek0(boolean failFast, GridCachePeekMode mode,
-        IgnitePredicate<CacheEntry<K, V>>[] filter, @Nullable IgniteInternalTx<K, V> tx)
+        IgnitePredicate<Entry<K, V>>[] filter, @Nullable IgniteInternalTx<K, V> tx)
         throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException {
         assert tx == null || tx.local();
 
@@ -2885,7 +2885,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
      * @throws GridCacheEntryRemovedException If entry got removed.
      * @throws IgniteCheckedException If unexpected cache failure occurred.
      */
-    @Nullable private GridTuple<V> peekTxThenGlobal(boolean failFast, IgnitePredicate<CacheEntry<K, V>>[] filter,
+    @Nullable private GridTuple<V> peekTxThenGlobal(boolean failFast, IgnitePredicate<Entry<K, V>>[] filter,
         IgniteInternalTx<K, V> tx) throws GridCacheFilterFailedException, GridCacheEntryRemovedException, IgniteCheckedException {
         GridTuple<V> peek = peekTx(failFast, filter, tx);
 
@@ -2906,7 +2906,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
      * @throws GridCacheFilterFailedException If filter failed.
      */
     @Nullable private GridTuple<V> peekTx(boolean failFast,
-        IgnitePredicate<CacheEntry<K, V>>[] filter,
+        IgnitePredicate<Entry<K, V>>[] filter,
         @Nullable IgniteInternalTx<K, V> tx) throws GridCacheFilterFailedException {
         return tx == null ? null : tx.peek(cctx, failFast, key, filter);
     }
@@ -2922,7 +2922,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
      */
     @SuppressWarnings({"RedundantTypeArguments"})
     @Nullable private GridTuple<V> peekGlobal(boolean failFast, long topVer,
-        IgnitePredicate<CacheEntry<K, V>>[] filter)
+        IgnitePredicate<Entry<K, V>>[] filter)
         throws GridCacheEntryRemovedException, GridCacheFilterFailedException, IgniteCheckedException {
         if (!valid(topVer))
             return null;
@@ -2971,7 +2971,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
      * @throws GridCacheFilterFailedException If filter failed.
      */
     @SuppressWarnings({"unchecked"})
-    @Nullable private GridTuple<V> peekSwap(boolean failFast, IgnitePredicate<CacheEntry<K, V>>[] filter)
+    @Nullable private GridTuple<V> peekSwap(boolean failFast, IgnitePredicate<Entry<K, V>>[] filter)
         throws IgniteCheckedException, GridCacheFilterFailedException {
         if (!cctx.isAll(wrap(false), filter))
             return F.t((V)CU.failed(failFast));
@@ -2994,7 +2994,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
      * @throws GridCacheFilterFailedException If filter failed.
      */
     @SuppressWarnings({"unchecked"})
-    @Nullable private V peekDb(boolean failFast, IgnitePredicate<CacheEntry<K, V>>[] filter)
+    @Nullable private V peekDb(boolean failFast, IgnitePredicate<Entry<K, V>>[] filter)
         throws IgniteCheckedException, GridCacheFilterFailedException {
         if (!cctx.isAll(wrap(false), filter))
             return CU.failed(failFast);
@@ -3694,34 +3694,19 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
         return rawGetOrUnmarshalUnlocked(false);
     }
 
-    /**
-     * Wraps this map entry into cache entry.
-     *
-     * @param prjAware {@code true} if entry should inherit projection properties.
-     * @return Wrapped entry.
-     */
-    @Override public CacheEntry<K, V> wrap(boolean prjAware) {
-        GridCacheProjectionImpl<K, V> prjPerCall = null;
-
-        if (prjAware)
-            prjPerCall = cctx.projectionPerCall();
-
-        return new GridCacheEntryImpl<>(prjPerCall, cctx, key, this);
-    }
-
     /** {@inheritDoc} */
-    @Override public CacheEntry<K, V> wrapFilterLocked() throws IgniteCheckedException {
-        return null;
+    @Override public Entry<K, V> wrapFilterLocked() throws IgniteCheckedException {
+        return new CacheEntryImpl<>(key, rawGetOrUnmarshal(true));
     }
 
     /** {@inheritDoc} */
-    @Override public CacheEntry<K, V> evictWrap() {
+    @Override public Entry<K, V> evictWrap() {
         return new GridCacheEvictionEntry<>(this);
     }
 
     /** {@inheritDoc} */
     @Override public boolean evictInternal(boolean swap, GridCacheVersion obsoleteVer,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
+        @Nullable IgnitePredicate<Entry<K, V>>[] filter) throws IgniteCheckedException {
         boolean marked = false;
 
         try {
@@ -3888,7 +3873,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
      * @param filter Entry filter.
      * @return {@code True} if entry is visitable.
      */
-    public boolean visitable(IgnitePredicate<CacheEntry<K, V>>[] filter) {
+    public boolean visitable(IgnitePredicate<Entry<K, V>>[] filter) {
         try {
             if (obsoleteOrDeleted() || (filter != CU.<K, V>empty() && !cctx.isAll(wrap(false), filter)))
                 return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/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 1d30458..abe2a99 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
@@ -27,6 +27,7 @@ import org.apache.ignite.lang.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
 
+import javax.cache.Cache.*;
 import javax.cache.expiry.*;
 import javax.cache.processor.*;
 import java.util.*;
@@ -49,7 +50,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      *
      * @return Filter on which this projection is based on.
      */
-    @Nullable public IgnitePredicate<CacheEntry<K, V>> predicate();
+    @Nullable public IgnitePredicate<Entry<K, V>> predicate();
 
     /**
      * Internal method that is called from {@link GridCacheEntryImpl}.
@@ -63,7 +64,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @throws IgniteCheckedException If failed.
      */
     @Nullable public V put(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter) throws IgniteCheckedException;
+        @Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**
      * Internal method that is called from {@link GridCacheEntryImpl}.
@@ -76,7 +77,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @return Put operation future.
      */
     public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter);
+        @Nullable IgnitePredicate<Entry<K, V>>... filter);
 
     /**
      * Internal method that is called from {@link GridCacheEntryImpl}.
@@ -90,7 +91,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @throws IgniteCheckedException If failed.
      */
     public boolean putx(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter) throws IgniteCheckedException;
+        @Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**
      * Internal method that is called from {@link GridCacheEntryImpl}.
@@ -103,7 +104,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @return Putx operation future.
      */
     public IgniteInternalFuture<Boolean> putxAsync(K key, V val, @Nullable GridCacheEntryEx<K, V> entry, long ttl,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter);
+        @Nullable IgnitePredicate<Entry<K, V>>... filter);
 
     /**
      * Store DR data.
@@ -134,7 +135,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @throws IgniteCheckedException If failed.
      */
     @Nullable public V remove(K key, @Nullable GridCacheEntryEx<K, V> entry,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter) throws IgniteCheckedException;
+        @Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**
      * Internal method that is called from {@link GridCacheEntryImpl}.
@@ -145,7 +146,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @return Put operation future.
      */
     public IgniteInternalFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx<K, V> entry,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter);
+        @Nullable IgnitePredicate<Entry<K, V>>... filter);
 
     /**
      * Removes DR data.
@@ -176,7 +177,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @throws IgniteCheckedException If failed.
      */
     public boolean removex(K key, @Nullable GridCacheEntryEx<K, V> entry,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter) throws IgniteCheckedException;
+        @Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**
      * Internal method that is called from {@link GridCacheEntryImpl}.
@@ -187,7 +188,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @return Putx operation future.
      */
     public IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx<K, V> entry,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter);
+        @Nullable IgnitePredicate<Entry<K, V>>... filter);
 
     /**
      * Asynchronously stores given key-value pair in cache only if only if the previous value is equal to the
@@ -293,7 +294,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @throws IgniteCheckedException If failed.
      */
     @Nullable public V get(K key, @Nullable GridCacheEntryEx<K, V> entry, boolean deserializePortable,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>... filter) throws IgniteCheckedException;
+        @Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException;
 
     /**
      * Gets value from cache. Will go to primary node even if this is a backup.
@@ -372,7 +373,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @param filter Filter.
      * @return Entry set.
      */
-    public Set<CacheEntry<K, V>> entrySetx(IgnitePredicate<CacheEntry<K, V>>... filter);
+    public Set<Entry<K, V>> entrySetx(IgnitePredicate<Entry<K, V>>... filter);
 
     /**
      * Gets set of primary entries containing internal entries.
@@ -380,7 +381,7 @@ public interface GridCacheProjectionEx<K, V> extends CacheProjection<K, V> {
      * @param filter Optional filter.
      * @return Primary entry set.
      */
-    public Set<CacheEntry<K, V>> primaryEntrySetx(IgnitePredicate<CacheEntry<K, V>>... filter);
+    public Set<Entry<K, V>> primaryEntrySetx(IgnitePredicate<Entry<K, V>>... filter);
 
     /**
      * @return {@link ExpiryPolicy} associated with this projection.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridPartitionedCacheEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridPartitionedCacheEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridPartitionedCacheEntryImpl.java
deleted file mode 100644
index 2fc3a93..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridPartitionedCacheEntryImpl.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.processors.cache.distributed.dht.*;
-import org.apache.ignite.internal.processors.cache.distributed.dht.colocated.*;
-import org.apache.ignite.internal.processors.cache.distributed.near.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.lang.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
-
-/**
- * Partitioned cache entry public API.
- */
-public class GridPartitionedCacheEntryImpl<K, V> extends GridCacheEntryImpl<K, V> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Empty constructor required for {@link Externalizable}.
-     */
-    public GridPartitionedCacheEntryImpl() {
-        // No-op.
-    }
-
-    /**
-     * @param nearPrj Parent projection or {@code null} if entry belongs to default cache.
-     * @param ctx Near cache context.
-     * @param key key.
-     * @param cached Cached entry (either from near or dht cache map).
-     */
-    public GridPartitionedCacheEntryImpl(GridCacheProjectionImpl<K, V> nearPrj, GridCacheContext<K, V> ctx, K key,
-        @Nullable GridCacheEntryEx<K, V> cached) {
-        super(nearPrj, ctx, key, cached);
-
-        assert !this.ctx.isDht() || ctx.isColocated();
-    }
-
-    /**
-     * @return Dht cache.
-     */
-    public GridDhtCacheAdapter<K, V> dht() {
-        return ctx.isColocated() ? ctx.colocated() : ctx.isDhtAtomic() ? ctx.dht() : ctx.near().dht();
-    }
-
-    /**
-     * @return Near cache.
-     */
-    public GridNearCacheAdapter<K, V> near() {
-        return ctx.near();
-    }
-
-    /** {@inheritDoc} */
-    @Override public V peek(@Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException {
-        if (modes.contains(NEAR_ONLY) && ctx.isNear())
-            return peekNear0(modes, CU.<K, V>empty());
-
-        V val = null;
-
-        if (!modes.contains(PARTITIONED_ONLY))
-            val = super.peek(modes);
-
-        if (val == null)
-            val = peekDht0(modes, CU.<K, V>empty());
-
-        return val;
-    }
-
-    /**
-     * @param filter Filter.
-     * @return Peeked value.
-     */
-    @Nullable public V peekDht(@Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) {
-        try {
-            return peekDht0(SMART, filter);
-        }
-        catch (IgniteCheckedException e) {
-            // Should never happen.
-            throw new IgniteException("Unable to perform entry peek() operation.", e);
-        }
-    }
-
-    /**
-     * @param modes Peek modes.
-     * @param filter Optional entry filter.
-     * @return Peeked value.
-     * @throws IgniteCheckedException If failed.
-     */
-    @Nullable private V peekNear0(@Nullable Collection<GridCachePeekMode> modes,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        if (F.isEmpty(modes))
-            return peekNear0(SMART, filter);
-
-        assert modes != null;
-
-        for (GridCachePeekMode mode : modes) {
-            V val = peekNear0(mode, filter);
-
-            if (val != null)
-                return val;
-        }
-
-        return null;
-    }
-
-    /**
-     * @param mode Peek mode.
-     * @param filter Optional entry filter.
-     * @return Peeked value.
-     * @throws IgniteCheckedException If failed.
-     */
-    @SuppressWarnings({"unchecked"})
-    @Nullable private V peekNear0(@Nullable GridCachePeekMode mode,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        if (mode == null)
-            mode = SMART;
-
-        while (true) {
-            GridCacheProjectionImpl<K, V> prjPerCall = proxy.gateProjection();
-
-            if (prjPerCall != null)
-                filter = ctx.vararg(F0.and(ctx.vararg(proxy.predicate()), filter));
-
-            GridCacheProjectionImpl<K, V> prev = ctx.gate().enter(prjPerCall);
-
-            try {
-                GridCacheEntryEx<K, V> entry = near().peekEx(key);
-
-                return entry == null ? null : ctx.cloneOnFlag(entry.peek(mode, filter));
-            }
-            catch (GridCacheEntryRemovedException ignore) {
-                // No-op.
-            }
-            finally {
-                ctx.gate().leave(prev);
-            }
-        }
-    }
-
-    /**
-     * @param modes Peek modes.
-     * @param filter Optional entry filter.
-     * @return Peeked value.
-     * @throws IgniteCheckedException If failed.
-     */
-    @Nullable private V peekDht0(@Nullable Collection<GridCachePeekMode> modes,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        if (F.isEmpty(modes))
-            return peekDht0(SMART, filter);
-
-        assert modes != null;
-
-        for (GridCachePeekMode mode : modes) {
-            V val = peekDht0(mode, filter);
-
-            if (val != null)
-                return val;
-        }
-
-        return null;
-    }
-
-    /**
-     * @param mode Peek mode.
-     * @param filter Optional entry filter.
-     * @return Peeked value.
-     * @throws IgniteCheckedException If failed.
-     */
-    @SuppressWarnings({"unchecked"})
-    @Nullable private V peekDht0(@Nullable GridCachePeekMode mode,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        if (mode == null)
-            mode = SMART;
-
-        while (true) {
-            GridCacheProjectionImpl<K, V> prjPerCall = proxy.gateProjection();
-
-            if (prjPerCall != null)
-                filter = ctx.vararg(F0.and(ctx.vararg(proxy.predicate()), filter));
-
-            GridCacheProjectionImpl<K, V> prev = ctx.gate().enter(prjPerCall);
-
-            try {
-                GridCacheEntryEx<K, V> entry = dht().peekEx(key);
-
-                if (entry == null)
-                    return null;
-                else {
-                    GridTuple<V> peek = entry.peek0(false, mode, filter, ctx.tm().localTxx());
-
-                    return peek != null ? ctx.cloneOnFlag(peek.get()) : null;
-                }
-            }
-            catch (GridCacheEntryRemovedException ignore) {
-                // No-op.
-            }
-            catch (GridCacheFilterFailedException e) {
-                e.printStackTrace();
-
-                assert false;
-
-                return null;
-            }
-            finally {
-                ctx.gate().leave(prev);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridCacheEntryEx<K, V> entryEx(boolean touch, long topVer) {
-        try {
-            return ctx.affinity().localNode(key, topVer) ? dht().entryEx(key, touch) :
-                ctx.isNear() ? near().entryEx(key, touch) :
-                    new GridDhtDetachedCacheEntry<>(ctx, key, 0, null, null, 0, 0);
-        }
-        catch (GridDhtInvalidPartitionException ignore) {
-            return ctx.isNear() ? near().entryEx(key) :
-                new GridDhtDetachedCacheEntry<>(ctx, key, 0, null, null, 0, 0);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridCacheEntryEx<K, V> peekEx(long topVer) {
-        try {
-            return ctx.affinity().localNode(key, topVer) ? dht().peekEx(key) :
-                ctx.isNear() ? near().peekEx(key) : null;
-        }
-        catch (GridDhtInvalidPartitionException ignore) {
-            return ctx.isNear() ? near().peekEx(key) : null;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V1> V1 addMeta(String name, V1 val) {
-        V1 v = null;
-
-        GridDhtCacheEntry<K, V> de = dht().peekExx(key);
-
-        if (de != null)
-            v = de.addMeta(name, val);
-
-        if (ctx.isNear()) {
-            GridNearCacheEntry<K, V> ne = de != null ? near().peekExx(key) :
-                near().entryExx(key, ctx.affinity().affinityTopologyVersion());
-
-            if (ne != null) {
-                V1 v1 = ne.addMeta(name, val);
-
-                if (v == null)
-                    v = v1;
-            }
-        }
-
-        return v;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings( {"RedundantCast"})
-    @Override public <V1> V1 meta(String name) {
-        V1 v = null;
-
-        GridDhtCacheEntry<K, V> de = dht().peekExx(key);
-
-        if (de != null)
-            v = (V1)de.meta(name);
-
-        if (ctx.isNear()) {
-            GridNearCacheEntry<K, V> ne = near().peekExx(key);
-
-            if (ne != null) {
-                V1 v1 = (V1)ne.meta(name);
-
-                if (v == null)
-                    v = v1;
-            }
-        }
-
-        return v;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings( {"RedundantCast"})
-    @Override public <V1> V1 putMetaIfAbsent(String name, Callable<V1> c) {
-        V1 v = null;
-
-        GridDhtCacheEntry<K, V> de = dht().peekExx(key);
-
-        if (de != null)
-            v = (V1)de.putMetaIfAbsent(name, c);
-
-        if (ctx.isNear()) {
-            GridNearCacheEntry<K, V> ne = de != null ? near().peekExx(key) :
-                near().entryExx(key, ctx.affinity().affinityTopologyVersion());
-
-            if (ne != null) {
-                V1 v1 = (V1)ne.putMetaIfAbsent(name, c);
-
-                if (v == null)
-                    v = v1;
-            }
-        }
-
-        return v;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings( {"RedundantCast"})
-    @Override public <V1> V1 putMetaIfAbsent(String name, V1 val) {
-        V1 v = null;
-
-        GridDhtCacheEntry<K, V> de = dht().peekExx(key);
-
-        if (de != null)
-            v = (V1)de.putMetaIfAbsent(name, val);
-
-        GridNearCacheEntry<K, V> ne = de != null ? near().peekExx(key) :
-            near().entryExx(key, ctx.affinity().affinityTopologyVersion());
-
-        if (ne != null) {
-            V1 v1 = (V1)ne.putMetaIfAbsent(name, val);
-
-            if (v == null)
-                v = v1;
-        }
-
-        return v;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings( {"RedundantCast"})
-    @Override public <V1> V1 removeMeta(String name) {
-        V1 v = null;
-
-        GridDhtCacheEntry<K, V> de = dht().peekExx(key);
-
-        if (de != null)
-            v = (V1)de.removeMeta(name);
-
-        if (ctx.isNear()) {
-            GridNearCacheEntry<K, V> ne = near().peekExx(key);
-
-            if (ne != null) {
-                V1 v1 = (V1)ne.removeMeta(name);
-
-                if (v == null)
-                    v = v1;
-            }
-        }
-
-        return v;
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V1> boolean removeMeta(String name, V1 val) {
-        boolean b = false;
-
-        GridDhtCacheEntry<K, V> de = dht().peekExx(key);
-
-        if (de != null)
-            b = de.removeMeta(name, val);
-
-        if (ctx.isNear()) {
-            GridNearCacheEntry<K, V> ne = near().peekExx(key);
-
-            if (ne != null)
-                b |= ne.removeMeta(name, val);
-        }
-
-        return b;
-    }
-
-    /** {@inheritDoc} */
-    @Override public <V1> boolean replaceMeta(String name, V1 curVal, V1 newVal) {
-        boolean b = false;
-
-        GridDhtCacheEntry<K, V> de = dht().peekExx(key);
-
-        if (de != null)
-            b = de.replaceMeta(name, curVal, newVal);
-
-        if (ctx.isNear()) {
-            GridNearCacheEntry<K, V> ne = near().peekExx(key);
-
-            if (ne != null)
-                b |= ne.replaceMeta(name, curVal, newVal);
-        }
-
-        return b;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridPartitionedCacheEntryImpl.class, this, super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
index fa26e21..b2fcc50 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.dht;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
@@ -630,18 +629,6 @@ public class GridDhtCacheEntry<K, V> extends GridDistributedCacheEntry<K, V> {
         return cand;
     }
 
-    /** {@inheritDoc} */
-    @Override public CacheEntry<K, V> wrap(boolean prjAware) {
-        GridCacheContext<K, V> nearCtx = cctx.dht().near().context();
-
-        GridCacheProjectionImpl<K, V> prjPerCall = nearCtx.projectionPerCall();
-
-        if (prjPerCall != null && prjAware)
-            return new GridPartitionedCacheEntryImpl<>(prjPerCall, nearCtx, key, this);
-
-        return new GridPartitionedCacheEntryImpl<>(null, nearCtx, key, this);
-    }
-
     /**
      * @return Cache name.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntryImpl.java
deleted file mode 100644
index 4984624..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntryImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.util.*;
-
-import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*;
-import static org.apache.ignite.internal.processors.cache.GridCacheUtils.*;
-
-/**
- * Colocated cache entry public API.
- */
-public class GridDhtCacheEntryImpl<K, V> extends GridCacheEntryImpl<K, V> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Empty constructor required for {@link Externalizable}.
-     */
-    public GridDhtCacheEntryImpl() {
-        // No-op.
-    }
-
-    /**
-     * @param nearPrj Parent projection or {@code null} if entry belongs to default cache.
-     * @param ctx Near cache context.
-     * @param key key.
-     * @param cached Cached entry (either from near or dht cache map).
-     */
-    @SuppressWarnings({"TypeMayBeWeakened"})
-    public GridDhtCacheEntryImpl(GridCacheProjectionImpl<K, V> nearPrj, GridCacheContext<K, V> ctx, K key,
-        @Nullable GridCacheEntryEx<K, V> cached) {
-        super(nearPrj, ctx, key, cached);
-
-        assert !this.ctx.isDht() || !isNearEnabled(ctx);
-    }
-
-    /**
-     * @return Dht cache.
-     */
-    private GridDhtCacheAdapter<K, V> dht() {
-        return ctx.dht();
-    }
-
-    /** {@inheritDoc} */
-    @Override public V peek(@Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException {
-        if (!ctx.isNear() && modes.contains(NEAR_ONLY))
-            return null;
-
-        V val = null;
-
-        if (!modes.contains(PARTITIONED_ONLY))
-            val = super.peek(modes);
-
-        if (val == null)
-            val = peekDht0(modes, CU.<K, V>empty());
-
-        return val;
-    }
-
-    /**
-     * @param filter Filter.
-     * @return Peeked value.
-     */
-    @Nullable private V peekDht(@Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) {
-        try {
-            return peekDht0(SMART, filter);
-        }
-        catch (IgniteCheckedException e) {
-            // Should never happen.
-            throw new IgniteException("Unable to perform entry peek() operation.", e);
-        }
-    }
-
-    /**
-     * @param modes Peek modes.
-     * @param filter Optional entry filter.
-     * @return Peeked value.
-     * @throws IgniteCheckedException If failed.
-     */
-    @Nullable private V peekDht0(@Nullable Collection<GridCachePeekMode> modes,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        if (F.isEmpty(modes))
-            return peekDht0(SMART, filter);
-
-        assert modes != null;
-
-        for (GridCachePeekMode mode : modes) {
-            V val = peekDht0(mode, filter);
-
-            if (val != null)
-                return val;
-        }
-
-        return null;
-    }
-
-    /**
-     * @param mode Peek mode.
-     * @param filter Optional entry filter.
-     * @return Peeked value.
-     * @throws IgniteCheckedException If failed.
-     */
-    @SuppressWarnings({"unchecked"})
-    @Nullable private V peekDht0(@Nullable GridCachePeekMode mode,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter) throws IgniteCheckedException {
-        if (mode == null)
-            mode = SMART;
-
-        while (true) {
-            GridCacheProjectionImpl<K, V> prjPerCall = proxy.gateProjection();
-
-            if (prjPerCall != null)
-                filter = ctx.vararg(F.and(ctx.vararg(proxy.predicate()), filter));
-
-            GridCacheProjectionImpl<K, V> prev = ctx.gate().enter(prjPerCall);
-
-            try {
-                GridCacheEntryEx<K, V> entry = dht().peekEx(key);
-
-                return entry == null ? null : ctx.cloneOnFlag(entry.peek(mode, filter));
-            }
-            catch (GridCacheEntryRemovedException ignore) {
-                // No-op.
-            }
-            finally {
-                ctx.gate().leave(prev);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLocked() {
-        // Check colocated explicit locks.
-        return ctx.mvcc().isLockedByThread(key, -1);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLockedByThread() {
-        // Check colocated explicit locks.
-        return ctx.mvcc().isLockedByThread(key, Thread.currentThread().getId());
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridDhtCacheEntryImpl.class, this, super.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
index 6078425..9ff7c5c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCacheEntry.java
@@ -24,6 +24,8 @@ import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 
+import javax.cache.Cache.*;
+
 /**
  * DHT atomic cache entry.
  */
@@ -47,28 +49,11 @@ public class GridDhtAtomicCacheEntry<K, V> extends GridDhtCacheEntry<K, V> {
     }
 
     /** {@inheritDoc} */
-    @Override public CacheEntry<K, V> wrap(boolean prjAware) {
-        GridCacheProjectionImpl<K, V> prjPerCall = cctx.projectionPerCall();
-
-        if (prjPerCall != null && prjAware)
-            return new GridPartitionedCacheEntryImpl<>(prjPerCall, cctx, key, this);
-
-        return new GridPartitionedCacheEntryImpl<>(null, cctx, key, this);
-    }
-
-    /** {@inheritDoc} */
     @Override protected String cacheName() {
         return CU.isNearEnabled(cctx) ? super.cacheName() : cctx.dht().name();
     }
 
     /** {@inheritDoc} */
-    @Override public CacheEntry<K, V> wrapFilterLocked() throws IgniteCheckedException {
-        assert Thread.holdsLock(this);
-
-        return new GridCacheFilterEvaluationEntry<>(key, rawGetOrUnmarshal(true), this);
-    }
-
-    /** {@inheritDoc} */
     @Override public synchronized String toString() {
         return S.toString(GridDhtAtomicCacheEntry.class, this, super.toString());
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e80f874/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
index a6656b4..25bb8bc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCacheEntry.java
@@ -46,16 +46,6 @@ public class GridDhtColocatedCacheEntry<K, V> extends GridDhtCacheEntry<K, V> {
     }
 
     /** {@inheritDoc} */
-    @Override public CacheEntry<K, V> wrap(boolean prjAware) {
-        GridCacheProjectionImpl<K, V> prjPerCall = cctx.projectionPerCall();
-
-        if (prjPerCall != null && prjAware)
-            return new GridPartitionedCacheEntryImpl<>(prjPerCall, cctx, key, this);
-
-        return new GridDhtCacheEntryImpl<>(null, cctx, key, this);
-    }
-
-    /** {@inheritDoc} */
     @Override protected String cacheName() {
         return cctx.colocated().name();
     }


Mime
View raw message