IGNITE-1847: WIP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/33014462 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/33014462 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/33014462 Branch: refs/heads/ignite-1816 Commit: 330144620aade982b592f1d323898a2892125347 Parents: 65edfbc Author: vozerov-gridgain <voze...@gridgain.com> Authored: Wed Nov 11 13:29:35 2015 +0300 Committer: vozerov-gridgain <voze...@gridgain.com> Committed: Wed Nov 11 13:29:35 2015 +0300 ---------------------------------------------------------------------- .../CacheObjectBinaryProcessorImpl.java | 44 +++++------ .../cache/portable/PortableMetadataKey.java | 82 ++++++++++++++++++++ .../cache/portable/PortableMetadataKey2.java | 82 -------------------- 3 files changed, 104 insertions(+), 104 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/33014462/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java index d765197..05cfb5f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java @@ -110,7 +110,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm private final boolean clientNode; /** */ - private volatile IgniteCacheProxy<PortableMetadataKey2, BinaryMetadata> metaDataCache; + private volatile IgniteCacheProxy<PortableMetadataKey, BinaryMetadata> metaDataCache; /** */ private final ConcurrentHashMap8<Integer, BinaryTypeImpl> clientMetaDataCache; @@ -120,7 +120,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm private static final long serialVersionUID = 0L; @Override public boolean apply(GridCacheEntryEx e) { - return e.key().value(e.context().cacheObjectContext(), false) instanceof PortableMetadataKey2; + return e.key().value(e.context().cacheObjectContext(), false) instanceof PortableMetadataKey; } }; @@ -238,7 +238,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm GridCacheQueryManager qryMgr = metaDataCache.context().queries(); - CacheQuery<Map.Entry<PortableMetadataKey2, BinaryMetadata>> qry = + CacheQuery<Map.Entry<PortableMetadataKey, BinaryMetadata>> qry = qryMgr.createScanQuery(new MetaDataPredicate(), null, false); qry.keepAll(false); @@ -246,9 +246,9 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm qry.projection(ctx.cluster().get().forNode(oldestSrvNode)); try { - CacheQueryFuture<Map.Entry<PortableMetadataKey2, BinaryMetadata>> fut = qry.execute(); + CacheQueryFuture<Map.Entry<PortableMetadataKey, BinaryMetadata>> fut = qry.execute(); - Map.Entry<PortableMetadataKey2, BinaryMetadata> next; + Map.Entry<PortableMetadataKey, BinaryMetadata> next; while ((next = fut.next()) != null) { assert next.getKey() != null : next; @@ -294,7 +294,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm * @param key Metadata key. * @param newMeta Metadata. */ - private void addClientCacheMetaData(PortableMetadataKey2 key, final BinaryMetadata newMeta) { + private void addClientCacheMetaData(PortableMetadataKey key, final BinaryMetadata newMeta) { int key0 = key.typeId(); clientMetaDataCache.compute(key0, @@ -460,7 +460,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm BinaryMetadata newMeta0 = ((BinaryTypeImpl)newMeta).metadata(); - final PortableMetadataKey2 key = new PortableMetadataKey2(typeId); + final PortableMetadataKey key = new PortableMetadataKey(typeId); try { BinaryMetadata oldMeta = metaDataCache.localPeek(key); @@ -483,7 +483,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm if (clientNode) return clientMetaDataCache.get(typeId); else { - BinaryMetadata meta = metaDataCache.localPeek(new PortableMetadataKey2(typeId)); + BinaryMetadata meta = metaDataCache.localPeek(new PortableMetadataKey(typeId)); return meta != null ? meta.wrap(portableCtx) : null; } @@ -497,16 +497,16 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm @Override public Map<Integer, BinaryType> metadata(Collection<Integer> typeIds) throws BinaryObjectException { try { - Collection<PortableMetadataKey2> keys = new ArrayList<>(typeIds.size()); + Collection<PortableMetadataKey> keys = new ArrayList<>(typeIds.size()); for (Integer typeId : typeIds) - keys.add(new PortableMetadataKey2(typeId)); + keys.add(new PortableMetadataKey(typeId)); - Map<PortableMetadataKey2, BinaryMetadata> meta = metaDataCache.getAll(keys); + Map<PortableMetadataKey, BinaryMetadata> meta = metaDataCache.getAll(keys); Map<Integer, BinaryType> res = U.newHashMap(meta.size()); - for (Map.Entry<PortableMetadataKey2, BinaryMetadata> e : meta.entrySet()) + for (Map.Entry<PortableMetadataKey, BinaryMetadata> e : meta.entrySet()) res.put(e.getKey().typeId(), e.getValue().wrap(portableCtx)); return res; @@ -527,10 +527,10 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm }); else { return F.viewReadOnly(metaDataCache.entrySetx(metaPred), - new C1<Cache.Entry<PortableMetadataKey2, BinaryMetadata>, BinaryType>() { + new C1<Cache.Entry<PortableMetadataKey, BinaryMetadata>, BinaryType>() { private static final long serialVersionUID = 0L; - @Override public BinaryType apply(Cache.Entry<PortableMetadataKey2, BinaryMetadata> e) { + @Override public BinaryType apply(Cache.Entry<PortableMetadataKey, BinaryMetadata> e) { return e.getValue().wrap(portableCtx); } }); @@ -799,7 +799,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm /** */ private static class MetaDataProcessor implements - EntryProcessor<PortableMetadataKey2, BinaryMetadata, BinaryObjectException>, Externalizable { + EntryProcessor<PortableMetadataKey, BinaryMetadata, BinaryObjectException>, Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -829,7 +829,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm /** {@inheritDoc} */ @Override public BinaryObjectException process( - MutableEntry<PortableMetadataKey2, BinaryMetadata> entry, + MutableEntry<PortableMetadataKey, BinaryMetadata> entry, Object... args) { try { BinaryMetadata oldMeta = entry.getValue(); @@ -873,15 +873,15 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm /** * */ - class MetaDataEntryListener implements CacheEntryUpdatedListener<PortableMetadataKey2, BinaryMetadata> { + class MetaDataEntryListener implements CacheEntryUpdatedListener<PortableMetadataKey, BinaryMetadata> { /** {@inheritDoc} */ @Override public void onUpdated( - Iterable<CacheEntryEvent<? extends PortableMetadataKey2, ? extends BinaryMetadata>> evts) + Iterable<CacheEntryEvent<? extends PortableMetadataKey, ? extends BinaryMetadata>> evts) throws CacheEntryListenerException { - for (CacheEntryEvent<? extends PortableMetadataKey2, ? extends BinaryMetadata> evt : evts) { + for (CacheEntryEvent<? extends PortableMetadataKey, ? extends BinaryMetadata> evt : evts) { assert evt.getEventType() == EventType.CREATED || evt.getEventType() == EventType.UPDATED : evt; - PortableMetadataKey2 key = evt.getKey(); + PortableMetadataKey key = evt.getKey(); final BinaryMetadata newMeta = evt.getValue(); @@ -906,7 +906,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm /** {@inheritDoc} */ @Override public boolean evaluate(CacheEntryEvent<?, ?> evt) throws CacheEntryListenerException { - return evt.getKey() instanceof PortableMetadataKey2; + return evt.getKey() instanceof PortableMetadataKey; } /** {@inheritDoc} */ @@ -924,7 +924,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm /** {@inheritDoc} */ @Override public boolean apply(Object key, Object val) { - return key instanceof PortableMetadataKey2; + return key instanceof PortableMetadataKey; } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/33014462/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey.java new file mode 100644 index 0000000..f838c82 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey.java @@ -0,0 +1,82 @@ +/* + * 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.portable; + +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey; +import org.apache.ignite.internal.util.typedef.internal.S; + +/** + * Key for portable meta data. + */ +class PortableMetadataKey extends GridCacheUtilityKey<PortableMetadataKey> implements Externalizable { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + private int typeId; + + /** + * For {@link Externalizable}. + */ + public PortableMetadataKey() { + // No-op. + } + + /** + * @param typeId Type ID. + */ + PortableMetadataKey(int typeId) { + this.typeId = typeId; + } + + /** + * @return Type id. + */ + public int typeId() { + return typeId; + } + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + out.writeInt(typeId); + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + typeId = in.readInt(); + } + + /** {@inheritDoc} */ + @Override protected boolean equalsx(PortableMetadataKey key) { + return typeId == key.typeId; + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + return typeId; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(PortableMetadataKey.class, this); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/33014462/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java deleted file mode 100644 index 4c99b70..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/PortableMetadataKey2.java +++ /dev/null @@ -1,82 +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.portable; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey; -import org.apache.ignite.internal.util.typedef.internal.S; - -/** - * Key for portable meta data. - */ -class PortableMetadataKey2 extends GridCacheUtilityKey<PortableMetadataKey2> implements Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private int typeId; - - /** - * For {@link Externalizable}. - */ - public PortableMetadataKey2() { - // No-op. - } - - /** - * @param typeId Type ID. - */ - PortableMetadataKey2(int typeId) { - this.typeId = typeId; - } - - /** - * @return Type id. - */ - public int typeId() { - return typeId; - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeInt(typeId); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - typeId = in.readInt(); - } - - /** {@inheritDoc} */ - @Override protected boolean equalsx(PortableMetadataKey2 key) { - return typeId == key.typeId; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return typeId; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(PortableMetadataKey2.class, this); - } -} \ No newline at end of file