Fixed CacheEntry toString()
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a4b547bd Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a4b547bd Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a4b547bd Branch: refs/heads/ignite-gg-10889 Commit: a4b547bd11ca3bf4a5cdfaac3ad01936cf6e995e Parents: e1b2cf2 Author: Valentin Kulichenko <valentin.kuliche...@gmail.com> Authored: Thu Dec 17 17:07:26 2015 -0800 Committer: Valentin Kulichenko <valentin.kuliche...@gmail.com> Committed: Thu Dec 17 17:07:26 2015 -0800 ---------------------------------------------------------------------- .../internal/processors/cache/CacheEntryImpl.java | 6 +++--- .../processors/cache/CacheEntryImplEx.java | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/a4b547bd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java index 71c684a..48649d2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java @@ -81,10 +81,10 @@ public class CacheEntryImpl<K, V> implements Cache.Entry<K, V>, Externalizable { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public <T> T unwrap(Class<T> cls) { - if(cls.isAssignableFrom(getClass())) + if (cls.isAssignableFrom(getClass())) return cls.cast(this); - if (ver != null && cls.isAssignableFrom(CacheEntry.class)) + if (cls.isAssignableFrom(CacheEntry.class)) return (T)new CacheEntryImplEx<>(key, val, ver); throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls); @@ -106,4 +106,4 @@ public class CacheEntryImpl<K, V> implements Cache.Entry<K, V>, Externalizable { public String toString() { return "Entry [key=" + key + ", val=" + val + ']'; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/a4b547bd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java index f3e6c18..1c7111a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java @@ -78,7 +78,18 @@ public class CacheEntryImplEx<K, V> extends CacheEntryImpl<K, V> implements Cach /** {@inheritDoc} */ public String toString() { - return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() + - ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", updateTime=" + ver.globalTime() + ']'; + String res = "CacheEntry [key=" + getKey() + + ", val=" + getValue(); + + if (ver != null) { + res += ", topVer=" + ver.topologyVersion() + + ", nodeOrder=" + ver.nodeOrder() + + ", order=" + ver.order() + + ", updateTime=" + ver.globalTime(); + } + else + res += ", ver=n/a"; + + return res + ']'; } -} \ No newline at end of file +}