ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [66/67] [abbrv] ignite git commit: Merge branch 'ignite-1847' into ignite-1816
Date Wed, 11 Nov 2015 08:26:02 GMT
Merge branch 'ignite-1847' into ignite-1816

Conflicts:
	modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
	modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
	modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2c9378a8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2c9378a8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2c9378a8

Branch: refs/heads/ignite-1816
Commit: 2c9378a81d9b36aa5b645d923c72500f85b3509d
Parents: 8e32a71 28cadee
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Nov 11 11:17:43 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Nov 11 11:17:43 2015 +0300

----------------------------------------------------------------------
 .../config/binary/example-ignite-binary.xml     |   44 +
 .../config/portable/example-ignite-portable.xml |   44 -
 .../apache/ignite/examples/binary/Address.java  |   72 +
 .../apache/ignite/examples/binary/Employee.java |   93 +
 .../ignite/examples/binary/EmployeeKey.java     |   90 +
 .../binary/ExampleBinaryNodeStartup.java        |   36 +
 .../ignite/examples/binary/Organization.java    |   93 +
 .../examples/binary/OrganizationType.java       |   32 +
 ...ComputeClientBinaryTaskExecutionExample.java |  153 +
 .../binary/computegrid/ComputeClientTask.java   |  116 +
 .../binary/computegrid/package-info.java        |   21 +
 .../CacheClientBinaryPutGetExample.java         |  230 ++
 .../datagrid/CacheClientBinaryQueryExample.java |  330 +++
 .../examples/binary/datagrid/package-info.java  |   21 +
 .../ignite/examples/binary/package-info.java    |   21 +
 .../ignite/examples/portable/Address.java       |   72 -
 .../ignite/examples/portable/Employee.java      |   93 -
 .../ignite/examples/portable/EmployeeKey.java   |   90 -
 .../portable/ExamplePortableNodeStartup.java    |   36 -
 .../ignite/examples/portable/Organization.java  |   93 -
 .../examples/portable/OrganizationType.java     |   32 -
 ...mputeClientPortableTaskExecutionExample.java |  154 -
 .../portable/computegrid/ComputeClientTask.java |  116 -
 .../portable/computegrid/package-info.java      |   21 -
 .../CacheClientPortablePutGetExample.java       |  230 --
 .../CacheClientPortableQueryExample.java        |  325 --
 .../portable/datagrid/package-info.java         |   21 -
 .../ignite/examples/portable/package-info.java  |   21 -
 .../java8/messaging/MessagingExample.java       |    7 +-
 .../CacheClientPortableExampleTest.java         |    8 +-
 .../ComputeClientPortableExampleTest.java       |    4 +-
 .../ignite/codegen/MessageCodeGenerator.java    |    5 +-
 .../src/main/java/org/apache/ignite/Ignite.java |   18 +-
 .../java/org/apache/ignite/IgniteBinary.java    |  358 +++
 .../java/org/apache/ignite/IgniteCache.java     |   14 +-
 .../org/apache/ignite/IgniteDataStreamer.java   |   16 +
 .../java/org/apache/ignite/IgnitePortables.java |  370 ---
 .../apache/ignite/IgniteSystemProperties.java   |    3 +
 .../org/apache/ignite/binary/BinaryField.java   |   46 +
 .../apache/ignite/binary/BinaryIdMapper.java    |   56 +
 .../binary/BinaryInvalidTypeException.java      |   58 +
 .../org/apache/ignite/binary/BinaryObject.java  |  163 +
 .../ignite/binary/BinaryObjectBuilder.java      |  135 +
 .../ignite/binary/BinaryObjectException.java    |   57 +
 .../apache/ignite/binary/BinaryRawReader.java   |  240 ++
 .../apache/ignite/binary/BinaryRawWriter.java   |  225 ++
 .../org/apache/ignite/binary/BinaryReader.java  |  290 ++
 .../apache/ignite/binary/BinarySerializer.java  |   49 +
 .../org/apache/ignite/binary/BinaryType.java    |   68 +
 .../ignite/binary/BinaryTypeConfiguration.java  |  135 +
 .../org/apache/ignite/binary/BinaryWriter.java  |  273 ++
 .../org/apache/ignite/binary/Binarylizable.java |   48 +
 .../org/apache/ignite/binary/package-info.java  |   22 +
 .../ignite/cache/CacheKeyConfiguration.java     |   92 +
 .../apache/ignite/cache/CacheTypeMetadata.java  |   67 +-
 .../org/apache/ignite/cache/IgniteObject.java   |   60 -
 .../org/apache/ignite/cache/QueryEntity.java    |  217 ++
 .../org/apache/ignite/cache/QueryIndex.java     |  192 ++
 .../org/apache/ignite/cache/QueryIndexType.java |   38 +
 .../configuration/CacheConfiguration.java       |  662 ++++-
 .../configuration/IgniteConfiguration.java      |   24 +
 .../ignite/internal/GridKernalContextImpl.java  |    4 +-
 .../apache/ignite/internal/IgniteKernal.java    |   64 +-
 .../internal/client/GridClientCompute.java      |    2 +-
 .../impl/connection/GridClientConnection.java   |    2 +-
 .../GridClientConnectionManagerAdapter.java     |    2 +-
 .../connection/GridClientNioTcpConnection.java  |    6 +-
 .../communication/GridIoMessageFactory.java     |    4 +-
 .../swapspace/GridSwapSpaceManager.java         |   34 -
 .../internal/portable/BinaryFieldImpl.java      |  116 +
 .../internal/portable/BinaryMetadata.java       |  152 +
 .../portable/BinaryMetadataCollector.java       |  254 ++
 .../portable/BinaryMetadataHandler.java         |   44 +
 .../portable/BinaryNoopMetadataHandler.java     |   53 +
 .../internal/portable/BinaryObjectEx.java       |  245 ++
 .../internal/portable/BinaryObjectImpl.java     |  590 ++++
 .../portable/BinaryObjectOffheapImpl.java       |  454 +++
 .../internal/portable/BinaryRawReaderEx.java    |   33 +
 .../internal/portable/BinaryRawWriterEx.java    |   60 +
 .../internal/portable/BinaryReaderExImpl.java   | 2780 +++++++++++++++++
 .../internal/portable/BinaryTypeImpl.java       |   75 +
 .../internal/portable/BinaryWriterExImpl.java   | 1902 ++++++++++++
 .../portable/GridPortableMarshaller.java        |   32 +-
 .../portable/PortableClassDescriptor.java       |  215 +-
 .../internal/portable/PortableContext.java      |  276 +-
 .../internal/portable/PortableFieldImpl.java    |  104 -
 .../portable/PortableMetaDataCollector.java     |  263 --
 .../portable/PortableMetaDataHandler.java       |   44 -
 .../internal/portable/PortableMetaDataImpl.java |  150 -
 .../internal/portable/PortableObjectEx.java     |  245 --
 .../internal/portable/PortableObjectImpl.java   |  586 ----
 .../portable/PortableObjectOffheapImpl.java     |  458 ---
 .../internal/portable/PortableRawReaderEx.java  |   33 -
 .../internal/portable/PortableRawWriterEx.java  |   60 -
 .../portable/PortableReaderContext.java         |    8 +-
 .../internal/portable/PortableReaderExImpl.java | 2785 ------------------
 .../ignite/internal/portable/PortableUtils.java |   32 +-
 .../internal/portable/PortableWriterExImpl.java | 1916 ------------
 .../builder/BinaryObjectBuilderImpl.java        |  559 ++++
 .../portable/builder/PortableBuilderEnum.java   |    8 +-
 .../portable/builder/PortableBuilderImpl.java   |  574 ----
 .../portable/builder/PortableBuilderReader.java |   76 +-
 .../PortableBuilderSerializationAware.java      |    2 +-
 .../builder/PortableBuilderSerializer.java      |   30 +-
 .../builder/PortableEnumArrayLazyValue.java     |   12 +-
 .../portable/builder/PortableLazyArrayList.java |    2 +-
 .../builder/PortableLazyLinkedList.java         |    2 +-
 .../portable/builder/PortableLazyMap.java       |    2 +-
 .../portable/builder/PortableLazyMapEntry.java  |    2 +-
 .../portable/builder/PortableLazySet.java       |    4 +-
 .../builder/PortableModifiableLazyValue.java    |    2 +-
 .../builder/PortableObjectArrayLazyValue.java   |    8 +-
 .../builder/PortablePlainLazyValue.java         |    2 +-
 .../builder/PortablePlainPortableObject.java    |   22 +-
 .../portable/builder/PortableValueWithType.java |   13 +-
 .../streams/PortableAbstractInputStream.java    |    6 +-
 .../affinity/GridAffinityAssignmentCache.java   |   16 +-
 .../affinity/GridAffinityProcessor.java         |    5 +-
 .../processors/cache/CacheInvokeEntry.java      |   11 +-
 .../processors/cache/CacheLazyEntry.java        |   23 +-
 .../internal/processors/cache/CacheObject.java  |   11 +-
 .../processors/cache/CacheObjectAdapter.java    |    2 +-
 .../cache/CacheObjectByteArrayImpl.java         |    7 +-
 .../processors/cache/CacheObjectContext.java    |  128 +-
 .../processors/cache/CacheObjectImpl.java       |    5 +
 .../processors/cache/CacheOperationContext.java |   22 +-
 .../processors/cache/GridCacheAdapter.java      |   98 +-
 .../cache/GridCacheAffinityManager.java         |   28 +-
 .../cache/GridCacheConcurrentMap.java           |   10 +-
 .../processors/cache/GridCacheContext.java      |   14 +-
 .../processors/cache/GridCacheEntryEx.java      |   15 +-
 .../processors/cache/GridCacheEventManager.java |   31 +-
 .../cache/GridCacheEvictionManager.java         |    5 +-
 .../processors/cache/GridCacheMapEntry.java     |  153 +-
 .../GridCachePartitionExchangeManager.java      |   24 +
 .../processors/cache/GridCachePreloader.java    |    5 +
 .../cache/GridCachePreloaderAdapter.java        |    5 +
 .../processors/cache/GridCacheProcessor.java    |   96 +-
 .../processors/cache/GridCacheProxyImpl.java    |    4 +-
 .../processors/cache/GridCacheReturn.java       |   27 +-
 .../processors/cache/GridCacheSwapManager.java  |   37 +-
 .../processors/cache/GridCacheUtils.java        |    3 +
 .../processors/cache/IgniteCacheProxy.java      |    8 +-
 .../processors/cache/IgniteInternalCache.java   |    6 +-
 .../processors/cache/KeyCacheObjectImpl.java    |    5 +
 .../CacheDataStructuresManager.java             |    4 +-
 .../distributed/GridCacheTxRecoveryFuture.java  |   13 +-
 .../GridDistributedCacheAdapter.java            |   40 +-
 .../distributed/GridDistributedCacheEntry.java  |    9 +-
 .../distributed/GridDistributedLockRequest.java |   17 +
 .../GridDistributedTxRemoteAdapter.java         |    3 +
 .../distributed/dht/GridDhtCacheEntry.java      |    5 +-
 .../distributed/dht/GridDhtLocalPartition.java  |   11 +-
 .../distributed/dht/GridDhtLockFuture.java      |   10 +-
 .../distributed/dht/GridDhtLockRequest.java     |    3 +
 .../dht/GridDhtTransactionalCacheAdapter.java   |   23 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   17 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   59 +-
 .../cache/distributed/dht/GridDhtTxRemote.java  |   12 +-
 .../dht/GridPartitionedGetFuture.java           |    6 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   75 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |    6 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |   82 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   15 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |   68 +-
 .../atomic/GridNearAtomicUpdateResponse.java    |    5 +-
 .../dht/colocated/GridDhtColocatedCache.java    |   29 +-
 .../colocated/GridDhtColocatedLockFuture.java   |   14 +-
 .../dht/preloader/GridDhtForceKeysFuture.java   |   16 +-
 .../preloader/GridDhtPartitionDemandPool.java   |    2 +-
 .../GridDhtPartitionsExchangeFuture.java        |    6 +
 .../dht/preloader/GridDhtPreloader.java         |   21 +-
 .../distributed/near/GridNearAtomicCache.java   |    4 +
 .../distributed/near/GridNearCacheEntry.java    |   17 +-
 .../distributed/near/GridNearGetFuture.java     |   47 +-
 .../distributed/near/GridNearLockFuture.java    |   14 +-
 .../distributed/near/GridNearLockRequest.java   |    2 +
 ...arOptimisticSerializableTxPrepareFuture.java |   12 +-
 .../near/GridNearTransactionalCache.java        |    8 +-
 .../cache/distributed/near/GridNearTxLocal.java |    9 +-
 .../distributed/near/GridNearTxRemote.java      |   12 +-
 .../cache/local/GridLocalCacheEntry.java        |   16 +-
 .../cache/local/GridLocalLockFuture.java        |    3 +-
 .../local/atomic/GridLocalAtomicCache.java      |  108 +-
 .../CacheDefaultPortableAffinityKeyMapper.java  |    8 +-
 .../portable/CacheObjectBinaryProcessor.java    |   97 +
 .../CacheObjectBinaryProcessorImpl.java         |  935 ++++++
 .../portable/CacheObjectPortableContext.java    |  133 -
 .../portable/CacheObjectPortableProcessor.java  |  103 -
 .../CacheObjectPortableProcessorImpl.java       | 1034 -------
 .../cache/portable/IgniteBinaryImpl.java        |  165 ++
 .../cache/portable/IgnitePortablesImpl.java     |  177 --
 .../cache/query/GridCacheQueryManager.java      |   13 +-
 .../cache/query/GridCacheQueryRequest.java      |    4 +-
 .../continuous/CacheContinuousQueryEvent.java   |    7 +-
 .../store/GridCacheStoreManagerAdapter.java     |   47 +-
 .../transactions/IgniteTransactionsImpl.java    |   10 +-
 .../cache/transactions/IgniteTxAdapter.java     |    5 +-
 .../cache/transactions/IgniteTxEntry.java       |   54 +-
 .../transactions/IgniteTxLocalAdapter.java      |  109 +-
 .../cache/transactions/IgniteTxLocalEx.java     |    1 +
 .../cache/transactions/IgniteTxManager.java     |    6 +-
 .../cacheobject/IgniteCacheObjectProcessor.java |    6 +
 .../IgniteCacheObjectProcessorImpl.java         |    9 +
 .../processors/cacheobject/NoOpBinary.java      |   75 +
 .../datastreamer/DataStreamProcessor.java       |    1 +
 .../datastreamer/DataStreamerEntry.java         |    6 +-
 .../datastreamer/DataStreamerImpl.java          |   16 +-
 .../datastreamer/DataStreamerRequest.java       |   58 +-
 .../datastreamer/DataStreamerUpdateJob.java     |   10 +-
 .../processors/job/GridJobProcessor.java        |   96 +-
 .../platform/PlatformAbstractTarget.java        |   30 +-
 .../processors/platform/PlatformContext.java    |   26 +-
 .../platform/PlatformContextImpl.java           |   59 +-
 .../platform/PlatformExtendedException.java     |    4 +-
 .../platform/PlatformProcessorImpl.java         |    6 +-
 .../platform/cache/PlatformCache.java           |   45 +-
 .../cache/PlatformCacheEntryFilterImpl.java     |    6 +-
 .../cache/PlatformCacheEntryProcessorImpl.java  |   12 +-
 .../platform/cache/PlatformCacheIterator.java   |    4 +-
 .../PlatformCachePartialUpdateException.java    |    4 +-
 .../cache/affinity/PlatformAffinity.java        |    8 +-
 .../query/PlatformAbstractQueryCursor.java      |   10 +-
 .../PlatformContinuousQueryRemoteFilter.java    |    4 +-
 .../cache/query/PlatformFieldsQueryCursor.java  |    4 +-
 .../cache/query/PlatformQueryCursor.java        |    4 +-
 .../cache/store/PlatformCacheStoreCallback.java |    6 +-
 .../platform/cluster/PlatformClusterGroup.java  |   12 +-
 .../cluster/PlatformClusterNodeFilterImpl.java  |    4 +-
 .../platform/compute/PlatformAbstractJob.java   |    4 +-
 .../platform/compute/PlatformAbstractTask.java  |    6 +-
 .../platform/compute/PlatformClosureJob.java    |    4 +-
 .../platform/compute/PlatformCompute.java       |   26 +-
 .../platform/compute/PlatformFullJob.java       |    6 +-
 .../platform/compute/PlatformFullTask.java      |   12 +-
 .../datastreamer/PlatformDataStreamer.java      |    5 +-
 .../PlatformStreamReceiverImpl.java             |    4 +-
 .../dotnet/PlatformDotNetCacheStore.java        |   50 +-
 .../PlatformDotNetConfigurationClosure.java     |   21 +-
 .../events/PlatformEventFilterListenerImpl.java |    6 +-
 .../platform/events/PlatformEvents.java         |   18 +-
 .../messaging/PlatformMessageFilterImpl.java    |    6 +-
 .../messaging/PlatformMessageLocalFilter.java   |    4 +-
 .../platform/messaging/PlatformMessaging.java   |    8 +-
 .../services/PlatformAbstractService.java       |   16 +-
 .../platform/services/PlatformServices.java     |   20 +-
 .../transactions/PlatformTransactions.java      |    5 +-
 .../platform/utils/PlatformFutureUtils.java     |   10 +-
 .../platform/utils/PlatformReaderBiClosure.java |    4 +-
 .../platform/utils/PlatformReaderClosure.java   |    4 +-
 .../platform/utils/PlatformUtils.java           |   60 +-
 .../platform/utils/PlatformWriterBiClosure.java |    4 +-
 .../platform/utils/PlatformWriterClosure.java   |    4 +-
 .../processors/query/GridQueryIndexing.java     |   18 +-
 .../processors/query/GridQueryProcessor.java    |  649 ++--
 .../client/message/GridClientTaskRequest.java   |    6 +-
 .../service/GridServiceProcessor.java           |   31 +-
 .../ignite/internal/util/IgniteUtils.java       |    9 +-
 .../util/nio/GridNioRecoveryDescriptor.java     |   11 +-
 .../ignite/internal/visor/cache/VisorCache.java |    5 +-
 .../marshaller/portable/PortableMarshaller.java |   88 +-
 .../PlatformDotNetPortableConfiguration.java    |   26 -
 .../apache/ignite/portable/PortableBuilder.java |  137 -
 .../ignite/portable/PortableException.java      |   57 -
 .../apache/ignite/portable/PortableField.java   |   46 -
 .../ignite/portable/PortableIdMapper.java       |   56 -
 .../portable/PortableInvalidClassException.java |   58 -
 .../ignite/portable/PortableMarshalAware.java   |   48 -
 .../ignite/portable/PortableMetadata.java       |   61 -
 .../apache/ignite/portable/PortableObject.java  |  163 -
 .../ignite/portable/PortableRawReader.java      |  240 --
 .../ignite/portable/PortableRawWriter.java      |  225 --
 .../apache/ignite/portable/PortableReader.java  |  291 --
 .../ignite/portable/PortableSerializer.java     |   49 -
 .../portable/PortableTypeConfiguration.java     |  177 --
 .../apache/ignite/portable/PortableWriter.java  |  273 --
 .../apache/ignite/portable/package-info.java    |   22 -
 .../communication/tcp/TcpCommunicationSpi.java  |   40 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  205 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  220 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |    2 +
 .../messages/TcpDiscoveryAbstractMessage.java   |   11 +
 .../TcpDiscoveryClientReconnectMessage.java     |    1 +
 .../messages/TcpDiscoveryDiscardMessage.java    |    1 +
 .../messages/TcpDiscoveryNodeAddedMessage.java  |   39 +
 .../apache/ignite/spi/swapspace/SwapKey.java    |    9 +-
 .../org/apache/ignite/stream/StreamAdapter.java |    3 +-
 .../GridTaskFailoverAffinityRunTest.java        |    3 +
 .../IgniteClientReconnectCacheTest.java         |   33 +
 .../portable/BinaryFieldsAbstractSelfTest.java  |  703 +++++
 .../portable/BinaryFieldsHeapSelfTest.java      |   32 +
 .../portable/BinaryFieldsOffheapSelfTest.java   |   61 +
 ...idBinaryObjectBuilderAdditionalSelfTest.java | 1280 ++++++++
 .../GridBinaryObjectBuilderSelfTest.java        | 1053 +++++++
 .../GridPortableAffinityKeySelfTest.java        |   10 +-
 .../GridPortableBuilderAdditionalSelfTest.java  | 1289 --------
 .../portable/GridPortableBuilderSelfTest.java   | 1069 -------
 ...eBuilderStringAsCharsAdditionalSelfTest.java |   28 -
 ...ridPortableBuilderStringAsCharsSelfTest.java |   28 -
 ...idPortableMarshallerCtxDisabledSelfTest.java |   44 +-
 .../GridPortableMarshallerSelfTest.java         |  485 ++-
 .../GridPortableMetaDataDisabledSelfTest.java   |  238 --
 .../portable/GridPortableMetaDataSelfTest.java  |   64 +-
 .../portable/GridPortableWildcardsSelfTest.java |   84 +-
 .../PortableCompactOffsetsAbstractSelfTest.java |   29 +-
 .../PortableCompactOffsetsHeapSelfTest.java     |    4 +-
 .../PortableCompactOffsetsOffheapSelfTest.java  |    4 +-
 .../PortableFieldsAbstractSelfTest.java         |  729 -----
 .../portable/PortableFieldsHeapSelfTest.java    |   32 -
 .../portable/PortableFieldsOffheapSelfTest.java |   61 -
 .../portable/TestCachingMetadataHandler.java    |   45 +
 .../GridBinaryMarshalerAwareTestClass.java      |   67 +
 .../GridPortableMarshalerAwareTestClass.java    |   67 -
 .../mutabletest/GridPortableTestClasses.java    |    6 +-
 .../processors/cache/CacheNamesSelfTest.java    |   69 +
 .../cache/CacheNearReaderUpdateTest.java        |   62 +-
 .../CacheSerializableTransactionsTest.java      |  313 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |    5 +
 .../GridCacheAbstractRemoveFailureTest.java     |    4 +-
 .../cache/GridCacheAbstractSelfTest.java        |    9 +-
 ...heOffHeapTieredEvictionAbstractSelfTest.java |    2 +-
 .../processors/cache/GridCacheTestEntryEx.java  |   13 +-
 .../cache/IgniteCachePeekModesAbstractTest.java |   30 +-
 .../cache/IgniteCachePutAllRestartTest.java     |    3 +
 .../cache/IgniteCacheTxNearPeekModesTest.java   |    7 +-
 .../cache/IgniteCacheTxPeekModesTest.java       |    5 +
 ...IgniteCacheAbstractExecutionContextTest.java |    5 +
 .../IgniteCacheTxExecutionContextTest.java      |    2 +
 .../CacheGetFutureHangsSelfTest.java            |   11 +-
 ...tractDistributedByteArrayValuesSelfTest.java |    4 +
 ...niteCacheClientNodeChangingTopologyTest.java |    6 +-
 .../IgniteCacheClientReconnectTest.java         |    2 +
 .../distributed/IgniteCacheManyClientsTest.java |   14 +-
 .../IgniteCacheCrossCacheTxFailoverTest.java    |    4 +-
 .../IgniteCachePutRetryAbstractSelfTest.java    |    4 +-
 ...ledFairAffinityMultiNodeFullApiSelfTest.java |    5 -
 ...omicNearEnabledMultiNodeFullApiSelfTest.java |    5 -
 ...icOffHeapTieredMultiNodeFullApiSelfTest.java |    5 -
 .../near/GridCacheNearTxExceptionSelfTest.java  |   15 +
 ...naryObjectsAbstractDataStreamerSelfTest.java |  190 ++
 ...aryObjectsAbstractMultiThreadedSelfTest.java |  231 ++
 .../GridCacheBinaryObjectsAbstractSelfTest.java |  981 ++++++
 ...ntNodeBinaryObjectMetadataMultinodeTest.java |  295 ++
 ...CacheClientNodeBinaryObjectMetadataTest.java |  216 ++
 ...ClientNodePortableMetadataMultinodeTest.java |  295 --
 ...GridCacheClientNodePortableMetadataTest.java |  286 --
 ...ableObjectsAbstractDataStreamerSelfTest.java |  190 --
 ...bleObjectsAbstractMultiThreadedSelfTest.java |  231 --
 ...ridCachePortableObjectsAbstractSelfTest.java |  978 ------
 .../GridCachePortableStoreAbstractSelfTest.java |    4 +-
 .../GridCachePortableStoreObjectsSelfTest.java  |    2 +-
 ...GridCachePortableStorePortablesSelfTest.java |   12 +-
 ...ridPortableCacheEntryMemorySizeSelfTest.java |   15 +-
 ...leDuplicateIndexObjectsAbstractSelfTest.java |    8 +-
 .../DataStreamProcessorPortableSelfTest.java    |   11 +-
 .../GridDataStreamerImplSelfTest.java           |   28 +-
 ...ridCacheAffinityRoutingPortableSelfTest.java |   10 +-
 ...rtableDataStreamerMultithreadedSelfTest.java |    4 +-
 ...tionedOnlyPortableMultithreadedSelfTest.java |    4 +-
 ...AtomicNearDisabledOffheapTieredSelfTest.java |   29 +
 ...BinaryObjectsAtomicNearDisabledSelfTest.java |   51 +
 ...inaryObjectsAtomicOffheapTieredSelfTest.java |   29 +
 .../GridCacheBinaryObjectsAtomicSelfTest.java   |   51 +
 ...tionedNearDisabledOffheapTieredSelfTest.java |   30 +
 ...yObjectsPartitionedNearDisabledSelfTest.java |   51 +
 ...ObjectsPartitionedOffheapTieredSelfTest.java |   30 +
 ...idCacheBinaryObjectsPartitionedSelfTest.java |   51 +
 ...acheOffHeapTieredAtomicPortableSelfTest.java |    2 +-
 ...eapTieredEvictionAtomicPortableSelfTest.java |    8 +-
 ...heOffHeapTieredEvictionPortableSelfTest.java |    8 +-
 .../GridCacheOffHeapTieredPortableSelfTest.java |    2 +-
 ...AtomicNearDisabledOffheapTieredSelfTest.java |   29 -
 ...rtableObjectsAtomicNearDisabledSelfTest.java |   51 -
 ...tableObjectsAtomicOffheapTieredSelfTest.java |   29 -
 .../GridCachePortableObjectsAtomicSelfTest.java |   51 -
 ...tionedNearDisabledOffheapTieredSelfTest.java |   30 -
 ...eObjectsPartitionedNearDisabledSelfTest.java |   51 -
 ...ObjectsPartitionedOffheapTieredSelfTest.java |   30 -
 ...CachePortableObjectsPartitionedSelfTest.java |   51 -
 ...ridCacheBinaryObjectsReplicatedSelfTest.java |   51 +
 ...dCachePortableObjectsReplicatedSelfTest.java |   51 -
 ...idCacheBinaryObjectsAtomicLocalSelfTest.java |   32 +
 ...BinaryObjectsLocalOffheapTieredSelfTest.java |   29 +
 .../GridCacheBinaryObjectsLocalSelfTest.java    |   51 +
 ...CachePortableObjectsAtomicLocalSelfTest.java |   32 -
 ...rtableObjectsLocalOffheapTieredSelfTest.java |   29 -
 .../GridCachePortableObjectsLocalSelfTest.java  |   51 -
 .../DataStreamProcessorSelfTest.java            |    8 +
 .../GridServiceProcessorStopSelfTest.java       |  103 +
 .../loadtests/hashmap/GridHashMapLoadTest.java  |    3 +-
 .../PlatformComputePortableArgTask.java         |   10 +-
 .../platform/PlatformEventsWriteEventTask.java  |    6 +-
 ...gniteClientReconnectMassiveShutdownTest.java |  329 +++
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |  288 +-
 .../file/GridFileSwapSpaceSpiSelfTest.java      |   11 +-
 .../ignite/testframework/GridTestUtils.java     |    4 +-
 .../ignite/testframework/junits/IgniteMock.java |   11 +-
 .../multijvm/IgniteCacheProcessProxy.java       |    4 +-
 .../junits/multijvm/IgniteProcessProxy.java     |   11 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |    2 +
 .../testsuites/IgniteKernalSelfTestSuite.java   |    2 +
 .../IgnitePortableObjectsTestSuite.java         |   78 +-
 .../processors/query/h2/IgniteH2Indexing.java   |   27 +-
 .../query/h2/opt/GridH2ValueCacheObject.java    |    8 +-
 .../query/h2/opt/GridLuceneIndex.java           |    4 +-
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |    3 +-
 ...CacheOffheapTieredMultithreadedSelfTest.java |   25 +-
 ...niteCacheP2pUnmarshallingQueryErrorTest.java |   19 +-
 ...hePartitionedQueryMultiThreadedSelfTest.java |   22 +-
 .../cache/SqlFieldsQuerySelfTest.java           |    2 -
 .../h2/GridIndexingSpiAbstractSelfTest.java     |    7 +-
 .../ignite/logger/log4j2/Log4J2Logger.java~     |  542 ----
 .../ignite/logger/log4j2/Log4j2FileAware.java~  |   33 -
 .../ignite/logger/log4j2/Log4jFileAware.java~   |   13 -
 modules/platforms/cpp/README.txt                |    2 +-
 .../cpp/common/include/ignite/common/java.h     |    2 +-
 modules/platforms/cpp/common/src/java.cpp       |    6 +-
 modules/platforms/cpp/core-test/Makefile.am     |    8 +-
 .../platforms/cpp/core-test/include/Makefile.am |    4 +-
 .../core-test/include/ignite/binary_test_defs.h |  320 ++
 .../include/ignite/binary_test_utils.h          |  516 ++++
 .../include/ignite/portable_test_defs.h         |  320 --
 .../include/ignite/portable_test_utils.h        |  516 ----
 .../cpp/core-test/project/vs/core-test.vcxproj  |   12 +-
 .../project/vs/core-test.vcxproj.filters        |   32 +-
 .../src/binary_reader_writer_raw_test.cpp       | 1593 ++++++++++
 .../core-test/src/binary_reader_writer_test.cpp | 2373 +++++++++++++++
 .../cpp/core-test/src/binary_session_test.cpp   |  257 ++
 .../cpp/core-test/src/binary_test_defs.cpp      |   65 +
 .../cpp/core-test/src/cache_query_test.cpp      |   26 +-
 .../platforms/cpp/core-test/src/cache_test.cpp  |   24 +-
 .../src/portable_reader_writer_raw_test.cpp     | 1593 ----------
 .../src/portable_reader_writer_test.cpp         | 2373 ---------------
 .../cpp/core-test/src/portable_session_test.cpp |  257 --
 .../cpp/core-test/src/portable_test_defs.cpp    |   65 -
 modules/platforms/cpp/core/Makefile.am          |   30 +-
 modules/platforms/cpp/core/include/Makefile.am  |   38 +-
 .../cpp/core/include/ignite/binary/binary.h     |   29 +
 .../core/include/ignite/binary/binary_consts.h  |  106 +
 .../include/ignite/binary/binary_containers.h   |  525 ++++
 .../include/ignite/binary/binary_raw_reader.h   |  350 +++
 .../include/ignite/binary/binary_raw_writer.h   |  326 ++
 .../core/include/ignite/binary/binary_reader.h  |  384 +++
 .../core/include/ignite/binary/binary_type.h    |  293 ++
 .../core/include/ignite/binary/binary_writer.h  |  362 +++
 .../include/ignite/cache/query/query_argument.h |    6 +-
 .../include/ignite/cache/query/query_scan.h     |    4 +-
 .../core/include/ignite/cache/query/query_sql.h |    4 +-
 .../ignite/cache/query/query_sql_fields.h       |    4 +-
 .../include/ignite/cache/query/query_text.h     |    4 +-
 .../cpp/core/include/ignite/ignite_error.h      |    4 +-
 .../include/ignite/impl/binary/binary_common.h  |  182 ++
 .../ignite/impl/binary/binary_id_resolver.h     |  106 +
 .../ignite/impl/binary/binary_reader_impl.h     | 1311 +++++++++
 .../include/ignite/impl/binary/binary_schema.h  |  136 +
 .../ignite/impl/binary/binary_type_handler.h    |  102 +
 .../ignite/impl/binary/binary_type_manager.h    |  120 +
 .../ignite/impl/binary/binary_type_snapshot.h   |  122 +
 .../ignite/impl/binary/binary_type_updater.h    |   53 +
 .../impl/binary/binary_type_updater_impl.h      |   65 +
 .../include/ignite/impl/binary/binary_utils.h   |  344 +++
 .../ignite/impl/binary/binary_writer_impl.h     |  913 ++++++
 .../core/include/ignite/impl/cache/cache_impl.h |    4 +-
 .../impl/cache/query/query_fields_row_impl.h    |    2 +-
 .../include/ignite/impl/ignite_environment.h    |   12 +-
 .../cpp/core/include/ignite/impl/operations.h   |   30 +-
 .../ignite/impl/portable/portable_common.h      |  182 --
 .../ignite/impl/portable/portable_id_resolver.h |  106 -
 .../impl/portable/portable_metadata_handler.h   |  102 -
 .../impl/portable/portable_metadata_manager.h   |  120 -
 .../impl/portable/portable_metadata_snapshot.h  |  122 -
 .../impl/portable/portable_metadata_updater.h   |   53 -
 .../portable/portable_metadata_updater_impl.h   |   65 -
 .../ignite/impl/portable/portable_reader_impl.h | 1320 ---------
 .../ignite/impl/portable/portable_schema.h      |  136 -
 .../ignite/impl/portable/portable_utils.h       |  344 ---
 .../ignite/impl/portable/portable_writer_impl.h |  912 ------
 .../cpp/core/include/ignite/portable/portable.h |   29 -
 .../include/ignite/portable/portable_consts.h   |  106 -
 .../ignite/portable/portable_containers.h       |  525 ----
 .../ignite/portable/portable_raw_reader.h       |  350 ---
 .../ignite/portable/portable_raw_writer.h       |  326 --
 .../include/ignite/portable/portable_reader.h   |  384 ---
 .../include/ignite/portable/portable_type.h     |  293 --
 .../include/ignite/portable/portable_writer.h   |  362 ---
 .../platforms/cpp/core/project/vs/core.vcxproj  |   68 +-
 .../cpp/core/project/vs/core.vcxproj.filters    |  200 +-
 .../cpp/core/src/binary/binary_containers.cpp   |   76 +
 .../cpp/core/src/binary/binary_raw_reader.cpp   |  145 +
 .../cpp/core/src/binary/binary_raw_writer.cpp   |  147 +
 .../cpp/core/src/binary/binary_reader.cpp       |  152 +
 .../cpp/core/src/binary/binary_type.cpp         |   51 +
 .../cpp/core/src/binary/binary_writer.cpp       |  154 +
 .../core/src/impl/binary/binary_reader_impl.cpp |  760 +++++
 .../cpp/core/src/impl/binary/binary_schema.cpp  |  135 +
 .../src/impl/binary/binary_type_handler.cpp     |   78 +
 .../src/impl/binary/binary_type_manager.cpp     |  201 ++
 .../src/impl/binary/binary_type_snapshot.cpp    |   70 +
 .../src/impl/binary/binary_type_updater.cpp     |   32 +
 .../impl/binary/binary_type_updater_impl.cpp    |   94 +
 .../cpp/core/src/impl/binary/binary_utils.cpp   |  211 ++
 .../core/src/impl/binary/binary_writer_impl.cpp |  622 ++++
 .../cpp/core/src/impl/cache/cache_impl.cpp      |   18 +-
 .../core/src/impl/cache/query/query_impl.cpp    |    6 +-
 .../cpp/core/src/impl/ignite_environment.cpp    |   14 +-
 .../src/impl/interop/interop_input_stream.cpp   |    8 +-
 .../src/impl/interop/interop_output_stream.cpp  |    8 +-
 .../impl/portable/portable_metadata_handler.cpp |   78 -
 .../impl/portable/portable_metadata_manager.cpp |  201 --
 .../portable/portable_metadata_snapshot.cpp     |   70 -
 .../impl/portable/portable_metadata_updater.cpp |   32 -
 .../portable/portable_metadata_updater_impl.cpp |   94 -
 .../src/impl/portable/portable_reader_impl.cpp  |  773 -----
 .../core/src/impl/portable/portable_schema.cpp  |  135 -
 .../core/src/impl/portable/portable_utils.cpp   |  214 --
 .../src/impl/portable/portable_writer_impl.cpp  |  627 ----
 .../core/src/portable/portable_containers.cpp   |   76 -
 .../core/src/portable/portable_raw_reader.cpp   |  145 -
 .../core/src/portable/portable_raw_writer.cpp   |  147 -
 .../cpp/core/src/portable/portable_reader.cpp   |  152 -
 .../cpp/core/src/portable/portable_type.cpp     |   51 -
 .../cpp/core/src/portable/portable_writer.cpp   |  154 -
 .../cpp/examples/config/example-cache.xml       |    2 +-
 .../examples/include/ignite/examples/address.h  |   14 +-
 .../include/ignite/examples/organization.h      |   14 +-
 .../Cache/CacheAbstractTest.cs                  |    2 +-
 .../Config/Compute/compute-grid1.xml            |    6 +-
 .../Impl/Portable/PortableUtils.cs              |   13 +-
 modules/rest-http/pom.xml                       |    6 +
 .../http/jetty/GridJettyRestProtocol.java       |    4 +-
 .../scala/org/apache/ignite/spark/Entity.scala  |    2 +-
 .../org/apache/ignite/spark/IgniteRDDSpec.scala |  249 ++
 .../org/apache/ignite/spark/IgniteRddSpec.scala |  249 --
 .../org/apache/ignite/IgniteSpringBean.java     |   14 +-
 modules/ssh/pom.xml                             |    2 +-
 .../config/benchmark-client-mode.properties     |    4 +-
 .../config/benchmark-failover.properties        |  107 +
 .../config/benchmark-multicast.properties       |   71 +-
 .../yardstick/config/benchmark-store.properties |    4 +-
 modules/yardstick/config/benchmark.properties   |    4 +-
 modules/yardstick/config/ignite-base-config.xml |   37 +-
 .../config/ignite-failover-base-config.xml      |  126 +
 .../config/ignite-failover-localhost-config.xml |   56 +
 modules/yardstick/pom.xml                       |    3 +-
 .../yardstick/IgniteAbstractBenchmark.java      |    2 +-
 .../yardstick/IgniteBenchmarkArguments.java     |   66 +-
 .../cache/IgniteCacheAbstractBenchmark.java     |    8 +-
 .../yardstick/cache/IgniteGetBenchmark.java     |    4 +-
 .../cache/IgniteJdbcSqlQueryBenchmark.java      |    4 +-
 .../yardstick/cache/IgnitePutAllBenchmark.java  |    4 +-
 .../cache/IgnitePutAllTxBenchmark.java          |    4 +-
 .../yardstick/cache/IgnitePutBenchmark.java     |    4 +-
 .../yardstick/cache/IgnitePutGetBenchmark.java  |    4 +-
 .../cache/IgnitePutGetTxBenchmark.java          |    4 +-
 .../cache/IgnitePutIndexedValue1Benchmark.java  |    4 +-
 .../cache/IgnitePutIndexedValue2Benchmark.java  |    4 +-
 .../cache/IgnitePutIndexedValue8Benchmark.java  |    4 +-
 .../yardstick/cache/IgnitePutTxBenchmark.java   |    4 +-
 .../cache/IgniteSqlQueryBenchmark.java          |    4 +-
 .../cache/IgniteSqlQueryJoinBenchmark.java      |    4 +-
 .../cache/IgniteSqlQueryPutBenchmark.java       |    6 +-
 .../IgniteAtomicInvokeRetryBenchmark.java       |  214 ++
 ...IgniteAtomicOffHeapInvokeRetryBenchmark.java |   31 +
 .../IgniteAtomicOffHeapRetriesBenchmark.java    |   31 +
 .../failover/IgniteAtomicRetriesBenchmark.java  |   89 +
 .../IgniteFailoverAbstractBenchmark.java        |  320 ++
 .../cache/failover/IgniteFailoverNode.java      |   60 +
 ...IgniteTransactionalInvokeRetryBenchmark.java |  212 ++
 ...ransactionalOffHeapInvokeRetryBenchmark.java |   33 +
 ...ransactionalOffHeapWriteInvokeBenchmark.java |   37 +
 ...eTransactionalOffHeapWriteReadBenchmark.java |   32 +
 ...IgniteTransactionalWriteInvokeBenchmark.java |  182 ++
 .../IgniteTransactionalWriteReadBenchmark.java  |  141 +
 .../yardstick/cache/model/Organization.java     |   14 +-
 .../ignite/yardstick/cache/model/Person.java    |   14 +-
 .../ignite/yardstick/cache/model/SampleKey.java |   14 +-
 .../yardstick/cache/model/SampleValue.java      |   14 +-
 parent/pom.xml                                  |    7 +-
 578 files changed, 40076 insertions(+), 36344 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2c9378a8/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
index 0000000,7459d24..4be9744
mode 000000,100644..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
@@@ -1,0 -1,590 +1,590 @@@
+ /*
+  * 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.portable;
+ 
+ import org.apache.ignite.IgniteCheckedException;
+ import org.apache.ignite.internal.GridDirectTransient;
+ import org.apache.ignite.internal.IgniteCodeGeneratingFail;
+ import org.apache.ignite.internal.portable.streams.PortableHeapInputStream;
+ import org.apache.ignite.internal.processors.cache.CacheObject;
+ import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+ import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl;
+ import org.apache.ignite.internal.util.typedef.internal.A;
+ import org.apache.ignite.internal.util.typedef.internal.U;
+ import org.apache.ignite.plugin.extensions.communication.Message;
+ import org.apache.ignite.plugin.extensions.communication.MessageReader;
+ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+ import org.apache.ignite.binary.BinaryObjectException;
+ import org.apache.ignite.binary.BinaryType;
+ import org.apache.ignite.binary.BinaryObject;
+ import org.apache.ignite.binary.BinaryField;
+ import org.jetbrains.annotations.Nullable;
+ 
+ import java.io.Externalizable;
+ import java.io.IOException;
+ import java.io.ObjectInput;
+ import java.io.ObjectOutput;
+ import java.math.BigDecimal;
+ import java.math.BigInteger;
+ import java.nio.ByteBuffer;
+ import java.sql.Timestamp;
+ import java.util.Date;
+ import java.util.UUID;
+ 
+ import static java.nio.charset.StandardCharsets.UTF_8;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.BOOLEAN;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.BYTE;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.DECIMAL;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.DOUBLE;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.FLOAT;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.INT;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.SHORT;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.STRING;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.TIMESTAMP;
+ 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 static final byte TYPE_BINARY = 100;
+ 
+     /** */
+     private static final long serialVersionUID = 0L;
+ 
+     /** */
+     @GridDirectTransient
+     private PortableContext ctx;
+ 
+     /** */
+     private byte[] arr;
+ 
+     /** */
+     private int start;
+ 
+     /** */
+     @GridDirectTransient
+     private Object obj;
+ 
+     /** */
+     @GridDirectTransient
+     private boolean detachAllowed;
+ 
+     /**
+      * For {@link Externalizable}.
+      */
+     public BinaryObjectImpl() {
+         // No-op.
+     }
+ 
+     /**
+      * @param ctx Context.
+      * @param arr Array.
+      * @param start Start.
+      */
+     public BinaryObjectImpl(PortableContext ctx, byte[] arr, int start) {
+         assert ctx != null;
+         assert arr != null;
+ 
+         this.ctx = ctx;
+         this.arr = arr;
+         this.start = start;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte cacheObjectType() {
+         return TYPE_BINARY;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public boolean isPlatformType() {
+         return false;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public boolean internal() {
+         return false;
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean cpy) {
+         Object obj0 = obj;
+ 
+         if (obj0 == null || cpy)
+             obj0 = deserializeValue();
+ 
+         return (T)obj0;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte[] valueBytes(CacheObjectContext ctx) throws IgniteCheckedException {
+         if (detached())
+             return array();
+ 
+         int len = length();
+ 
+         byte[] arr0 = new byte[len];
+ 
+         U.arrayCopy(arr, start, arr0, 0, len);
+ 
+         return arr0;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public CacheObject prepareForCache(CacheObjectContext ctx) {
+         if (detached())
+             return this;
+ 
+         return (BinaryObjectImpl)detach();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public void finishUnmarshal(CacheObjectContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+         this.ctx = ((CacheObjectBinaryProcessorImpl)ctx.processor()).portableContext();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
+         // No-op.
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public int length() {
+         return PortablePrimitives.readInt(arr, start + GridPortableMarshaller.TOTAL_LEN_POS);
+     }
+ 
+     /**
+      * @return Detached portable object.
+      */
+     public BinaryObject detach() {
+         if (!detachAllowed || detached())
+             return this;
+ 
+         int len = length();
+ 
+         byte[] arr0 = new byte[len];
+ 
+         U.arrayCopy(arr, start, arr0, 0, len);
+ 
+         return new BinaryObjectImpl(ctx, arr0, 0);
+     }
+ 
+     /**
+      * @return Detached or not.
+      */
+     public boolean detached() {
+         return start == 0 && length() == arr.length;
+     }
+ 
+     /**
+      * @param detachAllowed Detach allowed flag.
+      */
+     public void detachAllowed(boolean detachAllowed) {
+         this.detachAllowed = detachAllowed;
+     }
+ 
+     /**
+      * @return Context.
+      */
+     public PortableContext context() {
+         return ctx;
+     }
+ 
+     /**
+      * @param ctx Context.
+      */
+     public void context(PortableContext ctx) {
+         this.ctx = ctx;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte[] array() {
+         return arr;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public int start() {
+         return start;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public long offheapAddress() {
+         return 0;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override protected boolean hasArray() {
+         return true;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public int typeId() {
+         return PortablePrimitives.readInt(arr, start + GridPortableMarshaller.TYPE_ID_POS);
+     }
+ 
+     /** {@inheritDoc} */
+     @Nullable @Override public BinaryType type() throws BinaryObjectException {
+         if (ctx == null)
+             throw new BinaryObjectException("PortableContext is not set for the object.");
+ 
+         return ctx.metaData(typeId());
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override public <F> F field(String fieldName) throws BinaryObjectException {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx, arr, start, null);
+ 
+         return (F)reader.unmarshalField(fieldName);
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override public <F> F field(int fieldId) throws BinaryObjectException {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx, arr, start, null);
+ 
+         return (F)reader.unmarshalField(fieldId);
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override protected <F> F fieldByOrder(int order) {
+         Object val;
+ 
+         // Calculate field position.
+         int schemaOffset = PortablePrimitives.readInt(arr, start + GridPortableMarshaller.SCHEMA_OR_RAW_OFF_POS);
+ 
+         short flags = PortablePrimitives.readShort(arr, start + GridPortableMarshaller.FLAGS_POS);
 -        int fieldOffsetSize = PortableUtils.fieldOffsetSize(flags);
++        int fieldOffsetLen = PortableUtils.fieldOffsetLength(flags);
+ 
 -        int fieldOffsetPos = start + schemaOffset + order * (4 + fieldOffsetSize) + 4;
++        int fieldOffsetPos = start + schemaOffset + order * (4 + fieldOffsetLen) + 4;
+ 
+         int fieldPos;
+ 
 -        if (fieldOffsetSize == PortableUtils.OFFSET_1)
++        if (fieldOffsetLen == PortableUtils.OFFSET_1)
+             fieldPos = start + ((int)PortablePrimitives.readByte(arr, fieldOffsetPos) & 0xFF);
 -        else if (fieldOffsetSize == PortableUtils.OFFSET_2)
++        else if (fieldOffsetLen == PortableUtils.OFFSET_2)
+             fieldPos = start + ((int)PortablePrimitives.readShort(arr, fieldOffsetPos) & 0xFFFF);
+         else
+             fieldPos = start + PortablePrimitives.readInt(arr, fieldOffsetPos);
+ 
+         // Read header and try performing fast lookup for well-known types (the most common types go first).
+         byte hdr = PortablePrimitives.readByte(arr, fieldPos);
+ 
+         switch (hdr) {
+             case INT:
+                 val = PortablePrimitives.readInt(arr, fieldPos + 1);
+ 
+                 break;
+ 
+             case LONG:
+                 val = PortablePrimitives.readLong(arr, fieldPos + 1);
+ 
+                 break;
+ 
+             case BOOLEAN:
+                 val = PortablePrimitives.readBoolean(arr, fieldPos + 1);
+ 
+                 break;
+ 
+             case SHORT:
+                 val = PortablePrimitives.readShort(arr, fieldPos + 1);
+ 
+                 break;
+ 
+             case BYTE:
+                 val = PortablePrimitives.readByte(arr, fieldPos + 1);
+ 
+                 break;
+ 
+             case CHAR:
+                 val = PortablePrimitives.readChar(arr, fieldPos + 1);
+ 
+                 break;
+ 
+             case FLOAT:
+                 val = PortablePrimitives.readFloat(arr, fieldPos + 1);
+ 
+                 break;
+ 
+             case DOUBLE:
+                 val = PortablePrimitives.readDouble(arr, fieldPos + 1);
+ 
+                 break;
+ 
+             case STRING: {
+                 int dataLen = PortablePrimitives.readInt(arr, fieldPos + 1);
+ 
+                 val = new String(arr, fieldPos + 5, dataLen, UTF_8);
+ 
+                 break;
+             }
+ 
+             case DATE: {
+                 long time = PortablePrimitives.readLong(arr, fieldPos + 1);
+ 
+                 val = new Date(time);
+ 
+                 break;
+             }
+ 
+             case TIMESTAMP: {
+                 long time = PortablePrimitives.readLong(arr, fieldPos + 1);
+                 int nanos = PortablePrimitives.readInt(arr, fieldPos + 1 + 8);
+ 
+                 Timestamp ts = new Timestamp(time);
+ 
+                 ts.setNanos(ts.getNanos() + nanos);
+ 
+                 val = ts;
+ 
+                 break;
+             }
+ 
+             case UUID: {
+                 long most = PortablePrimitives.readLong(arr, fieldPos + 1);
+                 long least = PortablePrimitives.readLong(arr, fieldPos + 1 + 8);
+ 
+                 val = new UUID(most, least);
+ 
+                 break;
+             }
+ 
+             case DECIMAL: {
+                 int scale = PortablePrimitives.readInt(arr, fieldPos + 1);
+ 
+                 int dataLen = PortablePrimitives.readInt(arr, fieldPos + 5);
+                 byte[] data = PortablePrimitives.readByteArray(arr, fieldPos + 9, dataLen);
+ 
+                 BigInteger intVal = new BigInteger(data);
+ 
+                 if (scale < 0) {
+                     scale &= 0x7FFFFFFF;
+ 
+                     intVal = intVal.negate();
+                 }
+ 
+                 val = new BigDecimal(intVal, scale);
+ 
+                 break;
+             }
+ 
+             case NULL:
+                 val = null;
+ 
+                 break;
+ 
+             default: {
+                 BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx, arr, start, null);
+ 
+                 val = reader.unmarshalFieldByAbsolutePosition(fieldPos);
+             }
+         }
+ 
+         return (F)val;
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override protected <F> F field(PortableReaderContext rCtx, String fieldName) {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx,
+             new PortableHeapInputStream(arr),
+             start,
+             null,
+             rCtx);
+ 
+         return (F)reader.unmarshalField(fieldName);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public boolean hasField(String fieldName) {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx, arr, start, null);
+ 
+         return reader.hasField(fieldName);
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override public <T> T deserialize() throws BinaryObjectException {
+         Object obj0 = obj;
+ 
+         if (obj0 == null)
+             obj0 = deserializeValue();
+ 
+         return (T)obj0;
+ 
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public BinaryObject clone() throws CloneNotSupportedException {
+         return super.clone();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public int hashCode() {
+         return PortablePrimitives.readInt(arr, start + GridPortableMarshaller.HASH_CODE_POS);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override protected int schemaId() {
+         return PortablePrimitives.readInt(arr, start + GridPortableMarshaller.SCHEMA_ID_POS);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override protected PortableSchema createSchema() {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx, arr, start, null);
+ 
+         return reader.createSchema();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public BinaryField fieldDescriptor(String fieldName) throws BinaryObjectException {
+         A.notNull(fieldName, "fieldName");
+ 
+         return ctx.createField(typeId(), fieldName);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public void writeExternal(ObjectOutput out) throws IOException {
+         out.writeObject(ctx);
+ 
+         if (detachAllowed) {
+             int len = length();
+ 
+             out.writeInt(len);
+             out.write(arr, start, len);
+             out.writeInt(0);
+         }
+         else {
+             out.writeInt(arr.length);
+             out.write(arr);
+             out.writeInt(start);
+         }
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+         ctx = (PortableContext)in.readObject();
+ 
+         arr = new byte[in.readInt()];
+ 
+         in.readFully(arr);
+ 
+         start = in.readInt();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+         writer.setBuffer(buf);
+ 
+         if (!writer.isHeaderWritten()) {
+             if (!writer.writeHeader(directType(), fieldsCount()))
+                 return false;
+ 
+             writer.onHeaderWritten();
+         }
+ 
+         switch (writer.state()) {
+             case 0:
+                 if (!writer.writeByteArray("arr",
+                     arr,
+                     detachAllowed ? start : 0,
+                     detachAllowed ? length() : arr.length))
+                     return false;
+ 
+                 writer.incrementState();
+ 
+             case 1:
+                 if (!writer.writeInt("start", detachAllowed ? 0 : start))
+                     return false;
+ 
+                 writer.incrementState();
+ 
+         }
+ 
+         return true;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+         reader.setBuffer(buf);
+ 
+         if (!reader.beforeMessageRead())
+             return false;
+ 
+         switch (reader.state()) {
+             case 0:
+                 arr = reader.readByteArray("arr");
+ 
+                 if (!reader.isLastRead())
+                     return false;
+ 
+                 reader.incrementState();
+ 
+             case 1:
+                 start = reader.readInt("start");
+ 
+                 if (!reader.isLastRead())
+                     return false;
+ 
+                 reader.incrementState();
+ 
+         }
+ 
+         return true;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte directType() {
+         return 113;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte fieldsCount() {
+         return 3;
+     }
+ 
+     /**
+      * 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() {
+         // TODO: IGNITE-1272 - Deserialize with proper class loader.
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx, arr, start, null);
+ 
+         Object obj0 = reader.deserialize();
+ 
+         PortableClassDescriptor desc = reader.descriptor();
+ 
+         assert desc != null;
+ 
+         if (desc.keepDeserialized())
+             obj = obj0;
+ 
+         return obj0;
+     }
+ }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2c9378a8/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
index 0000000,3c1595c..0ba4fdb
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
@@@ -1,0 -1,454 +1,454 @@@
+ /*
+  * 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.portable;
+ 
+ import java.io.Externalizable;
+ import java.io.IOException;
+ import java.io.ObjectInput;
+ import java.io.ObjectOutput;
+ import java.math.BigDecimal;
+ import java.math.BigInteger;
+ import java.nio.ByteBuffer;
+ import java.sql.Timestamp;
+ import java.util.Date;
+ import java.util.UUID;
+ 
+ import org.apache.ignite.IgniteCheckedException;
+ import org.apache.ignite.internal.portable.streams.PortableOffheapInputStream;
+ import org.apache.ignite.internal.processors.cache.CacheObject;
+ import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+ import org.apache.ignite.internal.util.GridUnsafe;
+ import org.apache.ignite.internal.util.typedef.internal.A;
+ import org.apache.ignite.internal.util.typedef.internal.U;
+ import org.apache.ignite.plugin.extensions.communication.MessageReader;
+ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+ import org.apache.ignite.binary.BinaryObjectException;
+ import org.apache.ignite.binary.BinaryType;
+ import org.apache.ignite.binary.BinaryObject;
+ import org.apache.ignite.binary.BinaryField;
+ import org.jetbrains.annotations.Nullable;
+ import sun.misc.Unsafe;
+ 
+ import static java.nio.charset.StandardCharsets.UTF_8;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.BOOLEAN;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.BYTE;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.DECIMAL;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.DOUBLE;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.FLOAT;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.INT;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.SHORT;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.STRING;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.TIMESTAMP;
+ import static org.apache.ignite.internal.portable.GridPortableMarshaller.UUID;
+ 
+ /**
+  *  Portable object implementation over offheap memory
+  */
+ public class BinaryObjectOffheapImpl extends BinaryObjectEx implements Externalizable, CacheObject {
+     /** */
+     private static final long serialVersionUID = 0L;
+ 
+     /** */
+     private static final Unsafe UNSAFE = GridUnsafe.unsafe();
+ 
+     /** */
+     private final PortableContext ctx;
+ 
+     /** */
+     private final long ptr;
+ 
+     /** */
+     private final int start;
+ 
+     /** */
+     private final int size;
+ 
+     /**
+      * For {@link Externalizable} (not supported).
+      */
+     public BinaryObjectOffheapImpl() {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /**
+      * @param ctx Context.
+      * @param ptr Memory address.
+      * @param start Object start.
+      * @param size Memory size.
+      */
+     public BinaryObjectOffheapImpl(PortableContext ctx, long ptr, int start, int size) {
+         this.ctx = ctx;
+         this.ptr = ptr;
+         this.start = start;
+         this.size = size;
+     }
+ 
+     /**
+      * @return Heap-based copy.
+      */
+     public BinaryObject heapCopy() {
+         return new BinaryObjectImpl(ctx, U.copyMemory(ptr, size), start);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public int typeId() {
+         return UNSAFE.getInt(ptr + start + GridPortableMarshaller.TYPE_ID_POS);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public int length() {
+         return UNSAFE.getInt(ptr + start + GridPortableMarshaller.TOTAL_LEN_POS);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public int hashCode() {
+         return UNSAFE.getInt(ptr + start + GridPortableMarshaller.HASH_CODE_POS);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override protected int schemaId() {
+         return UNSAFE.getInt(ptr + start + GridPortableMarshaller.SCHEMA_ID_POS);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override protected PortableSchema createSchema() {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx,
+             new PortableOffheapInputStream(ptr, size, false),
+             start,
+             null);
+ 
+         return reader.createSchema();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public BinaryField fieldDescriptor(String fieldName) throws BinaryObjectException {
+         A.notNull(fieldName, "fieldName");
+ 
+         return ctx.createField(typeId(), fieldName);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public int start() {
+         return start;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte[] array() {
+         return null;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public long offheapAddress() {
+         return ptr;
+     }
+ 
+     /** {@inheritDoc} */
+     @Override protected boolean hasArray() {
+         return false;
+     }
+ 
+     /** {@inheritDoc} */
+     @Nullable @Override public BinaryType type() throws BinaryObjectException {
+         if (ctx == null)
+             throw new BinaryObjectException("PortableContext is not set for the object.");
+ 
+         return ctx.metaData(typeId());
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override public <F> F field(String fieldName) throws BinaryObjectException {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx,
+             new PortableOffheapInputStream(ptr, size, false),
+             start,
+             null);
+ 
+         return (F)reader.unmarshalField(fieldName);
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override public <F> F field(int fieldId) throws BinaryObjectException {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx,
+             new PortableOffheapInputStream(ptr, size, false),
+             start,
+             null);
+ 
+         return (F)reader.unmarshalField(fieldId);
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override protected <F> F fieldByOrder(int order) {
+         Object val;
+ 
+         // Calculate field position.
+         int schemaOffset = PortablePrimitives.readInt(ptr, start + GridPortableMarshaller.SCHEMA_OR_RAW_OFF_POS);
+ 
+         short flags = PortablePrimitives.readShort(ptr, start + GridPortableMarshaller.FLAGS_POS);
 -        int fieldOffsetSize = PortableUtils.fieldOffsetSize(flags);
+ 
 -        int fieldOffsetPos = start + schemaOffset + order * (4 + fieldOffsetSize) + 4;
++        int fieldOffsetLen = PortableUtils.fieldOffsetLength(flags);
++        int fieldOffsetPos = start + schemaOffset + order * (4 + fieldOffsetLen) + 4;
+ 
+         int fieldPos;
+ 
 -        if (fieldOffsetSize == PortableUtils.OFFSET_1)
++        if (fieldOffsetLen == PortableUtils.OFFSET_1)
+             fieldPos = start + ((int)PortablePrimitives.readByte(ptr, fieldOffsetPos) & 0xFF);
 -        else if (fieldOffsetSize == PortableUtils.OFFSET_2)
++        else if (fieldOffsetLen == PortableUtils.OFFSET_2)
+             fieldPos = start + ((int)PortablePrimitives.readShort(ptr, fieldOffsetPos) & 0xFFFF);
+         else
+             fieldPos = start + PortablePrimitives.readInt(ptr, fieldOffsetPos);
+ 
+         // Read header and try performing fast lookup for well-known types (the most common types go first).
+         byte hdr = PortablePrimitives.readByte(ptr, fieldPos);
+ 
+         switch (hdr) {
+             case INT:
+                 val = PortablePrimitives.readInt(ptr, fieldPos + 1);
+ 
+                 break;
+ 
+             case LONG:
+                 val = PortablePrimitives.readLong(ptr, fieldPos + 1);
+ 
+                 break;
+ 
+             case BOOLEAN:
+                 val = PortablePrimitives.readBoolean(ptr, fieldPos + 1);
+ 
+                 break;
+ 
+             case SHORT:
+                 val = PortablePrimitives.readShort(ptr, fieldPos + 1);
+ 
+                 break;
+ 
+             case BYTE:
+                 val = PortablePrimitives.readByte(ptr, fieldPos + 1);
+ 
+                 break;
+ 
+             case CHAR:
+                 val = PortablePrimitives.readChar(ptr, fieldPos + 1);
+ 
+                 break;
+ 
+             case FLOAT:
+                 val = PortablePrimitives.readFloat(ptr, fieldPos + 1);
+ 
+                 break;
+ 
+             case DOUBLE:
+                 val = PortablePrimitives.readDouble(ptr, fieldPos + 1);
+ 
+                 break;
+ 
+             case STRING: {
+                 int dataLen = PortablePrimitives.readInt(ptr, fieldPos + 1);
+                 byte[] data = PortablePrimitives.readByteArray(ptr, fieldPos + 5, dataLen);
+ 
+                 val = new String(data, UTF_8);
+ 
+                 break;
+             }
+ 
+             case DATE: {
+                 long time = PortablePrimitives.readLong(ptr, fieldPos + 1);
+ 
+                 val = new Date(time);
+ 
+                 break;
+             }
+ 
+             case TIMESTAMP: {
+                 long time = PortablePrimitives.readLong(ptr, fieldPos + 1);
+                 int nanos = PortablePrimitives.readInt(ptr, fieldPos + 1 + 8);
+ 
+                 Timestamp ts = new Timestamp(time);
+ 
+                 ts.setNanos(ts.getNanos() + nanos);
+ 
+                 val = ts;
+ 
+                 break;
+             }
+ 
+             case UUID: {
+                 long most = PortablePrimitives.readLong(ptr, fieldPos + 1);
+                 long least = PortablePrimitives.readLong(ptr, fieldPos + 1 + 8);
+ 
+                 val = new UUID(most, least);
+ 
+                 break;
+             }
+ 
+             case DECIMAL: {
+                 int scale = PortablePrimitives.readInt(ptr, fieldPos + 1);
+ 
+                 int dataLen = PortablePrimitives.readInt(ptr, fieldPos + 5);
+                 byte[] data = PortablePrimitives.readByteArray(ptr, fieldPos + 9, dataLen);
+ 
+                 BigInteger intVal = new BigInteger(data);
+ 
+                 if (scale < 0) {
+                     scale &= 0x7FFFFFFF;
+ 
+                     intVal = intVal.negate();
+                 }
+ 
+                 val = new BigDecimal(intVal, scale);
+ 
+                 break;
+             }
+ 
+             case NULL:
+                 val = null;
+ 
+                 break;
+ 
+             default: {
+                 BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx,
+                     new PortableOffheapInputStream(ptr, size, false),
+                     start,
+                     null);
+ 
+                 val = reader.unmarshalFieldByAbsolutePosition(fieldPos);
+             }
+         }
+ 
+         return (F)val;
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override protected <F> F field(PortableReaderContext rCtx, String fieldName) {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx,
+             new PortableOffheapInputStream(ptr, size, false),
+             start,
+             null,
+             rCtx);
+ 
+         return (F)reader.unmarshalField(fieldName);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public boolean hasField(String fieldName) {
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx,
+             new PortableOffheapInputStream(ptr, size, false),
+             start,
+             null);
+ 
+         return reader.hasField(fieldName);
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override public <T> T deserialize() throws BinaryObjectException {
+         return (T)deserializeValue();
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("CloneDoesntCallSuperClone")
+     @Override public BinaryObject clone() throws CloneNotSupportedException {
+         return heapCopy();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte cacheObjectType() {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public boolean isPlatformType() {
+         return false;
+     }
+ 
+     /** {@inheritDoc} */
+     @SuppressWarnings("unchecked")
+     @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean cpy) {
+         return (T)deserializeValue();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte[] valueBytes(CacheObjectContext ctx) throws IgniteCheckedException {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public CacheObject prepareForCache(CacheObjectContext ctx) {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public void finishUnmarshal(CacheObjectContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte directType() {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public byte fieldsCount() {
+         throw new UnsupportedOperationException();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public void writeExternal(ObjectOutput out) throws IOException {
+         throw new UnsupportedOperationException(); // To make sure it is not marshalled.
+     }
+ 
+     /** {@inheritDoc} */
+     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+         throw new UnsupportedOperationException(); // To make sure it is not marshalled.
+     }
+ 
+     /**
+      * @return Deserialized value.
+      */
+     private Object deserializeValue() {
+         // TODO: IGNITE-1272 - Deserialize with proper class loader.
+         BinaryReaderExImpl reader = new BinaryReaderExImpl(
+             ctx,
+             new PortableOffheapInputStream(ptr, size, false),
+             start,
+             null);
+ 
+         return reader.deserialize();
+     }
+ }


Mime
View raw message