IGNITE-1945 - Introduced binary configuration.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3a32b5ff Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3a32b5ff Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3a32b5ff Branch: refs/heads/ignite-1945 Commit: 3a32b5ff96e224f99b9889220e4cc2bf184aee46 Parents: 66c84ea Author: Alexey Goncharuk <alexey.goncha...@gmail.com> Authored: Wed Nov 18 18:40:02 2015 +0300 Committer: Alexey Goncharuk <alexey.goncha...@gmail.com> Committed: Wed Nov 18 18:40:02 2015 +0300 ---------------------------------------------------------------------- .../config/binary/example-ignite-binary.xml | 2 +- .../java/org/apache/ignite/IgniteBinary.java | 9 +- .../java/org/apache/ignite/IgniteCache.java | 3 +- .../apache/ignite/binary/BinaryIdMapper.java | 4 +- .../org/apache/ignite/binary/BinaryObject.java | 3 +- .../apache/ignite/binary/BinarySerializer.java | 4 +- .../ignite/binary/BinaryTypeConfiguration.java | 47 +-- .../configuration/BinaryConfiguration.java | 105 +++++ .../configuration/IgniteConfiguration.java | 29 +- .../internal/MarshallerContextAdapter.java | 8 + .../internal/portable/BinaryObjectImpl.java | 11 +- .../portable/PortableClassDescriptor.java | 16 +- .../internal/portable/PortableContext.java | 75 +--- .../processors/cache/GridCacheProcessor.java | 4 +- .../CacheObjectBinaryProcessorImpl.java | 13 +- .../cache/store/CacheOsStoreManager.java | 4 +- .../cpp/PlatformCppConfigurationClosure.java | 10 +- .../PlatformDotNetConfigurationClosure.java | 14 +- .../marshaller/portable/BinaryMarshaller.java | 146 +++++++ .../marshaller/portable/PortableMarshaller.java | 263 ------------- .../resources/META-INF/classnames.properties | 28 +- .../portable/BinaryFieldsAbstractSelfTest.java | 31 +- .../portable/BinaryFieldsHeapSelfTest.java | 4 +- .../portable/BinaryFieldsOffheapSelfTest.java | 4 +- ...idBinaryObjectBuilderAdditionalSelfTest.java | 9 +- .../GridBinaryObjectBuilderSelfTest.java | 39 +- .../GridPortableAffinityKeySelfTest.java | 13 +- ...idPortableMarshallerCtxDisabledSelfTest.java | 10 +- .../GridPortableMarshallerSelfTest.java | 390 +++++++------------ .../portable/GridPortableMetaDataSelfTest.java | 13 +- .../portable/GridPortableWildcardsSelfTest.java | 243 ++++++------ .../PortableCompactOffsetsAbstractSelfTest.java | 23 +- .../PortableCompactOffsetsHeapSelfTest.java | 4 +- .../PortableCompactOffsetsOffheapSelfTest.java | 4 +- ...IgniteCacheAbstractExecutionContextTest.java | 4 +- .../IgniteCacheTxExecutionContextTest.java | 2 - ...naryObjectsAbstractDataStreamerSelfTest.java | 10 +- ...aryObjectsAbstractMultiThreadedSelfTest.java | 10 +- .../GridCacheBinaryObjectsAbstractSelfTest.java | 4 +- ...ntNodeBinaryObjectMetadataMultinodeTest.java | 4 +- ...CacheClientNodeBinaryObjectMetadataTest.java | 19 +- .../GridCachePortableStoreAbstractSelfTest.java | 11 +- ...ridPortableCacheEntryMemorySizeSelfTest.java | 8 +- ...leDuplicateIndexObjectsAbstractSelfTest.java | 11 +- .../DataStreamProcessorPortableSelfTest.java | 4 +- .../GridDataStreamerImplSelfTest.java | 4 +- ...ridCacheAffinityRoutingPortableSelfTest.java | 13 +- .../GridCacheMemoryModePortableSelfTest.java | 4 +- ...acheOffHeapTieredAtomicPortableSelfTest.java | 9 +- ...eapTieredEvictionAtomicPortableSelfTest.java | 9 +- ...heOffHeapTieredEvictionPortableSelfTest.java | 9 +- .../GridCacheOffHeapTieredPortableSelfTest.java | 9 +- ...sNearPartitionedByteArrayValuesSelfTest.java | 4 +- ...sPartitionedOnlyByteArrayValuesSelfTest.java | 4 +- .../IgnitePortableCacheFullApiTestSuite.java | 4 +- .../IgnitePortableCacheTestSuite.java | 4 +- .../IgnitePortableObjectsTestSuite.java | 2 +- .../IgnitePortableCacheQueryTestSuite.java | 4 +- 58 files changed, 821 insertions(+), 930 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/examples/config/binary/example-ignite-binary.xml ---------------------------------------------------------------------- diff --git a/examples/config/binary/example-ignite-binary.xml b/examples/config/binary/example-ignite-binary.xml index cde15ea..dbec5e9 100644 --- a/examples/config/binary/example-ignite-binary.xml +++ b/examples/config/binary/example-ignite-binary.xml @@ -38,7 +38,7 @@ <bean parent="ignite.cfg"> <!-- Enables portable marshaller --> <property name="marshaller"> - <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller"/> + <bean class="org.apache.ignite.marshaller.portable.BinaryMarshaller"/> </property> </bean> </beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java index 364bf4b..5eb2670 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java @@ -25,7 +25,6 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.TreeMap; import java.util.UUID; -import org.apache.ignite.marshaller.portable.PortableMarshaller; import org.apache.ignite.binary.BinaryObjectBuilder; import org.apache.ignite.binary.BinaryObjectException; import org.apache.ignite.binary.BinaryType; @@ -69,7 +68,7 @@ import org.jetbrains.annotations.Nullable; * </pre> * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized * typed objects at all times. In this case we do incur the deserialization cost. However, if - * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access + * {@link org.apache.ignite.marshaller.portable.BinaryMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access * and will cache the deserialized object, so it does not have to be deserialized again: * <pre name=code class=java> * IgniteCache<MyKey.class, MyValue.class> cache = grid.cache(null); @@ -152,7 +151,7 @@ import org.jetbrains.annotations.Nullable; * <h1 class="header">Configuration</h1> * By default all your objects are considered as binary and no specific configuration is needed. * However, in some cases, like when an object is used by both Java and .Net, you may need to specify portable objects - * explicitly by calling {@link PortableMarshaller#setClassNames(Collection)}. + * explicitly by calling {@link org.apache.ignite.marshaller.portable.BinaryMarshaller#setClassNames(Collection)}. * The only requirement Ignite imposes is that your object has an empty * constructor. Note, that since server side does not have to know the class definition, * you only need to list portable objects in configuration on the client side. However, if you @@ -236,7 +235,7 @@ import org.jetbrains.annotations.Nullable; * } * </pre> * Alternatively, if you cannot change class definitions, you can provide custom serialization - * logic in {@link org.apache.ignite.binary.BinarySerializer} either globally in {@link PortableMarshaller} or + * logic in {@link org.apache.ignite.binary.BinarySerializer} either globally in {@link org.apache.ignite.marshaller.portable.BinaryMarshaller} or * for a specific type via {@link org.apache.ignite.binary.BinaryTypeConfiguration} instance. * <p> * Similar to java serialization you can use {@code writeReplace()} and {@code readResolve()} methods. @@ -256,7 +255,7 @@ import org.jetbrains.annotations.Nullable; * internally. However, in cases when you want to provide your own ID mapping schema, * you can provide your own {@link org.apache.ignite.binary.BinaryIdMapper} implementation. * <p> - * ID-mapper may be provided either globally in {@link PortableMarshaller}, + * ID-mapper may be provided either globally in {@link org.apache.ignite.marshaller.portable.BinaryMarshaller}, * or for a specific type via {@link org.apache.ignite.binary.BinaryTypeConfiguration} instance. * <h1 class="header">Query Indexing</h1> * Portable objects can be indexed for querying by specifying index fields in http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/IgniteCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java index 4cb82da..5fcf8a2 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java @@ -55,7 +55,6 @@ import org.apache.ignite.lang.IgniteAsyncSupported; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgniteFuture; -import org.apache.ignite.marshaller.portable.PortableMarshaller; import org.apache.ignite.mxbean.CacheMetricsMXBean; import org.jetbrains.annotations.Nullable; @@ -163,7 +162,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS * BinaryObject po = prj.get(1); * </pre> * <p> - * Note that this method makes sense only if cache is working in binary mode ({@link PortableMarshaller} is used). + * Note that this method makes sense only if cache is working in binary mode ({@link org.apache.ignite.marshaller.portable.BinaryMarshaller} is used). * If not, this method is no-op and will return current cache. * * @return New cache instance for portable objects. http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java index 363b34d..a4a18f6 100644 --- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java +++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java @@ -17,8 +17,6 @@ package org.apache.ignite.binary; -import org.apache.ignite.marshaller.portable.PortableMarshaller; - /** * Type and field ID mapper for binary objects. Ignite never writes full * strings for field or type names. Instead, for performance reasons, Ignite @@ -29,7 +27,7 @@ import org.apache.ignite.marshaller.portable.PortableMarshaller; * actually do collide {@code BinaryIdMapper} allows to override the automatically * generated hash code IDs for the type and field names. * <p> - * Binary ID mapper can be configured for all binary objects via {@link PortableMarshaller#getIdMapper()} method, + * Binary ID mapper can be configured for all binary objects via {@link org.apache.ignite.marshaller.portable.BinaryMarshaller#getIdMapper()} method, * or for a specific binary type via {@link BinaryTypeConfiguration#getIdMapper()} method. */ public interface BinaryIdMapper { http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java index 9481618..12c2a6b 100644 --- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java +++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java @@ -22,7 +22,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.TreeMap; -import org.apache.ignite.marshaller.portable.PortableMarshaller; /** * Wrapper for binary object in binary format. Once an object is defined as binary, @@ -47,7 +46,7 @@ import org.apache.ignite.marshaller.portable.PortableMarshaller; * </pre> * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized * typed objects at all times. In this case we do incur the deserialization cost. However, if - * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access + * {@link org.apache.ignite.marshaller.portable.BinaryMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access * and will cache the deserialized object, so it does not have to be deserialized again: * <pre name=code class=java> * IgniteCache<MyKey.class, MyValue.class> cache = grid.cache(null); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java b/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java index 6fa4237..31b3d30 100644 --- a/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java +++ b/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java @@ -17,15 +17,13 @@ package org.apache.ignite.binary; -import org.apache.ignite.marshaller.portable.PortableMarshaller; - /** * Interface that allows to implement custom serialization logic for binary objects. * Can be used instead of {@link Binarylizable} in case if the class * cannot be changed directly. * <p> * Binary serializer can be configured for all binary objects via - * {@link PortableMarshaller#getSerializer()} method, or for a specific + * {@link org.apache.ignite.marshaller.portable.BinaryMarshaller#getSerializer()} method, or for a specific * binary type via {@link BinaryTypeConfiguration#getSerializer()} method. */ public interface BinarySerializer { http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java index c737ee2..d216866 100644 --- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java @@ -17,22 +17,20 @@ package org.apache.ignite.binary; -import java.util.Collection; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.configuration.BinaryConfiguration; /** * Defines configuration properties for a specific binary type. Providing per-type * configuration is optional, as it is generally enough, and also optional, to provide global binary - * configuration using {@link PortableMarshaller#setClassNames(Collection)}. + * configuration using {@link IgniteConfiguration#setBinaryConfiguration(BinaryConfiguration)}. * However, this class allows you to change configuration properties for a specific * binary type without affecting configuration for other binary types. - * <p> - * Per-type binary configuration can be specified in {@link PortableMarshaller#getTypeConfigurations()} method. */ public class BinaryTypeConfiguration { /** Class name. */ - private String clsName; + private String typeName; /** ID mapper. */ private BinaryIdMapper idMapper; @@ -40,9 +38,6 @@ public class BinaryTypeConfiguration { /** Serializer. */ private BinarySerializer serializer; - /** Keep deserialized flag. */ - private Boolean keepDeserialized; - /** */ public BinaryTypeConfiguration() { @@ -50,10 +45,10 @@ public class BinaryTypeConfiguration { } /** - * @param clsName Class name. + * @param typeName Class name. */ - public BinaryTypeConfiguration(String clsName) { - this.clsName = clsName; + public BinaryTypeConfiguration(String typeName) { + this.typeName = typeName; } /** @@ -61,17 +56,17 @@ public class BinaryTypeConfiguration { * * @return Type name. */ - public String getClassName() { - return clsName; + public String getTypeName() { + return typeName; } /** * Sets type name. * - * @param clsName Type name. + * @param typeName Type name. */ - public void setClassName(String clsName) { - this.clsName = clsName; + public void setTypeName(String typeName) { + this.typeName = typeName; } /** @@ -110,24 +105,6 @@ public class BinaryTypeConfiguration { this.serializer = serializer; } - /** - * Defines whether {@link BinaryObject} should cache deserialized instance. If provided, - * this value will override {@link PortableMarshaller#isKeepDeserialized()} - * property. - * - * @return Whether deserialized value is kept. - */ - public Boolean isKeepDeserialized() { - return keepDeserialized; - } - - /** - * @param keepDeserialized Whether deserialized value is kept. - */ - public void setKeepDeserialized(Boolean keepDeserialized) { - this.keepDeserialized = keepDeserialized; - } - /** {@inheritDoc} */ @Override public String toString() { return S.toString(BinaryTypeConfiguration.class, this, super.toString()); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java new file mode 100644 index 0000000..73f7dfa --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java @@ -0,0 +1,105 @@ +/* + * 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.configuration; + +import java.util.ArrayList; +import java.util.Collection; +import org.apache.ignite.binary.BinaryIdMapper; +import org.apache.ignite.binary.BinarySerializer; +import org.apache.ignite.binary.BinaryTypeConfiguration; + +/** + * + */ +public class BinaryConfiguration { + /** ID mapper. */ + private BinaryIdMapper idMapper; + + /** Serializer. */ + private BinarySerializer serializer; + + /** Types. */ + private Collection<BinaryTypeConfiguration> typeCfgs; + + /** + * Sets class names of portable objects explicitly. + * + * @param clsNames Class names. + */ + public void setClassNames(Collection<String> clsNames) { + if (typeCfgs == null) + typeCfgs = new ArrayList<>(clsNames.size()); + + for (String clsName : clsNames) + typeCfgs.add(new BinaryTypeConfiguration(clsName)); + } + + /** + * Gets ID mapper. + * + * @return ID mapper. + */ + public BinaryIdMapper getIdMapper() { + return idMapper; + } + + /** + * Sets ID mapper. + * + * @param idMapper ID mapper. + */ + public void setIdMapper(BinaryIdMapper idMapper) { + this.idMapper = idMapper; + } + + /** + * Gets serializer. + * + * @return Serializer. + */ + public BinarySerializer getSerializer() { + return serializer; + } + + /** + * Sets serializer. + * + * @param serializer Serializer. + */ + public void setSerializer(BinarySerializer serializer) { + this.serializer = serializer; + } + + /** + * Gets types configuration. + * + * @return Types configuration. + */ + public Collection<BinaryTypeConfiguration> getTypeConfigurations() { + return typeCfgs; + } + + /** + * Sets type configurations. + * + * @param typeCfgs Type configurations. + */ + public void setTypeConfigurations(Collection<BinaryTypeConfiguration> typeCfgs) { + this.typeCfgs = typeCfgs; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java index 2069a90..ee9f92a 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java @@ -437,6 +437,9 @@ public class IgniteConfiguration { /** Cache key configuration. */ private CacheKeyConfiguration[] cacheKeyCfg; + /** */ + private BinaryConfiguration binaryCfg; + /** * Creates valid grid configuration with all default values. */ @@ -471,6 +474,7 @@ public class IgniteConfiguration { addrRslvr = cfg.getAddressResolver(); allResolversPassReq = cfg.isAllSegmentationResolversPassRequired(); atomicCfg = cfg.getAtomicConfiguration(); + binaryCfg = cfg.getBinaryConfiguration(); daemon = cfg.isDaemon(); cacheCfg = cfg.getCacheConfiguration(); cacheKeyCfg = cfg.getCacheKeyConfiguration(); @@ -1360,11 +1364,12 @@ public class IgniteConfiguration { * * Default is {@code 1} which has minimal impact on the operation of the grid. * - * @param size Size. + * @param rebalanceThreadPoolSize Number of system threads that will be assigned for partition transfer during + * rebalancing. * @return {@code this} for chaining. */ - public IgniteConfiguration setRebalanceThreadPoolSize(int size) { - this.rebalanceThreadPoolSize = size; + public IgniteConfiguration setRebalanceThreadPoolSize(int rebalanceThreadPoolSize) { + this.rebalanceThreadPoolSize = rebalanceThreadPoolSize; return this; } @@ -2004,6 +2009,24 @@ public class IgniteConfiguration { } /** + * Gets configuration for Ignite Binary objects. + * + * @return Binary configuration object. + */ + public BinaryConfiguration getBinaryConfiguration() { + return binaryCfg; + } + + /** + * Sets configuration for Ignite Binary objects. + * + * @param binaryCfg Binary configuration object. + */ + public void setBinaryConfiguration(BinaryConfiguration binaryCfg) { + this.binaryCfg = binaryCfg; + } + + /** * Gets flag indicating whether cache sanity check is enabled. If enabled, then Ignite * will perform the following checks and throw an exception if check fails: * <ul> http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java index c25da03..a683606 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextAdapter.java @@ -142,6 +142,10 @@ public abstract class MarshallerContextAdapter implements MarshallerContext { ", oldClsName=" + oldClsName + ']'); } + if (clsName.contains("PortableMetadataKey")) { + U.debug("Adding type=" + clsName + ", set=" + System.identityHashCode(registeredSystemTypes) + ", url=" + url + ']'); + } + registeredSystemTypes.add(clsName); } } @@ -187,6 +191,10 @@ public abstract class MarshallerContextAdapter implements MarshallerContext { /** {@inheritDoc} */ @Override public boolean isSystemType(String typeName) { + if (typeName.contains("PortableMetaDataKey")) { + U.debug("Checking type=" + typeName + ", set=" + System.identityHashCode(registeredSystemTypes) + ']'); + } + return registeredSystemTypes.contains(typeName); } http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java index d432ea0..4356b90 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java @@ -67,8 +67,7 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.UUID; * Portable object implementation. */ @IgniteCodeGeneratingFail // Fields arr and start should not be generated by MessageCodeGenerator. -public final class BinaryObjectImpl extends BinaryObjectEx implements Externalizable, - Message, CacheObject, KeyCacheObject { +public final class BinaryObjectImpl extends BinaryObjectEx implements Externalizable, KeyCacheObject { /** */ public static final byte TYPE_BINARY = 100; @@ -135,7 +134,7 @@ public final class BinaryObjectImpl extends BinaryObjectEx implements Externaliz Object obj0 = obj; if (obj0 == null || cpy) - obj0 = deserializeValue(); + obj0 = deserializeValue(ctx); return (T)obj0; } @@ -433,7 +432,7 @@ public final class BinaryObjectImpl extends BinaryObjectEx implements Externaliz Object obj0 = obj; if (obj0 == null) - obj0 = deserializeValue(); + obj0 = deserializeValue(null); return (T)obj0; @@ -565,7 +564,7 @@ public final class BinaryObjectImpl extends BinaryObjectEx implements Externaliz * Runs value deserialization regardless of whether obj already has the deserialized value. * Will set obj if descriptor is configured to keep deserialized values. */ - private Object deserializeValue() { + private Object deserializeValue(@Nullable CacheObjectContext coCtx) { // TODO: IGNITE-1272 - Deserialize with proper class loader. BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx, arr, start, null); @@ -575,7 +574,7 @@ public final class BinaryObjectImpl extends BinaryObjectEx implements Externaliz assert desc != null; - if (desc.keepDeserialized()) + if (coCtx != null && coCtx.storeValue()) obj = obj0; return obj0; http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java index 225e0ba..e37275d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java @@ -22,7 +22,6 @@ import org.apache.ignite.internal.processors.cache.CacheObjectImpl; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.MarshallerExclusions; import org.apache.ignite.marshaller.optimized.OptimizedMarshaller; -import org.apache.ignite.marshaller.portable.PortableMarshaller; import org.jetbrains.annotations.Nullable; import java.io.Externalizable; @@ -95,9 +94,6 @@ public class PortableClassDescriptor { private final Map<String, Integer> fieldsMeta; /** */ - private final boolean keepDeserialized; - - /** */ private final boolean registered; /** */ @@ -115,7 +111,6 @@ public class PortableClassDescriptor { * @param idMapper ID mapper. * @param serializer Serializer. * @param metaDataEnabled Metadata enabled flag. - * @param keepDeserialized Keep deserialized flag. * @param registered Whether typeId has been successfully registered by MarshallerContext or not. * @param predefined Whether the class is predefined or not. * @throws org.apache.ignite.binary.BinaryObjectException In case of error. @@ -129,7 +124,6 @@ public class PortableClassDescriptor { @Nullable BinaryIdMapper idMapper, @Nullable BinarySerializer serializer, boolean metaDataEnabled, - boolean keepDeserialized, boolean registered, boolean predefined ) throws BinaryObjectException { @@ -143,7 +137,6 @@ public class PortableClassDescriptor { this.typeName = typeName; this.serializer = serializer; this.idMapper = idMapper; - this.keepDeserialized = keepDeserialized; this.registered = registered; excluded = MarshallerExclusions.isExcluded(cls); @@ -288,13 +281,6 @@ public class PortableClassDescriptor { } /** - * @return Keep deserialized flag. - */ - boolean keepDeserialized() { - return keepDeserialized; - } - - /** * @return Whether typeId has been successfully registered by MarshallerContext or not. */ public boolean registered() { @@ -302,7 +288,7 @@ public class PortableClassDescriptor { } /** - * @return {@code true} if {@link OptimizedMarshaller} must be used instead of {@link PortableMarshaller} + * @return {@code true} if {@link OptimizedMarshaller} must be used instead of {@link org.apache.ignite.marshaller.portable.BinaryMarshaller} * for object serialization and deserialization. */ public boolean useOptimizedMarshaller() { http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java index 86578ad..4dec314 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java @@ -51,6 +51,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cache.CacheKeyConfiguration; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.binary.BinaryTypeConfiguration; import org.apache.ignite.binary.BinaryObjectException; @@ -70,7 +71,7 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.marshaller.MarshallerContext; import org.apache.ignite.marshaller.optimized.OptimizedMarshaller; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.jetbrains.annotations.Nullable; import org.jsr166.ConcurrentHashMap8; @@ -148,9 +149,6 @@ public class PortableContext implements Externalizable { /** */ private final OptimizedMarshaller optmMarsh = new OptimizedMarshaller(); - /** */ - private boolean keepDeserialized; - /** Object schemas. */ private volatile Map<Integer, PortableSchemaRegistry> schemas; @@ -243,59 +241,41 @@ public class PortableContext implements Externalizable { * @param marsh Portable marshaller. * @throws org.apache.ignite.binary.BinaryObjectException In case of error. */ - public void configure(PortableMarshaller marsh) throws BinaryObjectException { + public void configure(BinaryMarshaller marsh, IgniteConfiguration cfg) throws BinaryObjectException { if (marsh == null) return; - keepDeserialized = marsh.isKeepDeserialized(); - marshCtx = marsh.getContext(); + BinaryConfiguration binaryCfg = cfg.getBinaryConfiguration(); + + if (binaryCfg == null) + binaryCfg = new BinaryConfiguration(); + assert marshCtx != null; optmMarsh.setContext(marshCtx); configure( - marsh.getIdMapper(), - marsh.getSerializer(), - marsh.isKeepDeserialized(), - marsh.getClassNames(), - marsh.getTypeConfigurations() + binaryCfg.getIdMapper(), + binaryCfg.getSerializer(), + binaryCfg.getTypeConfigurations() ); } /** * @param globalIdMapper ID mapper. * @param globalSerializer Serializer. - * @param globalKeepDeserialized Keep deserialized flag. - * @param clsNames Class names. * @param typeCfgs Type configurations. * @throws org.apache.ignite.binary.BinaryObjectException In case of error. */ private void configure( BinaryIdMapper globalIdMapper, BinarySerializer globalSerializer, - boolean globalKeepDeserialized, - Collection<String> clsNames, Collection<BinaryTypeConfiguration> typeCfgs ) throws BinaryObjectException { TypeDescriptors descs = new TypeDescriptors(); - if (clsNames != null) { - BinaryIdMapper idMapper = new IdMapperWrapper(globalIdMapper); - - for (String clsName : clsNames) { - if (clsName.endsWith(".*")) { // Package wildcard - String pkgName = clsName.substring(0, clsName.length() - 2); - - for (String clsName0 : classesInPackage(pkgName)) - descs.add(clsName0, idMapper, null, null, globalKeepDeserialized, true); - } - else // Regular single class - descs.add(clsName, idMapper, null, null, globalKeepDeserialized, true); - } - } - Map<String, String> affFields = new HashMap<>(); if (!F.isEmpty(igniteCfg.getCacheKeyConfiguration())) { @@ -305,7 +285,7 @@ public class PortableContext implements Externalizable { if (typeCfgs != null) { for (BinaryTypeConfiguration typeCfg : typeCfgs) { - String clsName = typeCfg.getClassName(); + String clsName = typeCfg.getTypeName(); if (clsName == null) throw new BinaryObjectException("Class name is required for portable type configuration."); @@ -322,25 +302,21 @@ public class PortableContext implements Externalizable { if (typeCfg.getSerializer() != null) serializer = typeCfg.getSerializer(); - boolean keepDeserialized = typeCfg.isKeepDeserialized() != null ? typeCfg.isKeepDeserialized() : - globalKeepDeserialized; - if (clsName.endsWith(".*")) { String pkgName = clsName.substring(0, clsName.length() - 2); for (String clsName0 : classesInPackage(pkgName)) descs.add(clsName0, idMapper, serializer, affFields.get(clsName0), - keepDeserialized, true); + true); } else descs.add(clsName, idMapper, serializer, affFields.get(clsName), - keepDeserialized, false); + false); } } for (TypeDescriptor desc : descs.descriptors()) { - registerUserType(desc.clsName, desc.idMapper, desc.serializer, desc.affKeyFieldName, - desc.keepDeserialized); + registerUserType(desc.clsName, desc.idMapper, desc.serializer, desc.affKeyFieldName); } } @@ -507,7 +483,6 @@ public class PortableContext implements Externalizable { BASIC_CLS_ID_MAPPER, null, false, - keepDeserialized, true, /* registered */ false /* predefined */ ); @@ -553,7 +528,6 @@ public class PortableContext implements Externalizable { idMapper, null, true, - keepDeserialized, registered, false /* predefined */ ); @@ -697,7 +671,6 @@ public class PortableContext implements Externalizable { DFLT_ID_MAPPER, null, false, - false, true, /* registered */ true /* predefined */ ); @@ -715,15 +688,13 @@ public class PortableContext implements Externalizable { * @param idMapper ID mapper. * @param serializer Serializer. * @param affKeyFieldName Affinity key field name. - * @param keepDeserialized Keep deserialized flag. * @throws org.apache.ignite.binary.BinaryObjectException In case of error. */ @SuppressWarnings("ErrorNotRethrown") public void registerUserType(String clsName, BinaryIdMapper idMapper, @Nullable BinarySerializer serializer, - @Nullable String affKeyFieldName, - boolean keepDeserialized) + @Nullable String affKeyFieldName) throws BinaryObjectException { assert idMapper != null; @@ -761,7 +732,6 @@ public class PortableContext implements Externalizable { idMapper, serializer, true, - keepDeserialized, true, /* registered */ false /* predefined */ ); @@ -1021,7 +991,7 @@ public class PortableContext implements Externalizable { */ private static class TypeDescriptors { /** Descriptors map. */ - private final Map<String, TypeDescriptor> descs = new HashMap<>(); + private final Map<String, TypeDescriptor> descs = new LinkedHashMap<>(); /** * Add type descriptor. @@ -1030,7 +1000,6 @@ public class PortableContext implements Externalizable { * @param idMapper ID mapper. * @param serializer Serializer. * @param affKeyFieldName Affinity key field name. - * @param keepDeserialized Keep deserialized flag. * @param canOverride Whether this descriptor can be override. * @throws org.apache.ignite.binary.BinaryObjectException If failed. */ @@ -1038,14 +1007,12 @@ public class PortableContext implements Externalizable { BinaryIdMapper idMapper, BinarySerializer serializer, String affKeyFieldName, - boolean keepDeserialized, boolean canOverride) throws BinaryObjectException { TypeDescriptor desc = new TypeDescriptor(clsName, idMapper, serializer, affKeyFieldName, - keepDeserialized, canOverride); TypeDescriptor oldDesc = descs.get(clsName); @@ -1082,9 +1049,6 @@ public class PortableContext implements Externalizable { /** Affinity key field name. */ private String affKeyFieldName; - /** Keep deserialized flag. */ - private boolean keepDeserialized; - /** Whether this descriptor can be override. */ private boolean canOverride; @@ -1095,16 +1059,14 @@ public class PortableContext implements Externalizable { * @param idMapper ID mapper. * @param serializer Serializer. * @param affKeyFieldName Affinity key field name. - * @param keepDeserialized Keep deserialized flag. * @param canOverride Whether this descriptor can be override. */ private TypeDescriptor(String clsName, BinaryIdMapper idMapper, BinarySerializer serializer, - String affKeyFieldName, boolean keepDeserialized, boolean canOverride) { + String affKeyFieldName, boolean canOverride) { this.clsName = clsName; this.idMapper = idMapper; this.serializer = serializer; this.affKeyFieldName = affKeyFieldName; - this.keepDeserialized = keepDeserialized; this.canOverride = canOverride; } @@ -1121,7 +1083,6 @@ public class PortableContext implements Externalizable { idMapper = other.idMapper; serializer = other.serializer; affKeyFieldName = other.affKeyFieldName; - keepDeserialized = other.keepDeserialized; canOverride = other.canOverride; } else if (!other.canOverride) http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java index 4fe8d84..4439eee 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java @@ -112,7 +112,7 @@ import org.apache.ignite.lang.IgniteUuid; import org.apache.ignite.lifecycle.LifecycleAware; import org.apache.ignite.marshaller.Marshaller; import org.apache.ignite.marshaller.jdk.JdkMarshaller; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.spi.IgniteNodeValidationResult; import org.jetbrains.annotations.Nullable; @@ -1019,7 +1019,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { // Intentionally compare Boolean references using '!=' below to check if the flag has been explicitly set. if (cfg.isKeepBinaryInStore() && cfg.isKeepBinaryInStore() != CacheConfiguration.DFLT_KEEP_BINARY_IN_STORE - && !(ctx.config().getMarshaller() instanceof PortableMarshaller)) + && !(ctx.config().getMarshaller() instanceof BinaryMarshaller)) U.warn(log, "CacheConfiguration.isKeepBinaryInStore() configuration property will be ignored because " + "PortableMarshaller is not used"); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/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 117eece..58baab9 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 @@ -69,7 +69,7 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgniteClosure; import org.apache.ignite.marshaller.Marshaller; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.jetbrains.annotations.Nullable; import org.jsr166.ConcurrentHashMap8; import sun.misc.Unsafe; @@ -158,7 +158,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm /** {@inheritDoc} */ @Override public void start() throws IgniteCheckedException { - if (marsh instanceof PortableMarshaller) { + if (marsh instanceof BinaryMarshaller) { BinaryMetadataHandler metaHnd = new BinaryMetadataHandler() { @Override public void addMeta(int typeId, BinaryType newMeta) throws BinaryObjectException { assert newMeta != null; @@ -203,11 +203,12 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm } }; - PortableMarshaller pMarh0 = (PortableMarshaller)marsh; + BinaryMarshaller pMarh0 = (BinaryMarshaller)marsh; portableCtx = new PortableContext(metaHnd, ctx.config()); - IgniteUtils.invoke(PortableMarshaller.class, pMarh0, "setPortableContext", portableCtx); + IgniteUtils.invoke(BinaryMarshaller.class, pMarh0, "setPortableContext", portableCtx, + ctx.config()); portableMarsh = new GridPortableMarshaller(portableCtx); @@ -549,7 +550,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm /** {@inheritDoc} */ @Override public boolean isPortableEnabled(CacheConfiguration<?, ?> ccfg) { - return marsh instanceof PortableMarshaller; + return marsh instanceof BinaryMarshaller; } /** @@ -606,7 +607,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm @Override public CacheObjectContext contextForCache(CacheConfiguration cfg) throws IgniteCheckedException { assert cfg != null; - boolean portableEnabled = marsh instanceof PortableMarshaller && !GridCacheUtils.isSystemCache(cfg.getName()) && + boolean portableEnabled = marsh instanceof BinaryMarshaller && !GridCacheUtils.isSystemCache(cfg.getName()) && !GridCacheUtils.isIgfsCache(ctx.config(), cfg.getName()); CacheObjectContext ctx0 = super.contextForCache(cfg); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java index b84908d..29d5155 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java @@ -23,7 +23,7 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.processors.platform.PlatformProcessor; import org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; /** * Default store manager implementation. @@ -82,6 +82,6 @@ public class CacheOsStoreManager extends GridCacheStoreManagerAdapter { /** {@inheritDoc} */ @Override public boolean configuredConvertPortable() { - return !(ctx.config().getMarshaller() instanceof PortableMarshaller && cfg.isKeepBinaryInStore()); + return !(ctx.config().getMarshaller() instanceof BinaryMarshaller && cfg.isKeepBinaryInStore()); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java index 9f17bdd..12c9d36 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java @@ -25,7 +25,7 @@ import org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurat import org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.Marshaller; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.platform.cpp.PlatformCppConfiguration; import java.util.Collections; @@ -71,13 +71,13 @@ public class PlatformCppConfigurationClosure extends PlatformAbstractConfigurati Marshaller marsh = igniteCfg.getMarshaller(); if (marsh == null) { - igniteCfg.setMarshaller(new PortableMarshaller()); + igniteCfg.setMarshaller(new BinaryMarshaller()); cppCfg0.warnings(Collections.singleton("Marshaller is automatically set to " + - PortableMarshaller.class.getName() + " (other nodes must have the same marshaller type).")); + BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type).")); } - else if (!(marsh instanceof PortableMarshaller)) - throw new IgniteException("Unsupported marshaller (only " + PortableMarshaller.class.getName() + + else if (!(marsh instanceof BinaryMarshaller)) + throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName() + " can be used when running Apache Ignite C++): " + marsh.getClass().getName()); // Set Ignite home so that marshaller context works. http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java index d0462e9..f68c08e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java @@ -36,8 +36,8 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformUtils; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lifecycle.LifecycleBean; import org.apache.ignite.marshaller.Marshaller; -import org.apache.ignite.marshaller.portable.PortableMarshaller; import org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.platform.dotnet.PlatformDotNetLifecycleBean; import java.util.ArrayList; @@ -92,13 +92,13 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur Marshaller marsh = igniteCfg.getMarshaller(); if (marsh == null) { - igniteCfg.setMarshaller(new PortableMarshaller()); + igniteCfg.setMarshaller(new BinaryMarshaller()); dotNetCfg0.warnings(Collections.singleton("Marshaller is automatically set to " + - PortableMarshaller.class.getName() + " (other nodes must have the same marshaller type).")); + BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type).")); } - else if (!(marsh instanceof PortableMarshaller)) - throw new IgniteException("Unsupported marshaller (only " + PortableMarshaller.class.getName() + + else if (!(marsh instanceof BinaryMarshaller)) + throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName() + " can be used when running Apache Ignite.NET): " + marsh.getClass().getName()); // Set Ignite home so that marshaller context works. @@ -228,11 +228,11 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur try { PortableContext ctx = new PortableContext(BinaryNoopMetadataHandler.instance(), new IgniteConfiguration()); - PortableMarshaller marsh = new PortableMarshaller(); + BinaryMarshaller marsh = new BinaryMarshaller(); marsh.setContext(new MarshallerContextImpl(null)); - ctx.configure(marsh); + ctx.configure(marsh, new IgniteConfiguration()); return new GridPortableMarshaller(ctx); } http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/marshaller/portable/BinaryMarshaller.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/BinaryMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/BinaryMarshaller.java new file mode 100644 index 0000000..455c83e --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/BinaryMarshaller.java @@ -0,0 +1,146 @@ +/* + * 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.marshaller.portable; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.portable.GridPortableMarshaller; +import org.apache.ignite.internal.portable.PortableContext; +import org.apache.ignite.marshaller.AbstractMarshaller; +import org.apache.ignite.marshaller.MarshallerContext; +import org.jetbrains.annotations.Nullable; + +/** + * Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects + * in the portable format. + * <p> + * {@code PortableMarshaller} is tested only on Java HotSpot VM on other VMs it could yield unexpected results. + * <p> + * <h1 class="header">Configuration</h1> + * <h2 class="header">Mandatory</h2> + * This marshaller has no mandatory configuration parameters. + * <h2 class="header">Java Example</h2> + * <pre name="code" class="java"> + * PortableMarshaller marshaller = new PortableMarshaller(); + * + * IgniteConfiguration cfg = new IgniteConfiguration(); + * + * // Override marshaller. + * cfg.setMarshaller(marshaller); + * + * // Starts grid. + * G.start(cfg); + * </pre> + * <h2 class="header">Spring Example</h2> + * PortableMarshaller can be configured from Spring XML configuration file: + * <pre name="code" class="xml"> + * <bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"> + * ... + * <property name="marshaller"> + * <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller"> + * ... + * </bean> + * </property> + * ... + * </bean> + * </pre> + * <p> + * <img src="http://ignite.apache.org/images/spring-small.png"> + * <br> + * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a> + */ +public class BinaryMarshaller extends AbstractMarshaller { + /** */ + private GridPortableMarshaller impl; + + /** + * Returns currently set {@link MarshallerContext}. + * + * @return Marshaller context. + */ + public MarshallerContext getContext() { + return ctx; + } + + /** + * Sets {@link PortableContext}. + * <p/> + * @param ctx Portable context. + */ + @SuppressWarnings("UnusedDeclaration") + private void setPortableContext(PortableContext ctx, IgniteConfiguration cfg) { + ctx.configure(this, cfg); + + impl = new GridPortableMarshaller(ctx); + } + + /** {@inheritDoc} */ + @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException { + return impl.marshal(obj); + } + + /** {@inheritDoc} */ + @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException { + byte[] arr = marshal(obj); + + try { + out.write(arr); + } + catch (IOException e) { + throw new BinaryObjectException("Failed to marshal the object: " + obj, e); + } + } + + /** {@inheritDoc} */ + @Override public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException { + return impl.deserialize(bytes, clsLdr); + } + + /** {@inheritDoc} */ + @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException { + ByteArrayOutputStream buf = new ByteArrayOutputStream(); + + // we have to fully read the InputStream because GridPortableMarshaller requires support of a method that + // returns number of bytes remaining. + try { + byte[] arr = new byte[4096]; + + int cnt; + + while ((cnt = in.read(arr)) != -1) + buf.write(arr, 0, cnt); + + buf.flush(); + + return impl.deserialize(buf.toByteArray(), clsLdr); + } + catch (IOException e) { + throw new BinaryObjectException("Failed to unmarshal the object from InputStream", e); + } + } + + /** {@inheritDoc} */ + @Override public void onUndeploy(ClassLoader ldr) { + impl.context().onUndeploy(ldr); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java deleted file mode 100644 index 409a893..0000000 --- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java +++ /dev/null @@ -1,263 +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.marshaller.portable; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collection; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.portable.GridPortableMarshaller; -import org.apache.ignite.internal.portable.PortableContext; -import org.apache.ignite.marshaller.AbstractMarshaller; -import org.apache.ignite.marshaller.MarshallerContext; -import org.apache.ignite.binary.BinaryTypeConfiguration; -import org.apache.ignite.binary.BinaryObjectException; -import org.apache.ignite.binary.BinaryIdMapper; -import org.apache.ignite.binary.BinarySerializer; -import org.jetbrains.annotations.Nullable; - -/** - * Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects - * in the portable format. - * <p> - * {@code PortableMarshaller} is tested only on Java HotSpot VM on other VMs it could yield unexpected results. - * <p> - * <h1 class="header">Configuration</h1> - * <h2 class="header">Mandatory</h2> - * This marshaller has no mandatory configuration parameters. - * <h2 class="header">Java Example</h2> - * <pre name="code" class="java"> - * PortableMarshaller marshaller = new PortableMarshaller(); - * - * IgniteConfiguration cfg = new IgniteConfiguration(); - * - * // Override marshaller. - * cfg.setMarshaller(marshaller); - * - * // Starts grid. - * G.start(cfg); - * </pre> - * <h2 class="header">Spring Example</h2> - * PortableMarshaller can be configured from Spring XML configuration file: - * <pre name="code" class="xml"> - * <bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"> - * ... - * <property name="marshaller"> - * <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller"> - * ... - * </bean> - * </property> - * ... - * </bean> - * </pre> - * <p> - * <img src="http://ignite.apache.org/images/spring-small.png"> - * <br> - * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a> - */ -public class PortableMarshaller extends AbstractMarshaller { - // TODO ignite-1282 Move to IgniteConfiguration. - /** Class names. */ - private Collection<String> clsNames; - - /** ID mapper. */ - private BinaryIdMapper idMapper; - - /** Serializer. */ - private BinarySerializer serializer; - - /** Types. */ - private Collection<BinaryTypeConfiguration> typeCfgs; - - /** Keep deserialized flag. */ - private boolean keepDeserialized = true; - - /** */ - private GridPortableMarshaller impl; - - /** - * Gets class names. - * - * @return Class names. - */ - public Collection<String> getClassNames() { - return clsNames; - } - - /** - * Sets class names of portable objects explicitly. - * - * @param clsNames Class names. - */ - public void setClassNames(Collection<String> clsNames) { - this.clsNames = new ArrayList<>(clsNames.size()); - - for (String clsName : clsNames) - this.clsNames.add(clsName.trim()); - } - - /** - * Gets ID mapper. - * - * @return ID mapper. - */ - public BinaryIdMapper getIdMapper() { - return idMapper; - } - - /** - * Sets ID mapper. - * - * @param idMapper ID mapper. - */ - public void setIdMapper(BinaryIdMapper idMapper) { - this.idMapper = idMapper; - } - - /** - * Gets serializer. - * - * @return Serializer. - */ - public BinarySerializer getSerializer() { - return serializer; - } - - /** - * Sets serializer. - * - * @param serializer Serializer. - */ - public void setSerializer(BinarySerializer serializer) { - this.serializer = serializer; - } - - /** - * Gets types configuration. - * - * @return Types configuration. - */ - public Collection<BinaryTypeConfiguration> getTypeConfigurations() { - return typeCfgs; - } - - /** - * Sets type configurations. - * - * @param typeCfgs Type configurations. - */ - public void setTypeConfigurations(Collection<BinaryTypeConfiguration> typeCfgs) { - this.typeCfgs = typeCfgs; - } - - /** - * If {@code true}, {@link org.apache.ignite.binary.BinaryObject} will cache deserialized instance after - * {@link org.apache.ignite.binary.BinaryObject#deserialize()} is called. All consequent calls of this - * method on the same instance of {@link org.apache.ignite.binary.BinaryObject} will return that cached - * value without actually deserializing portable object. If you need to override this - * behaviour for some specific type, use {@link org.apache.ignite.binary.BinaryTypeConfiguration#setKeepDeserialized(Boolean)} - * method. - * <p> - * Default value if {@code true}. - * - * @return Whether deserialized value is kept. - */ - public boolean isKeepDeserialized() { - return keepDeserialized; - } - - /** - * @param keepDeserialized Whether deserialized value is kept. - */ - public void setKeepDeserialized(boolean keepDeserialized) { - this.keepDeserialized = keepDeserialized; - } - - /** - * Returns currently set {@link MarshallerContext}. - * - * @return Marshaller context. - */ - public MarshallerContext getContext() { - return ctx; - } - - /** - * Sets {@link PortableContext}. - * <p/> - * @param ctx Portable context. - */ - @SuppressWarnings("UnusedDeclaration") - private void setPortableContext(PortableContext ctx) { - ctx.configure(this); - - impl = new GridPortableMarshaller(ctx); - } - - /** {@inheritDoc} */ - @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException { - return impl.marshal(obj); - } - - /** {@inheritDoc} */ - @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException { - byte[] arr = marshal(obj); - - try { - out.write(arr); - } - catch (IOException e) { - throw new BinaryObjectException("Failed to marshal the object: " + obj, e); - } - } - - /** {@inheritDoc} */ - @Override public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException { - return impl.deserialize(bytes, clsLdr); - } - - /** {@inheritDoc} */ - @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException { - ByteArrayOutputStream buf = new ByteArrayOutputStream(); - - byte[] arr = new byte[4096]; - int cnt; - - // we have to fully read the InputStream because GridPortableMarshaller requires support of a method that - // returns number of bytes remaining. - try { - while ((cnt = in.read(arr)) != -1) - buf.write(arr, 0, cnt); - - buf.flush(); - - return impl.deserialize(buf.toByteArray(), clsLdr); - } - catch (IOException e) { - throw new BinaryObjectException("Failed to unmarshal the object from InputStream", e); - } - } - - /** {@inheritDoc} */ - @Override public void onUndeploy(ClassLoader ldr) { - impl.context().onUndeploy(ldr); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/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 4b2c8ee..197090e 100644 --- a/modules/core/src/main/resources/META-INF/classnames.properties +++ b/modules/core/src/main/resources/META-INF/classnames.properties @@ -292,7 +292,7 @@ org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage org.apache.ignite.internal.managers.indexing.GridIndexingManager$1 org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerAdapter org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager$1 -org.apache.ignite.internal.portable.BinaryMetaDataImpl +org.apache.ignite.internal.portable.BinaryMetadata org.apache.ignite.internal.portable.BinaryObjectEx org.apache.ignite.internal.portable.BinaryObjectImpl org.apache.ignite.internal.portable.BinaryObjectOffheapImpl @@ -434,6 +434,7 @@ org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$3 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$4 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$5 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$6 +org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$7 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeFutureSet org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$MessageHandler org.apache.ignite.internal.processors.cache.GridCacheProcessor$2 @@ -542,7 +543,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetFuture$1 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetFuture$2 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetFuture$3 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition$4 +org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition$3 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$1 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$2 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$3 @@ -577,7 +578,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFutu org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$3 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$4 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$5 -org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$6 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxRemote @@ -636,16 +636,18 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtFor org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandPool$1 -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandPool$2$1 -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandPool$DemandWorker$1 -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandPool$DemandWorker$2 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$2 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$4$1 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$1 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$DemandWorker$2 org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplier$1 +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplier$SupplyContextPhase org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessage -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyPool$1 -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyPool$DemandMessage +org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessageV2 org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsAbstractMessage org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture$1 org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture$2 @@ -654,7 +656,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPar org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleRequest -org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$10 org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$2 org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$3 org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$4 @@ -739,10 +740,11 @@ org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$9 org.apache.ignite.internal.processors.cache.portable.CacheDefaultPortableAffinityKeyMapper org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$1 org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$4 +org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$5 org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$MetaDataEntryFilter org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$MetaDataPredicate org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl$MetaDataProcessor -org.apache.ignite.internal.processors.cache.portable.PortableMetaDataKey +org.apache.ignite.internal.processors.cache.portable.PortableMetadataKey org.apache.ignite.internal.processors.cache.query.CacheQueryType org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryFuture$1 org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryFuture$3 @@ -1158,7 +1160,8 @@ org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandle org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$GetAndRemoveCommand org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$GetAndReplaceCommand org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$GetCommand -org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetadataCommand +org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetadataJob +org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetadataTask org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$MetricsCommand org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$PrependCommand org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler$PutAllCommand @@ -1174,6 +1177,7 @@ org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheRestResponse org.apache.ignite.internal.processors.rest.handlers.datastructures.DataStructuresCommandHandler$1 org.apache.ignite.internal.processors.rest.handlers.query.CacheQueryFieldsMetaResult org.apache.ignite.internal.processors.rest.handlers.query.CacheQueryResult +org.apache.ignite.internal.processors.rest.handlers.query.QueryCommandHandler$QueryCursorIterator org.apache.ignite.internal.processors.rest.handlers.task.GridTaskCommandHandler$2 org.apache.ignite.internal.processors.rest.handlers.task.GridTaskCommandHandler$ExeCallable org.apache.ignite.internal.processors.rest.handlers.task.GridTaskResultRequest http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java index 14fc6f3..21fab62 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java @@ -20,11 +20,12 @@ package org.apache.ignite.internal.portable; import org.apache.ignite.binary.BinaryField; import org.apache.ignite.binary.BinaryObject; import org.apache.ignite.binary.BinaryTypeConfiguration; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.IgniteUtils; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.MarshallerContextTestImpl; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import java.math.BigDecimal; @@ -38,7 +39,7 @@ import java.util.UUID; */ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTest { /** Marshaller. */ - protected PortableMarshaller dfltMarsh; + protected BinaryMarshaller dfltMarsh; /** * Create marshaller. @@ -46,20 +47,26 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes * @return Portable marshaller. * @throws Exception If failed. */ - protected static PortableMarshaller createMarshaller() throws Exception { + protected static BinaryMarshaller createMarshaller() throws Exception { PortableContext ctx = new PortableContext(new TestCachingMetadataHandler(), new IgniteConfiguration()); - PortableMarshaller marsh = new PortableMarshaller(); + BinaryMarshaller marsh = new BinaryMarshaller(); - marsh.setTypeConfigurations(Arrays.asList( + BinaryConfiguration bCfg = new BinaryConfiguration(); + + bCfg.setTypeConfigurations(Arrays.asList( new BinaryTypeConfiguration(TestObject.class.getName()), new BinaryTypeConfiguration(TestOuterObject.class.getName()), new BinaryTypeConfiguration(TestInnerObject.class.getName()) )); + IgniteConfiguration iCfg = new IgniteConfiguration(); + + iCfg.setBinaryConfiguration(bCfg); + marsh.setContext(new MarshallerContextTestImpl(null)); - IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", ctx); + IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, iCfg); return marsh; } @@ -70,7 +77,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes * @param marsh Marshaller. * @return Portable context. */ - protected static PortableContext portableContext(PortableMarshaller marsh) { + protected static PortableContext portableContext(BinaryMarshaller marsh) { GridPortableMarshaller impl = U.field(marsh, "impl"); return impl.context(); @@ -375,7 +382,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes * @param exists Whether field should exist. * @throws Exception If failed. */ - private void checkNormal(PortableMarshaller marsh, String fieldName, boolean exists) throws Exception { + private void checkNormal(BinaryMarshaller marsh, String fieldName, boolean exists) throws Exception { TestContext testCtx = context(marsh, fieldName); check0(fieldName, testCtx, exists); @@ -389,7 +396,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes * @param exists Whether field should exist. * @throws Exception If failed. */ - private void checkNested(PortableMarshaller marsh, String fieldName, boolean exists) throws Exception { + private void checkNested(BinaryMarshaller marsh, String fieldName, boolean exists) throws Exception { TestContext testCtx = nestedContext(marsh, fieldName); check0(fieldName, testCtx, exists); @@ -468,7 +475,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes * @return Test context. * @throws Exception If failed. */ - private TestContext context(PortableMarshaller marsh, String fieldName) throws Exception { + private TestContext context(BinaryMarshaller marsh, String fieldName) throws Exception { TestObject obj = createObject(); BinaryObjectEx portObj = toPortable(marsh, obj); @@ -486,7 +493,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes * @return Test context. * @throws Exception If failed. */ - private TestContext nestedContext(PortableMarshaller marsh, String fieldName) + private TestContext nestedContext(BinaryMarshaller marsh, String fieldName) throws Exception { TestObject obj = createObject(); TestOuterObject outObj = new TestOuterObject(obj); @@ -518,7 +525,7 @@ public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTes * @return Portable object. * @throws Exception If failed. */ - protected abstract BinaryObjectEx toPortable(PortableMarshaller marsh, Object obj) throws Exception; + protected abstract BinaryObjectEx toPortable(BinaryMarshaller marsh, Object obj) throws Exception; /** * Outer test object. http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsHeapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsHeapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsHeapSelfTest.java index 0140c53..53ba212 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsHeapSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsHeapSelfTest.java @@ -17,14 +17,14 @@ package org.apache.ignite.internal.portable; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; /** * Field tests for heap-based portables. */ public class BinaryFieldsHeapSelfTest extends BinaryFieldsAbstractSelfTest { /** {@inheritDoc} */ - @Override protected BinaryObjectEx toPortable(PortableMarshaller marsh, Object obj) throws Exception { + @Override protected BinaryObjectEx toPortable(BinaryMarshaller marsh, Object obj) throws Exception { byte[] bytes = marsh.marshal(obj); return new BinaryObjectImpl(portableContext(marsh), bytes, 0); http://git-wip-us.apache.org/repos/asf/ignite/blob/3a32b5ff/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsOffheapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsOffheapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsOffheapSelfTest.java index 1bd0f72..68bfb30 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsOffheapSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsOffheapSelfTest.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal.portable; import org.apache.ignite.internal.util.GridUnsafe; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.marshaller.portable.BinaryMarshaller; import org.eclipse.jetty.util.ConcurrentHashSet; import sun.misc.Unsafe; @@ -47,7 +47,7 @@ public class BinaryFieldsOffheapSelfTest extends BinaryFieldsAbstractSelfTest { } /** {@inheritDoc} */ - @Override protected BinaryObjectEx toPortable(PortableMarshaller marsh, Object obj) throws Exception { + @Override protected BinaryObjectEx toPortable(BinaryMarshaller marsh, Object obj) throws Exception { byte[] arr = marsh.marshal(obj); long ptr = UNSAFE.allocateMemory(arr.length);