ignite-946: renamed VersionedEntry to CacheEntry
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4f8f32af Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4f8f32af Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4f8f32af Branch: refs/heads/ignite-843 Commit: 4f8f32af80d2c13df3fd8d3c5b302c0fd04906c5 Parents: 954c459 Author: Denis Magda <dma...@gridgain.com> Authored: Thu Aug 13 09:10:45 2015 +0300 Committer: Denis Magda <dma...@gridgain.com> Committed: Thu Aug 13 09:10:45 2015 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/cache/CacheEntry.java | 94 ++++++++++++++++++++ .../ignite/cache/version/VersionedEntry.java | 92 ------------------- .../ignite/cache/version/package-info.java | 21 ----- .../processors/cache/CacheEntryImpl.java | 6 +- .../processors/cache/CacheEntryImpl0.java | 6 +- .../processors/cache/CacheEntryImplEx.java | 83 +++++++++++++++++ .../processors/cache/CacheInvokeEntry.java | 6 +- .../processors/cache/GridCacheEntryEx.java | 2 +- .../processors/cache/GridCacheMapEntry.java | 12 +-- .../cache/version/CacheVersionedEntryImpl.java | 83 ----------------- .../resources/META-INF/classnames.properties | 3 +- .../processors/cache/GridCacheTestEntryEx.java | 2 +- .../CacheVersionedEntryAbstractTest.java | 27 +++--- 13 files changed, 209 insertions(+), 228 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java new file mode 100644 index 0000000..a6a2aa3 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java @@ -0,0 +1,94 @@ +/* + * 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.cache; + +import org.apache.ignite.*; + +import javax.cache.*; +import javax.cache.processor.*; +import java.util.*; + +/** + * Cache entry that extends {@link javax.cache.Cache.Entry} by providing additional entry related information. + * + * To get an instance of {@code CacheEntry} use {@link javax.cache.Cache.Entry#unwrap(Class)} method by passing + * {@code CacheEntry} class to it as the argument. + * <p> + * {@code CacheEntry} is supported only for {@link javax.cache.Cache.Entry} returned by one of the following methods: + * <ul> + * <li>{@link javax.cache.Cache#invoke(Object, EntryProcessor, Object...)}</li> + * <li>{@link javax.cache.Cache#invokeAll(Set, EntryProcessor, Object...)}</li> + * <li>invoke and invokeAll methods of {@link IgniteCache}</li> + * <li>{@link IgniteCache#randomEntry()}</li> + * </ul> + * <p> + * {@code CacheEntry} is not supported for {@link javax.cache.Cache#iterator()} because of performance reasons. + * {@link javax.cache.Cache#iterator()} loads entries from all the cluster nodes and to speed up the load additional + * information, like entry's version, is ignored. + * + * <h2 class="header">Java Example</h2> + * <pre name="code" class="java"> + * IgniteCache<Integer, String> cache = grid(0).cache(null); + * + * CacheEntry<String, Integer> entry1 = cache.invoke(100, + * new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() { + * public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry, + * Object... arguments) throws EntryProcessorException { + * return entry.unwrap(CacheEntry.class); + * } + * }); + * + * // Cache entry for the given key may be updated at some point later. + * + * CacheEntry<String, Integer> entry2 = cache.invoke(100, + * new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() { + * public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry, + * Object... arguments) throws EntryProcessorException { + * return entry.unwrap(CacheEntry.class); + * } + * }); + * + * // Comparing entries' versions. + * if (entry1.version().compareTo(entry2.version()) < 0) { + * // the entry has been updated + * } + * </pre> + */ +public interface CacheEntry<K, V> extends Cache.Entry<K, V> { + /** + * Returns a comparable object representing the version of this cache entry. + * <p> + * It is valid to compare cache entries' versions for the same key. In this case the latter update will be + * represented by a higher version. The result of versions comparison of cache entries of different keys is + * undefined. + * + * @return Version of this cache entry. + */ + public Comparable version(); + + /** + * Returns the time when the cache entry for the given key has been updated or initially created. + * <p> + * It is valid to compare cache entries' update time for the same key. In this case the latter update will + * be represented by higher update time. The result of update time comparison of cache entries of different keys is + * undefined. + * + * @return Time in milliseconds. + */ + public long updateTime(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java deleted file mode 100644 index 135d681..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java +++ /dev/null @@ -1,92 +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.cache.version; - -import org.apache.ignite.*; - -import javax.cache.*; -import javax.cache.processor.*; -import java.util.*; - -/** - * Cache entry that stores entry's version related information along with its data. - * - * To get a {@code VersionedEntry} of an {@link Cache.Entry} use {@link Cache.Entry#unwrap(Class)} by passing - * {@code VersionedEntry} class to it as the argument. - * <p> - * {@code VersionedEntry} is supported only for {@link Cache.Entry} returned by one of the following methods: - * <ul> - * <li>{@link Cache#invoke(Object, EntryProcessor, Object...)}</li> - * <li>{@link Cache#invokeAll(Set, EntryProcessor, Object...)}</li> - * <li>invoke and invokeAll methods of {@link IgniteCache}</li> - * <li>{@link IgniteCache#randomEntry()}</li> - * </ul> - * <p> - * {@code VersionedEntry} is not supported for {@link Cache#iterator()} because of performance reasons. - * {@link Cache#iterator()} loads entries from all the cluster nodes and to speed up the load version information - * is excluded from responses. - * <h2 class="header">Java Example</h2> - * <pre name="code" class="java"> - * IgniteCache<Integer, String> cache = grid(0).cache(null); - * - * VersionedEntry<String, Integer> entry1 = cache.invoke(100, - * new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() { - * public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry, - * Object... arguments) throws EntryProcessorException { - * return entry.unwrap(VersionedEntry.class); - * } - * }); - * - * // Cache entry for the given key may be updated at some point later. - * - * VersionedEntry<String, Integer> entry2 = cache.invoke(100, - * new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() { - * public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry, - * Object... arguments) throws EntryProcessorException { - * return entry.unwrap(VersionedEntry.class); - * } - * }); - * - * if (entry1.version().compareTo(entry2.version()) < 0) { - * // the entry has been updated - * } - * </pre> - */ -public interface VersionedEntry<K, V> extends Cache.Entry<K, V> { - /** - * Returns a comparable object representing the version of this cache entry. - * <p> - * It is valid to compare cache entries' versions for the same key. In this case the latter update will be - * represented by a higher version. The result of versions comparison of cache entries of different keys is - * undefined. - * - * @return Version of this cache entry. - */ - public Comparable version(); - - /** - * Returns the time when the cache entry for the given key has been updated or initially created. - * <p> - * It is valid to compare cache entries' update time for the same key. In this case the latter update will - * be represented by higher update time. The result of update time comparison of cache entries of different keys is - * undefined. - * - * @return Time in milliseconds. - */ - public long updateTime(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java b/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java deleted file mode 100644 index 50ceb13..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java +++ /dev/null @@ -1,21 +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. - */ - -/** - * Contains cache versioned entry interface. - */ -package org.apache.ignite.cache.version; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/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 98f3616..3ef2889 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 @@ -17,7 +17,7 @@ package org.apache.ignite.internal.processors.cache; -import org.apache.ignite.cache.version.*; +import org.apache.ignite.cache.*; import org.apache.ignite.internal.processors.cache.version.*; import javax.cache.*; @@ -82,8 +82,8 @@ public class CacheEntryImpl<K, V> implements Cache.Entry<K, V>, Externalizable { if(cls.isAssignableFrom(getClass())) return cls.cast(this); - if (ver != null && cls.isAssignableFrom(VersionedEntry.class)) - return (T)new CacheVersionedEntryImpl<>(key, val, ver); + if (ver != null && cls.isAssignableFrom(CacheEntry.class)) + return (T)new CacheEntryImplEx<>(key, val, ver); throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java index 987fbd3..eabd2af 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java @@ -17,7 +17,7 @@ package org.apache.ignite.internal.processors.cache; -import org.apache.ignite.cache.version.*; +import org.apache.ignite.cache.*; import org.apache.ignite.internal.processors.cache.version.*; import javax.cache.*; @@ -52,8 +52,8 @@ public class CacheEntryImpl0<K, V> implements Cache.Entry<K, V> { @Override public <T> T unwrap(Class<T> cls) { if(cls.isAssignableFrom(getClass())) return cls.cast(this); - else if (cls.isAssignableFrom(VersionedEntry.class) && e instanceof GridCacheVersionAware) - return (T)new CacheVersionedEntryImpl<>(e.getKey(), e.getValue(), ((GridCacheVersionAware)e).version()); + else if (cls.isAssignableFrom(CacheEntry.class) && e instanceof GridCacheVersionAware) + return (T)new CacheEntryImplEx<>(e.getKey(), e.getValue(), ((GridCacheVersionAware)e).version()); throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/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 new file mode 100644 index 0000000..f674ba5 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java @@ -0,0 +1,83 @@ +/* + * 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.cache.*; +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.version.*; + +import java.io.*; + +/** + * + */ +public class CacheEntryImplEx<K, V> extends CacheEntryImpl<K, V> implements CacheEntry<K, V> { + /** */ + private static final long serialVersionUID = 0L; + + /** Version. */ + private GridCacheVersion ver; + + /** + * Required by {@link Externalizable}. + */ + public CacheEntryImplEx() { + // No-op. + } + + /** + * @param key Key. + * @param val Value (always null). + * @param ver Version. + */ + public CacheEntryImplEx(K key, V val, GridCacheVersion ver) { + super(key, val); + + this.ver = ver; + } + + /** {@inheritDoc} */ + public GridCacheVersion version() { + return ver; + } + + /** {@inheritDoc} */ + @Override public long updateTime() { + return ver.globalTime(); + } + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + super.writeExternal(out); + + out.writeObject(ver); + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + super.readExternal(in); + + ver = (GridCacheVersion)in.readObject(); + } + + /** {@inheritDoc} */ + public String toString() { + return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() + + ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", updateTime=" + ver.globalTime() + ']'; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java index 515a4c5..711b598 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java @@ -17,7 +17,7 @@ package org.apache.ignite.internal.processors.cache; -import org.apache.ignite.cache.version.*; +import org.apache.ignite.cache.*; import org.apache.ignite.internal.processors.cache.version.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -122,8 +122,8 @@ public class CacheInvokeEntry<K, V> extends CacheLazyEntry<K, V> implements Muta /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public <T> T unwrap(Class<T> cls) { - if (cls.isAssignableFrom(VersionedEntry.class) && ver != null) - return (T)new CacheVersionedEntryImpl<>(getKey(), getValue(), ver); + if (cls.isAssignableFrom(CacheEntry.class) && ver != null) + return (T)new CacheEntryImplEx<>(getKey(), getValue(), ver); return super.unwrap(cls); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java index c2d0271..1b5a717 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java @@ -163,7 +163,7 @@ public interface GridCacheEntryEx { * @return Entry which holds key and version (no value, since entry * is intended to be used in sync evictions checks). */ - public <K, V> CacheVersionedEntryImpl<K, V> wrapVersioned(); + public <K, V> CacheEntryImplEx<K, V> wrapVersioned(); /** * @return Not-null version if entry is obsolete. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/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 298f7a6..17cc8dd 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 @@ -3589,17 +3589,17 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme } /** {@inheritDoc} */ - @Override public synchronized <K, V> CacheVersionedEntryImpl<K, V> wrapVersioned() { - return new CacheVersionedEntryImpl<>(key.<K>value(cctx.cacheObjectContext(), false), null, ver); + @Override public synchronized <K, V> CacheEntryImplEx<K, V> wrapVersioned() { + return new CacheEntryImplEx<>(key.<K>value(cctx.cacheObjectContext(), false), null, ver); } /** * @return Entry which holds key, value and version. */ - private synchronized <K, V> CacheVersionedEntryImpl<K, V> wrapVersionedWithValue() { + private synchronized <K, V> CacheEntryImplEx<K, V> wrapVersionedWithValue() { V val = this.val == null ? null : this.val.<V>value(cctx.cacheObjectContext(), false); - return new CacheVersionedEntryImpl<>(key.<K>value(cctx.cacheObjectContext(), false), val, ver); + return new CacheEntryImplEx<>(key.<K>value(cctx.cacheObjectContext(), false), val, ver); } /** {@inheritDoc} */ @@ -4028,8 +4028,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme if (cls.isAssignableFrom(EvictableEntry.class)) return (T)wrapEviction(); - if (cls.isAssignableFrom(CacheVersionedEntryImpl.class)) - return cls == CacheVersionedEntryImpl.class ? (T)wrapVersioned() : (T)wrapVersionedWithValue(); + if (cls.isAssignableFrom(CacheEntryImplEx.class)) + return cls == CacheEntryImplEx.class ? (T)wrapVersioned() : (T)wrapVersionedWithValue(); if (cls.isAssignableFrom(GridCacheVersion.class)) return (T)ver; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java deleted file mode 100644 index c036bc1..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java +++ /dev/null @@ -1,83 +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.version; - -import org.apache.ignite.cache.version.*; -import org.apache.ignite.internal.processors.cache.*; -import org.jetbrains.annotations.*; - -import java.io.*; - -/** - * - */ -public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implements VersionedEntry<K, V> { - /** */ - private static final long serialVersionUID = 0L; - - /** Version. */ - private GridCacheVersion ver; - - /** - * Required by {@link Externalizable}. - */ - public CacheVersionedEntryImpl() { - // No-op. - } - - /** - * @param key Key. - * @param val Value (always null). - * @param ver Version. - */ - public CacheVersionedEntryImpl(K key, V val, GridCacheVersion ver) { - super(key, val); - - this.ver = ver; - } - - /** {@inheritDoc} */ - public GridCacheVersion version() { - return ver; - } - - /** {@inheritDoc} */ - @Override public long updateTime() { - return ver.globalTime(); - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - super.writeExternal(out); - - out.writeObject(ver); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - super.readExternal(in); - - ver = (GridCacheVersion)in.readObject(); - } - - /** {@inheritDoc} */ - public String toString() { - return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() + - ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", updateTime=" + ver.globalTime() + ']'; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/resources/META-INF/classnames.properties ---------------------------------------------------------------------- diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties index ff75b02..1fb9a37 100644 --- a/modules/core/src/main/resources/META-INF/classnames.properties +++ b/modules/core/src/main/resources/META-INF/classnames.properties @@ -35,6 +35,7 @@ org.apache.ignite.cache.CacheMode org.apache.ignite.cache.CachePartialUpdateException org.apache.ignite.cache.CachePeekMode org.apache.ignite.cache.CacheRebalanceMode +org.apache.ignite.cache.CacheEntry org.apache.ignite.cache.CacheServerNotFoundException org.apache.ignite.cache.CacheTypeFieldMetadata org.apache.ignite.cache.CacheTypeMetadata @@ -289,7 +290,7 @@ org.apache.ignite.internal.processors.cache.CacheOperationContext org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException org.apache.ignite.internal.processors.cache.CacheStorePartialUpdateException org.apache.ignite.internal.processors.cache.CacheType -org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryImpl +org.apache.ignite.internal.processors.cache.CacheEntryImplEx org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQueryFutureIterator org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java index eaa6e13..0055557 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java @@ -350,7 +350,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr } /** {@inheritDoc} */ - @Override public CacheVersionedEntryImpl wrapVersioned() { + @Override public CacheEntryImplEx wrapVersioned() { assert false; return null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java index 9648b9b..2e1ca90 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java @@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.version; import org.apache.ignite.*; import org.apache.ignite.cache.*; -import org.apache.ignite.cache.version.*; import org.apache.ignite.internal.processors.cache.*; import javax.cache.*; @@ -63,7 +62,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS invoked.incrementAndGet(); - VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class); + CacheEntry<Integer, String> verEntry = entry.unwrap(CacheEntry.class); checkVersionedEntry(verEntry); @@ -93,7 +92,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS invoked.incrementAndGet(); - VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class); + CacheEntry<Integer, String> verEntry = entry.unwrap(CacheEntry.class); checkVersionedEntry(verEntry); @@ -111,7 +110,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS IgniteCache<Integer, String> cache = grid(0).cache(null); for (int i = 0; i < 5; i++) - checkVersionedEntry(cache.randomEntry().unwrap(VersionedEntry.class)); + checkVersionedEntry(cache.randomEntry().unwrap(CacheEntry.class)); } /** @@ -125,7 +124,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS cache.localEntries(CachePeekMode.ONHEAP); for (Cache.Entry<Integer, String> entry : entries) - checkVersionedEntry(entry.unwrap(VersionedEntry.class)); + checkVersionedEntry(entry.unwrap(CacheEntry.class)); } /** @@ -134,21 +133,21 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS public void testVersionComparision() throws Exception { IgniteCache<Integer, String> cache = grid(0).cache(null); - VersionedEntry<String, Integer> ver1 = cache.invoke(100, - new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() { - @Override public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry, + CacheEntry<String, Integer> ver1 = cache.invoke(100, + new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() { + @Override public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry, Object... arguments) throws EntryProcessorException { - return entry.unwrap(VersionedEntry.class); + return entry.unwrap(CacheEntry.class); } }); cache.put(100, "new value 100"); - VersionedEntry<String, Integer> ver2 = cache.invoke(100, - new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() { - @Override public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry, + CacheEntry<String, Integer> ver2 = cache.invoke(100, + new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() { + @Override public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry, Object... arguments) throws EntryProcessorException { - return entry.unwrap(VersionedEntry.class); + return entry.unwrap(CacheEntry.class); } }); @@ -159,7 +158,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS /** * @param entry Versioned entry. */ - private void checkVersionedEntry(VersionedEntry<Integer, String> entry) { + private void checkVersionedEntry(CacheEntry<Integer, String> entry) { assertNotNull(entry); assertNotNull(entry.version());