You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/11/28 13:57:11 UTC

[01/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Repository: ignite
Updated Branches:
  refs/heads/ignite-1282 7eea46d3e -> 6ef7fb604


Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1282
Commit: 1eaa8c92d2db395279fb33cdd8e914bd2f2f9f3d
Parents: 54ae690 c584cca
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Nov 26 15:12:49 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Nov 26 15:12:49 2015 +0300

----------------------------------------------------------------------
 .../config/binary/example-ignite-binary.xml     |  44 ----
 examples/config/example-ignite.xml              |  10 +-
 .../ignite/examples/binary/EmployeeKey.java     |   3 +
 .../binary/ExampleBinaryNodeStartup.java        |  36 ---
 ...ComputeClientBinaryTaskExecutionExample.java |   6 +-
 .../CacheClientBinaryPutGetExample.java         |   6 +-
 .../datagrid/CacheClientBinaryQueryExample.java |   6 +-
 .../scalar/examples/ScalarCacheExample.scala    |  19 +-
 .../ignite/codegen/MessageCodeGenerator.java    |   1 +
 .../java/org/apache/ignite/IgniteBinary.java    |  15 +-
 .../java/org/apache/ignite/IgniteCache.java     |   3 +-
 .../apache/ignite/binary/BinaryIdMapper.java    |   3 +-
 .../org/apache/ignite/binary/BinaryObject.java  |   9 +-
 .../org/apache/ignite/binary/BinaryType.java    |   9 +-
 .../apache/ignite/cache/CacheTypeMetadata.java  |   2 +
 .../store/jdbc/CacheAbstractJdbcStore.java      |   2 +-
 .../cache/store/jdbc/CacheJdbcPojoStore.java    |   3 +-
 .../configuration/CacheConfiguration.java       |  36 ++-
 .../internal/GridEventConsumeHandler.java       |   5 +
 .../internal/GridMessageListenHandler.java      |   5 +
 .../apache/ignite/internal/IgniteKernal.java    |   2 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |   6 +-
 .../ignite/internal/NodeStoppingException.java  |  35 +++
 .../discovery/GridDiscoveryManager.java         |  19 +-
 .../internal/portable/BinaryFieldImpl.java      |   6 +-
 .../internal/portable/BinaryMarshaller.java     | 144 +++++++++++
 .../internal/portable/BinaryObjectEx.java       | 225 +----------------
 .../internal/portable/BinaryObjectExImpl.java   | 245 +++++++++++++++++++
 .../internal/portable/BinaryObjectImpl.java     |   2 +-
 .../portable/BinaryObjectOffheapImpl.java       |   2 +-
 .../internal/portable/BinaryTypeImpl.java       |   5 +
 .../portable/PortableClassDescriptor.java       |   2 +-
 .../internal/portable/PortableContext.java      |  35 ++-
 .../ignite/internal/portable/PortableUtils.java |   2 +-
 .../builder/BinaryObjectBuilderImpl.java        |   9 +-
 .../builder/PortableBuilderSerializer.java      |   4 +-
 .../processors/cache/CacheObjectContext.java    |   2 +-
 .../cache/GridCacheDeploymentManager.java       |   6 +-
 .../processors/cache/GridCacheEventManager.java |  38 ++-
 .../processors/cache/GridCacheIoManager.java    |   4 +
 .../processors/cache/GridCacheMessage.java      |   3 +-
 .../processors/cache/GridCacheMvccManager.java  |   3 +-
 .../processors/cache/GridCacheProcessor.java    |   4 +-
 .../processors/cache/IgniteCacheProxy.java      |  14 +-
 .../cache/affinity/GridCacheAffinityImpl.java   |   3 +-
 .../distributed/dht/GridDhtLockFuture.java      |  19 +-
 .../distributed/dht/GridDhtTxFinishFuture.java  |   1 +
 .../dht/GridPartitionedSingleGetFuture.java     |   2 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |   2 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   3 +-
 .../CacheObjectBinaryProcessorImpl.java         |  33 ++-
 .../cache/portable/IgniteBinaryImpl.java        |   9 +-
 .../cache/query/GridCacheSqlQuery.java          |  42 ++++
 .../cache/query/GridCacheTwoStepQuery.java      |  35 ++-
 .../continuous/CacheContinuousQueryEntry.java   |  50 +++-
 .../continuous/CacheContinuousQueryEvent.java   |   6 +-
 .../continuous/CacheContinuousQueryHandler.java |  32 ++-
 .../CacheContinuousQueryListener.java           |   5 +
 .../continuous/CacheContinuousQueryManager.java |  57 +++--
 .../cache/store/CacheOsStoreManager.java        |   2 +-
 .../transactions/IgniteTxLocalAdapter.java      |  29 ++-
 .../processors/cacheobject/NoOpBinary.java      |   8 +-
 .../continuous/GridContinuousHandler.java       |   5 +
 .../continuous/GridContinuousProcessor.java     |  10 +-
 .../StartRoutineDiscoveryMessage.java           |  13 +-
 .../cpp/PlatformCppConfigurationClosure.java    |   2 +-
 .../PlatformDotNetConfigurationClosure.java     |   2 +-
 .../processors/query/GridQueryProcessor.java    |  68 +++--
 .../processors/query/GridQueryProperty.java     |  45 ++++
 .../query/GridQueryTypeDescriptor.java          |   6 +
 .../visor/cache/VisorCacheConfiguration.java    |   4 +-
 .../cache/VisorCacheTypeFieldMetadata.java      |  30 ++-
 .../visor/cache/VisorCacheTypeMetadata.java     | 133 +++++++++-
 .../marshaller/portable/BinaryMarshaller.java   | 146 -----------
 .../META-INF/classnames-jdk.properties          |   2 +
 ...heJdbcPojoStoreBinaryMarshallerSelfTest.java |  85 +++++++
 ...JdbcPojoStorePortableMarshallerSelfTest.java |  85 -------
 .../IgniteClientReconnectCacheTest.java         |   7 +
 .../portable/BinaryFieldsAbstractSelfTest.java  |  13 +-
 .../portable/BinaryFieldsHeapSelfTest.java      |   4 +-
 .../portable/BinaryFieldsOffheapSelfTest.java   |   3 +-
 .../BinaryFooterOffsetsAbstractSelfTest.java    |   5 +-
 .../BinaryFooterOffsetsHeapSelfTest.java        |   4 +-
 .../BinaryFooterOffsetsOffheapSelfTest.java     |   3 +-
 .../portable/BinaryMarshallerSelfTest.java      |  17 +-
 .../BinaryObjectBuilderAdditionalSelfTest.java  |   7 +-
 .../portable/BinaryObjectBuilderSelfTest.java   | 102 +++++---
 .../GridPortableAffinityKeySelfTest.java        |  13 +-
 ...idPortableMarshallerCtxDisabledSelfTest.java |   1 -
 .../portable/GridPortableMetaDataSelfTest.java  |  11 +-
 .../portable/GridPortableWildcardsSelfTest.java |   1 -
 .../cache/GridCacheAbstractFullApiSelfTest.java |  97 ++++++++
 ...IgniteCacheAbstractExecutionContextTest.java |   2 +-
 ...eAbstractDataStructuresFailoverSelfTest.java |   3 +
 .../IgniteCollectionAbstractTest.java           |   3 +
 .../IgniteCacheSizeFailoverTest.java            |   7 +
 .../IgniteCachePutRetryAbstractSelfTest.java    |   4 +
 ...naryObjectsAbstractDataStreamerSelfTest.java |   2 +-
 ...aryObjectsAbstractMultiThreadedSelfTest.java |   2 +-
 .../GridCacheBinaryObjectsAbstractSelfTest.java |   2 +-
 ...ntNodeBinaryObjectMetadataMultinodeTest.java |  10 +-
 ...CacheClientNodeBinaryObjectMetadataTest.java |   6 +-
 .../GridCachePortableStoreAbstractSelfTest.java |   2 +-
 ...ridPortableCacheEntryMemorySizeSelfTest.java |   2 +-
 ...leDuplicateIndexObjectsAbstractSelfTest.java |   2 +-
 .../DataStreamProcessorPortableSelfTest.java    |   2 +-
 .../GridDataStreamerImplSelfTest.java           |   2 +-
 ...ridCacheAffinityRoutingPortableSelfTest.java |   2 +-
 .../GridCacheMemoryModePortableSelfTest.java    |   2 +-
 ...acheOffHeapTieredAtomicPortableSelfTest.java |   2 +-
 ...eapTieredEvictionAtomicPortableSelfTest.java |   2 +-
 ...heOffHeapTieredEvictionPortableSelfTest.java |   2 +-
 .../GridCacheOffHeapTieredPortableSelfTest.java |   2 +-
 ...sNearPartitionedByteArrayValuesSelfTest.java |   2 +-
 ...sPartitionedOnlyByteArrayValuesSelfTest.java |   2 +-
 .../PlatformComputeBinarizableArgTask.java      |   8 +-
 .../ignite/testframework/junits/IgniteMock.java |  39 ++-
 .../IgniteBinaryObjectsCacheTestSuite2.java     |  33 +++
 .../ignite/testsuites/IgniteCacheTestSuite.java |   4 +-
 .../IgnitePortableCacheFullApiTestSuite.java    |   2 +-
 .../IgnitePortableCacheTestSuite.java           |   2 +-
 .../query/h2/GridH2ResultSetIterator.java       |  19 +-
 .../processors/query/h2/IgniteH2Indexing.java   | 227 ++++++++++++++---
 .../query/h2/opt/GridH2RowDescriptor.java       |   5 +
 .../processors/query/h2/opt/GridH2Table.java    |  69 +++++-
 .../query/h2/opt/GridH2TreeIndex.java           |  98 +++++---
 .../query/h2/sql/GridSqlQuerySplitter.java      |  73 ++++--
 .../processors/query/h2/sql/GridSqlSelect.java  |  27 ++
 .../query/h2/twostep/GridMapQueryExecutor.java  |  17 +-
 .../query/h2/twostep/GridMergeIndex.java        |   7 +
 .../h2/twostep/GridMergeIndexUnsorted.java      |  14 ++
 .../h2/twostep/GridReduceQueryExecutor.java     | 117 ++++++---
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |  23 ++
 .../cache/IgniteCacheAbstractQuerySelfTest.java |  71 +++---
 ...niteCacheP2pUnmarshallingQueryErrorTest.java |   2 -
 ...PartitionedSnapshotEnabledQuerySelfTest.java |  28 +++
 .../h2/GridIndexingSpiAbstractSelfTest.java     |  19 ++
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 .../IgnitePortableCacheQueryTestSuite.java      |   2 +-
 .../Config/Compute/compute-grid1.xml            |   5 -
 .../Config/marshaller-explicit.xml              |   2 +-
 .../Examples/ExamplesTest.cs                    |   5 +-
 .../Messaging/MessagingExample.cs               |   9 +-
 .../test/resources/spring-ping-pong-partner.xml |  18 --
 144 files changed, 2234 insertions(+), 1082 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1eaa8c92/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/1eaa8c92/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------


[25/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1282
Commit: e4f6224fabc0561f6ff8de33a8a7721bca3370bc
Parents: 663e78d c2d4d1d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 12:37:50 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 12:37:50 2015 +0300

----------------------------------------------------------------------
 .../CacheDataStructuresManager.java             | 45 ++++++++++++--------
 .../datastructures/DataStructuresProcessor.java | 20 +--------
 ...gniteAtomicLongChangingTopologySelfTest.java | 30 ++++++++++---
 3 files changed, 53 insertions(+), 42 deletions(-)
----------------------------------------------------------------------



[27/50] [abbrv] ignite git commit: ignite-1732 Fixed test to catch IgniteClientDisconnectedException.

Posted by ag...@apache.org.
ignite-1732 Fixed test to catch IgniteClientDisconnectedException.


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

Branch: refs/heads/ignite-1282
Commit: 712e62bd241cecac969d022461fc048453b3db6b
Parents: c2d4d1d
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 13:12:55 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 13:12:55 2015 +0300

----------------------------------------------------------------------
 .../dht/IgniteAtomicLongChangingTopologySelfTest.java        | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/712e62bd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
index a8d5801..56bc760 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
@@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteAtomicLong;
+import org.apache.ignite.IgniteClientDisconnectedException;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.configuration.AtomicConfiguration;
@@ -214,7 +215,12 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
             while (System.currentTimeMillis() < stop) {
                 log.info("Iteration: " + iter++);
 
-                c.apply(ignite);
+                try {
+                    c.apply(ignite);
+                }
+                catch (IgniteClientDisconnectedException e) {
+                    e.reconnectFuture().get();
+                }
             }
 
             finished.set(true);


[29/50] [abbrv] ignite git commit: BinaryTypeImpl: Minor JavaDoc fix.

Posted by ag...@apache.org.
BinaryTypeImpl: Minor JavaDoc fix.


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

Branch: refs/heads/ignite-1282
Commit: e1db30a986aaecb823ed49505e55b376d2d08d2a
Parents: e4f6224
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 13:20:53 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 13:20:53 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/internal/portable/BinaryTypeImpl.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e1db30a9/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
index 9512cdb..f471af2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
@@ -77,7 +77,9 @@ public class BinaryTypeImpl implements BinaryType {
         return meta.isEnum();
     }
 
-    /** {@inheritDoc} */
+    /**
+     * @return Context.
+     */
     public PortableContext context() {
         return ctx;
     }


[09/50] [abbrv] ignite git commit: Merge branch 'ignite-1.5' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.5-cache-get-opts

Posted by ag...@apache.org.
Merge branch 'ignite-1.5' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.5-cache-get-opts


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

Branch: refs/heads/ignite-1282
Commit: 895760eed90651d618ec1450ead9d16246b851a4
Parents: 5407ea6 df9658b
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Nov 26 19:33:51 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Nov 26 19:33:51 2015 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  17 +++
 .../ComputeFibonacciContinuationExample.java    |  15 +-
 .../computegrid/ComputeTaskMapExample.java      |   6 +-
 .../computegrid/ComputeTaskSplitExample.java    |   4 +-
 .../examples/messaging/MessagingExample.java    |  18 +--
 .../examples/misc/springbean/spring-bean.xml    |   7 -
 .../testsuites/IgniteExamplesSelfTestSuite.java |   4 +-
 .../portable/GridPortableMarshaller.java        |   3 +
 .../internal/portable/PortableContext.java      |  10 +-
 .../ignite/internal/portable/PortableUtils.java |   7 +
 .../processors/cache/GridCacheEventManager.java |   4 +-
 .../distributed/dht/GridDhtLockFuture.java      |   1 +
 .../near/GridNearTxFinishFuture.java            |  14 +-
 .../processors/query/GridQueryProcessor.java    |   8 ++
 .../sharedfs/SharedFsCheckpointSpi.java         |  14 +-
 .../processors/cache/GridCacheStopSelfTest.java | 143 +++++++++++++++++--
 .../session/GridSessionCheckpointSelfTest.java  |  16 +++
 .../tcp/IgniteCacheSslStartStopSelfTest.java    |   1 +
 ...ObjectsCacheDataStructuresSelfTestSuite.java |  33 +++++
 ...BinaryObjectsCacheExpiryPolicyTestSuite.java |  34 +++++
 ...gniteBinaryObjectsCacheRestartTestSuite.java |  33 +++++
 .../IgniteBinaryObjectsCacheTestSuite3.java     |  33 +++++
 .../IgniteBinaryObjectsCacheTestSuite4.java     |  33 +++++
 ...IgniteBinaryObjectsComputeGridTestSuite.java |  33 +++++
 .../IgniteCacheFailoverTestSuite3.java          |   6 -
 .../IgniteCacheFailoverTestSuiteSsl.java        |  41 ++++++
 .../cache/IgniteCacheNoClassQuerySelfTest.java  | 122 ++++++++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 28 files changed, 601 insertions(+), 61 deletions(-)
----------------------------------------------------------------------



[36/50] [abbrv] ignite git commit: Fixed IgniteTxRemoteState to properly process invalid partitions.

Posted by ag...@apache.org.
Fixed IgniteTxRemoteState to properly process invalid partitions.


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

Branch: refs/heads/ignite-1282
Commit: 3080f61ae9ca1481d65f18f7a84f8bbc9d682f79
Parents: 722fe14
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 15:24:32 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 15:24:32 2015 +0300

----------------------------------------------------------------------
 .../cache/distributed/dht/GridDhtTxRemote.java  | 15 +-----------
 .../IgniteTxRemoteSingleStateImpl.java          | 16 ++++++-------
 .../cache/transactions/IgniteTxRemoteState.java |  5 ++++
 .../transactions/IgniteTxRemoteStateImpl.java   | 24 ++++++++++++++++++++
 4 files changed, 37 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3080f61a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
index e0929ad..85a5759 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
@@ -279,20 +279,7 @@ public class GridDhtTxRemote extends GridDistributedTxRemoteAdapter {
     @Override public void addInvalidPartition(GridCacheContext cacheCtx, int part) {
         super.addInvalidPartition(cacheCtx, part);
 
-        Map<IgniteTxKey, IgniteTxEntry> writeMap = txState.writeMap();
-
-        for (Iterator<IgniteTxEntry> it = writeMap.values().iterator(); it.hasNext();) {
-            IgniteTxEntry e = it.next();
-
-            GridCacheEntryEx cached = e.cached();
-
-            if (cached != null) {
-                if (cached.partition() == part)
-                    it.remove();
-            }
-            else if (cacheCtx.affinity().partition(e.key()) == part)
-                it.remove();
-        }
+        txState.invalidPartition(part);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/3080f61a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java
index 90af517..a68006b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java
@@ -65,15 +65,7 @@ public class IgniteTxRemoteSingleStateImpl extends IgniteTxRemoteStateAdapter {
 
     /** {@inheritDoc} */
     @Override public Set<IgniteTxKey> writeSet() {
-        if (entry != null) {
-            HashSet<IgniteTxKey> set = new HashSet<>(3, 0.75f);
-
-            set.add(entry.txKey());
-
-            return set;
-        }
-        else
-            return Collections.<IgniteTxKey>emptySet();
+        return entry != null ? Collections.singleton(entry.txKey()) : Collections.<IgniteTxKey>emptySet();
     }
 
     /** {@inheritDoc} */
@@ -113,6 +105,12 @@ public class IgniteTxRemoteSingleStateImpl extends IgniteTxRemoteStateAdapter {
     }
 
     /** {@inheritDoc} */
+    @Override public void invalidPartition(int part) {
+        if (entry != null && entry.context().affinity().partition(entry.key()) == part)
+            entry = null;
+    }
+
+    /** {@inheritDoc} */
     public String toString() {
         return S.toString(IgniteTxRemoteSingleStateImpl.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3080f61a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java
index b8290a1..77fc97e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java
@@ -31,4 +31,9 @@ public interface IgniteTxRemoteState extends IgniteTxState {
      * @param key Entry key.
      */
     public void clearEntry(IgniteTxKey key);
+
+    /**
+     * @param part Partition number.
+     */
+    public void invalidPartition(int part);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3080f61a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java
index 32bc646..3335b44 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java
@@ -18,8 +18,12 @@
 package org.apache.ignite.internal.processors.cache.transactions;
 
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -118,6 +122,26 @@ public class IgniteTxRemoteStateImpl extends IgniteTxRemoteStateAdapter {
     }
 
     /** {@inheritDoc} */
+    @Override public void invalidPartition(int part) {
+        if (writeMap != null) {
+            for (Iterator<IgniteTxEntry> it = writeMap.values().iterator(); it.hasNext();) {
+                IgniteTxEntry e = it.next();
+
+                GridCacheContext cacheCtx = e.context();
+
+                GridCacheEntryEx cached = e.cached();
+
+                if (cached != null) {
+                    if (cached.partition() == part)
+                        it.remove();
+                }
+                else if (cacheCtx.affinity().partition(e.key()) == part)
+                    it.remove();
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
     public String toString() {
         return S.toString(IgniteTxRemoteStateImpl.class, this);
     }


[47/50] [abbrv] ignite git commit: Fixed GridSessionCheckpointSelfTest.

Posted by ag...@apache.org.
Fixed GridSessionCheckpointSelfTest.


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

Branch: refs/heads/ignite-1282
Commit: a2cdc73afd54e02c86ede0d6e81ed280d4b0aff0
Parents: 6a95f88
Author: Tikhonov Nikolay <ti...@gmail.com>
Authored: Fri Nov 27 20:07:59 2015 +0300
Committer: Tikhonov Nikolay <ti...@gmail.com>
Committed: Fri Nov 27 22:33:02 2015 +0300

----------------------------------------------------------------------
 .../ignite/testframework/junits/IgniteTestResources.java | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a2cdc73a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
index 406318f..970002d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
@@ -26,7 +26,12 @@ import java.util.concurrent.ThreadPoolExecutor;
 import javax.management.MBeanServer;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.portable.BinaryCachingMetadataHandler;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
+import org.apache.ignite.internal.portable.PortableContext;
 import org.apache.ignite.internal.processors.resource.GridResourceProcessor;
+import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.marshaller.MarshallerContextTestImpl;
@@ -258,6 +263,12 @@ public class IgniteTestResources {
 
         marsh.setContext(new MarshallerContextTestImpl());
 
+        if (marsh instanceof BinaryMarshaller) {
+            PortableContext ctx = new PortableContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration());
+
+            IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, new IgniteConfiguration());
+        }
+
         return marsh;
     }
 }
\ No newline at end of file


[03/50] [abbrv] ignite git commit: Improved and enabled GridCacheStopSelfTest.

Posted by ag...@apache.org.
Improved and enabled GridCacheStopSelfTest.


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

Branch: refs/heads/ignite-1282
Commit: 722aacfdfb9a89ad8696c73f896c2e0643eaa86d
Parents: c584cca
Author: sboikov <sb...@gridgain.com>
Authored: Thu Nov 26 16:41:59 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Nov 26 16:41:59 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtLockFuture.java      |   1 +
 .../near/GridNearTxFinishFuture.java            |  14 +-
 .../processors/cache/GridCacheStopSelfTest.java | 143 +++++++++++++++++--
 3 files changed, 140 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/722aacfd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index 491ccd2..2b5d5a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -728,6 +728,7 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
      * Completeness callback.
      *
      * @param success {@code True} if lock was acquired.
+     * @param stopping {@code True} if node is stopping.
      * @return {@code True} if complete by this operation.
      */
     private boolean onComplete(boolean success, boolean stopping) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/722aacfd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index f76fc96..291c88a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -25,6 +25,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.NodeStoppingException;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -203,6 +204,9 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
 
                 boolean marked = tx.setRollbackOnly();
 
+                if (err instanceof NodeStoppingException)
+                    return super.onDone(null, err);
+
                 if (err instanceof IgniteTxRollbackCheckedException) {
                     if (marked) {
                         try {
@@ -241,13 +245,13 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
                     }
                 }
 
-            if (tx.onePhaseCommit()) {
-                boolean commit = this.commit && err == null;
+                if (tx.onePhaseCommit()) {
+                    boolean commit = this.commit && err == null;
 
-                finishOnePhase(commit);
+                    finishOnePhase(commit);
 
-                tx.tmFinish(commit);
-            }
+                    tx.tmFinish(commit);
+                }
 
                 if (super.onDone(tx0, err)) {
                     if (error() instanceof IgniteTxHeuristicCheckedException) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/722aacfd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java
index 59c899d..a34857f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java
@@ -21,36 +21,43 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicInteger;
 import javax.cache.CacheException;
+import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
+import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
 
 /**
  * Tests correct cache stopping.
  */
 public class GridCacheStopSelfTest extends GridCommonAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1393");
-    }
-
     /** */
     private static final String EXPECTED_MSG = "Cache has been closed or destroyed";
 
     /** */
+    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
     private boolean atomic;
 
     /** */
@@ -62,7 +69,7 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
 
         TcpDiscoverySpi disc = new TcpDiscoverySpi();
 
-        disc.setIpFinder(new TcpDiscoveryVmIpFinder(true));
+        disc.setIpFinder(ipFinder);
 
         cfg.setDiscoverySpi(disc);
 
@@ -70,6 +77,9 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
 
         ccfg.setCacheMode(replicated ? REPLICATED : PARTITIONED);
 
+        if (!replicated)
+            ccfg.setBackups(1);
+
         ccfg.setAtomicityMode(atomic ? ATOMIC : TRANSACTIONAL);
 
         ccfg.setSwapEnabled(true);
@@ -126,6 +136,112 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testStopMultithreaded() throws Exception {
+        try {
+            startGrid(0);
+
+            for (int i = 0; i < 5; i++) {
+                log.info("Iteration: " + i);
+
+                startGridsMultiThreaded(1, 3);
+
+                final AtomicInteger threadIdx = new AtomicInteger(0);
+
+                final IgniteInternalFuture<?> fut1 = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+                    @Override public Void call() throws Exception {
+                        int idx = threadIdx.getAndIncrement();
+
+                        IgniteKernal node = (IgniteKernal)ignite(idx % 3 + 1);
+
+                        IgniteCache<Integer, Integer> cache = node.cache(null);
+
+                        while (true) {
+                            try {
+                                cacheOperations(node, cache);
+                            }
+                            catch (Exception e) {
+                                if (node.isStopping())
+                                    break;
+                            }
+                        }
+
+                        return null;
+                    }
+                }, 20, "tx-node-stop-thread");
+
+                IgniteInternalFuture<?> fut2 = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+                    @Override public Void call() throws Exception {
+                        IgniteKernal node = (IgniteKernal)ignite(0);
+
+                        IgniteCache<Integer, Integer> cache = node.cache(null);
+
+                        while (!fut1.isDone()) {
+                            try {
+                                cacheOperations(node, cache);
+                            }
+                            catch (Exception ignore) {
+                                // No-op.
+                            }
+                        }
+
+                        return null;
+                    }
+                }, 2, "tx-thread");
+
+                Thread.sleep(3000);
+
+                final AtomicInteger nodeIdx = new AtomicInteger(1);
+
+                GridTestUtils.runMultiThreaded(new Callable<Void>() {
+                    @Override public Void call() throws Exception {
+                        int idx = nodeIdx.getAndIncrement();
+
+                        log.info("Stop node: " + idx);
+
+                        ignite(idx).close();
+
+                        return null;
+                    }
+                }, 3, "stop-node");
+
+                fut1.get();
+                fut2.get();
+            }
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @param node Node.
+     * @param cache Cache.
+     */
+    private void cacheOperations(Ignite node, IgniteCache<Integer, Integer> cache) {
+        ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt(1000);
+
+        cache.put(key, key);
+
+        cache.get(key);
+
+        try (Transaction tx = node.transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) {
+            cache.put(key, key);
+
+            tx.commit();
+        }
+
+        try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+            cache.put(key, key);
+
+            tx.commit();
+        }
+    }
+
+    /**
      * @param startTx If {@code true} starts transactions.
      * @throws Exception If failed.
      */
@@ -143,8 +259,10 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
 
             assertNotNull(cache);
 
-            assertEquals(atomic ? ATOMIC : TRANSACTIONAL, cache.getConfiguration(CacheConfiguration.class).getAtomicityMode());
-            assertEquals(replicated ? REPLICATED : PARTITIONED, cache.getConfiguration(CacheConfiguration.class).getCacheMode());
+            CacheConfiguration ccfg = cache.getConfiguration(CacheConfiguration.class);
+
+            assertEquals(atomic ? ATOMIC : TRANSACTIONAL, ccfg.getAtomicityMode());
+            assertEquals(replicated ? REPLICATED : PARTITIONED, ccfg.getCacheMode());
 
             Collection<IgniteInternalFuture<?>> putFuts = new ArrayList<>();
 
@@ -155,7 +273,9 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
                     @Override public Void call() throws Exception {
                         try {
                             if (startTx) {
-                                try (Transaction tx = grid(0).transactions().txStart()) {
+                                TransactionConcurrency concurrency = key % 2 == 0 ? OPTIMISTIC : PESSIMISTIC;
+
+                                try (Transaction tx = grid(0).transactions().txStart(concurrency, REPEATABLE_READ)) {
                                     cache.put(key, key);
 
                                     readyLatch.countDown();
@@ -173,12 +293,9 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
                                 cache.put(key, key);
                             }
                         }
-                        catch (CacheException | IgniteException e) {
+                        catch (CacheException | IgniteException | IllegalStateException e) {
                             log.info("Ignore error: " + e);
                         }
-                        catch (IllegalStateException e) {
-                            assertTrue(e.getMessage().startsWith(EXPECTED_MSG));
-                        }
 
                         return null;
                     }


[13/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1282
Commit: e706216a5b2540f9f258dd41e49e98b4fac575a0
Parents: 96efa38 19680d6
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 10:09:48 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 10:09:48 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/GridMultipleJobsSelfTest.java  | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------



[30/50] [abbrv] ignite git commit: IGNITE-2017: Added top-level platforms readme.

Posted by ag...@apache.org.
IGNITE-2017: Added top-level platforms readme.


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

Branch: refs/heads/ignite-1282
Commit: 280639319757723bf9f273546b7c0d2b79575d40
Parents: e1db30a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 13:21:40 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 13:21:40 2015 +0300

----------------------------------------------------------------------
 assembly/release-fabric-base.xml | 9 +++++++++
 modules/platforms/README.txt     | 6 ++++++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/28063931/assembly/release-fabric-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-fabric-base.xml b/assembly/release-fabric-base.xml
index d3e75ba..65903ee 100644
--- a/assembly/release-fabric-base.xml
+++ b/assembly/release-fabric-base.xml
@@ -69,6 +69,15 @@
     </files>
 
     <fileSets>
+        <!-- Move platforms readme. -->
+        <fileSet>
+            <directory>modules/platforms</directory>
+            <outputDirectory>/platforms</outputDirectory>
+            <includes>
+                <include>README.txt</include>
+            </includes>
+        </fileSet>
+
         <!-- Move .Net readme. -->
         <fileSet>
             <directory>modules/platforms/dotnet</directory>

http://git-wip-us.apache.org/repos/asf/ignite/blob/28063931/modules/platforms/README.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/README.txt b/modules/platforms/README.txt
new file mode 100644
index 0000000..6268a88
--- /dev/null
+++ b/modules/platforms/README.txt
@@ -0,0 +1,6 @@
+Apache Ignite Platforms
+==================================
+
+Contains integrations with other platforms, most notably:
+ * Apache Ignite.NET
+ * Apache Ignite C++
\ No newline at end of file


[05/50] [abbrv] ignite git commit: Minor change to release notes.

Posted by ag...@apache.org.
Minor change to release notes.


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

Branch: refs/heads/ignite-1282
Commit: ec8169675b4f7360becca0d8abbd300371238f52
Parents: f50f409
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Nov 26 17:57:48 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Nov 26 17:57:48 2015 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ec816967/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 70adf28..42258f7 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -3,10 +3,10 @@ Apache Ignite Release Notes
 
 Apache Ignite In-Memory Data Fabric 1.5
 ---------------------------------------
+* Ignite.NET: Initial Release.
+* Ignite C++: Initial Release.
 * Massive performance improvements for cache operations and SQL.
 * Added new binary cache object marshalling implementation.
-* Added Ignite.NET In-Memory Data Fabric.
-* Added Ignite.C++ In-Memory Data Fabric.
 * Added IgniteSemaphore data structure.
 * Added MQTT Streamer.
 * Fixed failover for continuous queries.


[48/50] [abbrv] ignite git commit: Fixed GridCacheBinaryObjects*Test's.

Posted by ag...@apache.org.
Fixed GridCacheBinaryObjects*Test's.


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

Branch: refs/heads/ignite-1282
Commit: 8a822d81adf3a903b84daf17a11e642309576528
Parents: a2cdc73
Author: Tikhonov Nikolay <ti...@gmail.com>
Authored: Fri Nov 27 22:30:06 2015 +0300
Committer: Tikhonov Nikolay <ti...@gmail.com>
Committed: Fri Nov 27 22:51:04 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/CacheObjectContext.java       | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8a822d81/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
index b99c99f..fe650f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
@@ -220,6 +220,8 @@ import org.apache.ignite.internal.util.typedef.F;
     private Collection<Object> unwrapPortables(ArrayList<Object> col, boolean keepPortable, boolean cpy) {
         int size = col.size();
 
+        col = new ArrayList<>(col);
+
         for (int i = 0; i < size; i++) {
             Object o = col.get(i);
 


[21/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1282
Commit: c2d4d1d2e180b0c22bf289166bb9b4ca902e257a
Parents: 41fe469 30c9b8d
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 12:33:33 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 12:33:33 2015 +0300

----------------------------------------------------------------------
 modules/flume/README.txt                        | 44 +++++---------------
 modules/yarn/pom.xml                            |  6 +--
 .../yarn/IgniteApplicationMasterSelfTest.java   | 11 ++++-
 3 files changed, 22 insertions(+), 39 deletions(-)
----------------------------------------------------------------------



[26/50] [abbrv] ignite git commit: Missed README & licenses

Posted by ag...@apache.org.
Missed README & licenses


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

Branch: refs/heads/ignite-1282
Commit: fa8e478d930b9ecb2c1534874f9993c1ae45c103
Parents: e4f6224
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Nov 27 13:10:27 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Nov 27 13:10:27 2015 +0300

----------------------------------------------------------------------
 modules/jms11/licenses/apache-2.0.txt     | 202 +++++++++++++++++++++++++
 modules/kafka/README.txt                  |  32 ++++
 modules/mqtt/licenses/apache-2.0.txt      | 202 +++++++++++++++++++++++++
 modules/zookeeper/licenses/apache-2.0.txt | 202 +++++++++++++++++++++++++
 4 files changed, 638 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fa8e478d/modules/jms11/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/jms11/licenses/apache-2.0.txt b/modules/jms11/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/jms11/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/fa8e478d/modules/kafka/README.txt
----------------------------------------------------------------------
diff --git a/modules/kafka/README.txt b/modules/kafka/README.txt
new file mode 100644
index 0000000..1eaf861
--- /dev/null
+++ b/modules/kafka/README.txt
@@ -0,0 +1,32 @@
+Apache Ignite Kafka Streamer Module
+------------------------
+
+Apache Ignite Kafka Streamer module provides streaming from Kafka to Ignite cache.
+
+To enable Kafka Streamer module when starting a standalone node, move 'optional/ignite-Kafka' folder to
+'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
+be added to classpath in this case.
+
+Importing Ignite Kafka Streamer Module In Maven Project
+-------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add JCL module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    ...
+    <dependencies>
+        ...
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-kafka</artifactId>
+            <version>${ignite.version}</version>
+        </dependency>
+        ...
+    </dependencies>
+    ...
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/fa8e478d/modules/mqtt/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/mqtt/licenses/apache-2.0.txt b/modules/mqtt/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/mqtt/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/fa8e478d/modules/zookeeper/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/zookeeper/licenses/apache-2.0.txt b/modules/zookeeper/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/zookeeper/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.


[38/50] [abbrv] ignite git commit: IGNITE-2009: Fixed leak in cached SQL queries.

Posted by ag...@apache.org.
IGNITE-2009: Fixed leak in cached SQL queries.


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

Branch: refs/heads/ignite-1282
Commit: fc10b3e40fadd7ad792aaea63fe270c6413c5068
Parents: 3080f61
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 16:48:01 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 16:48:01 2015 +0300

----------------------------------------------------------------------
 .../processors/query/h2/IgniteH2Indexing.java   | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fc10b3e4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index cc452c1..1437a16 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -49,6 +49,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import javax.cache.Cache;
 import javax.cache.CacheException;
@@ -255,7 +256,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                 set(c);
 
                 // Reset statement cache when new connection is created.
-                stmtCache.get().clear();
+                stmtCache.remove(Thread.currentThread());
             }
 
             return c;
@@ -280,12 +281,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     /** */
     private volatile GridKernalContext ctx;
 
-    /** */
-    private final ThreadLocal<StatementCache> stmtCache = new ThreadLocal<StatementCache>() {
-        @Override protected StatementCache initialValue() {
-            return new StatementCache(PREPARED_STMT_CACHE_SIZE);
-        }
-    };
+    /** Statement cache. */
+    private final ConcurrentHashMap<Thread, StatementCache> stmtCache = new ConcurrentHashMap<>();
 
     /** */
     private final GridBoundedConcurrentLinkedHashMap<T3<String, String, Boolean>, TwoStepCachedQuery> twoStepCache =
@@ -313,7 +310,18 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      */
     private PreparedStatement prepareStatement(Connection c, String sql, boolean useStmtCache) throws SQLException {
         if (useStmtCache) {
-            StatementCache cache = stmtCache.get();
+            Thread curThread = Thread.currentThread();
+
+            StatementCache cache = stmtCache.get(curThread);
+
+            if (cache == null) {
+                StatementCache cache0 = new StatementCache(PREPARED_STMT_CACHE_SIZE);
+
+                cache = stmtCache.putIfAbsent(curThread, cache0);
+
+                if (cache == null)
+                    cache = cache0;
+            }
 
             PreparedStatement stmt = cache.get(sql);
 


[40/50] [abbrv] ignite git commit: Disabled peer class loading in test.

Posted by ag...@apache.org.
Disabled peer class loading in test.


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

Branch: refs/heads/ignite-1282
Commit: 9b01be3ae237befe94574cfe32f3375ee45ff1ec
Parents: 3080f61
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 16:49:07 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 16:49:07 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java  | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9b01be3a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
index 56bc760..74cb9ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
@@ -93,6 +93,8 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
 
         cfg.setClientMode(client);
 
+        cfg.setPeerClassLoadingEnabled(false);
+
         return cfg;
     }
 


[11/50] [abbrv] ignite git commit: Disable shared memory for the hung test.

Posted by ag...@apache.org.
Disable shared memory for the hung test.


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

Branch: refs/heads/ignite-1282
Commit: 19680d6dbabe843f4db009c0aa5380178e62d5ef
Parents: de08cd5
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Nov 27 09:27:32 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Nov 27 09:27:32 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/GridMultipleJobsSelfTest.java  | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/19680d6d/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java
index d5f6287..a975e2c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridMultipleJobsSelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.lang.IgniteCallable;
 import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -97,6 +98,12 @@ public class GridMultipleJobsSelfTest extends GridCommonAbstractTest {
             c.setCacheConfiguration(cc);
         }
 
+        TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
+
+        commSpi.setSharedMemoryPort(-1);
+
+        c.setCommunicationSpi(commSpi);
+
         return c;
     }
 


[15/50] [abbrv] ignite git commit: fixing cache iteration small refactoring

Posted by ag...@apache.org.
fixing cache iteration
small refactoring


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

Branch: refs/heads/ignite-1282
Commit: a8edb1ed042b62fc160b497d2f4febb28abc686d
Parents: de08cd5
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Nov 27 11:33:51 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Nov 27 11:33:51 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 67 +++++---------------
 .../cache/GridCacheConcurrentMap.java           | 52 +++++----------
 .../distributed/dht/GridNoStorageCacheMap.java  |  4 +-
 .../distributed/near/GridNearCacheAdapter.java  |  4 +-
 .../cache/GridCacheConcurrentMapSelfTest.java   |  2 +-
 5 files changed, 37 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index c7467b2..00f65f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -296,7 +296,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      */
     @SuppressWarnings("OverriddenMethodCallDuringObjectConstruction")
     protected GridCacheAdapter(GridCacheContext<K, V> ctx, int startSize) {
-        this(ctx, new GridCacheConcurrentMap(ctx, startSize, 0.75F, null));
+        this(ctx, new GridCacheConcurrentMap(ctx, startSize, null));
     }
 
     /**
@@ -925,60 +925,25 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      */
     @Nullable private GridCacheEntryEx entry0(KeyCacheObject key, AffinityTopologyVersion topVer, boolean create,
         boolean touch) {
-        GridCacheMapEntry cur = map.getEntry(key);
+        GridTriple<GridCacheMapEntry> t = map.putEntryIfObsoleteOrAbsent(topVer, key, null, create);
 
-        if (cur == null || cur.obsolete()) {
-            GridTriple<GridCacheMapEntry> t = map.putEntryIfObsoleteOrAbsent(
-                topVer,
-                key,
-                null,
-                create);
+        GridCacheEntryEx cur = t.get1();
+        GridCacheEntryEx created = t.get2();
+        GridCacheEntryEx doomed = t.get3();
 
-            cur = t.get1();
+        if (doomed != null && ctx.events().isRecordable(EVT_CACHE_ENTRY_DESTROYED))
+            // Event notification.
+            ctx.events().addEvent(doomed.partition(), doomed.key(), locNodeId, (IgniteUuid)null, null,
+                EVT_CACHE_ENTRY_DESTROYED, null, false, null, false, null, null, null, true);
 
-            GridCacheEntryEx created = t.get2();
-            GridCacheEntryEx doomed = t.get3();
+        if (created != null) {
+            // Event notification.
+            if (ctx.events().isRecordable(EVT_CACHE_ENTRY_CREATED))
+                ctx.events().addEvent(created.partition(), created.key(), locNodeId, (IgniteUuid)null, null,
+                    EVT_CACHE_ENTRY_CREATED, null, false, null, false, null, null, null, true);
 
-            if (doomed != null && ctx.events().isRecordable(EVT_CACHE_ENTRY_DESTROYED))
-                // Event notification.
-                ctx.events().addEvent(doomed.partition(),
-                    doomed.key(),
-                    locNodeId,
-                    (IgniteUuid)null,
-                    null,
-                    EVT_CACHE_ENTRY_DESTROYED,
-                    null,
-                    false,
-                    null,
-                    false,
-                    null,
-                    null,
-                    null,
-                    true);
-
-            if (created != null) {
-                // Event notification.
-                if (ctx.events().isRecordable(EVT_CACHE_ENTRY_CREATED))
-                    ctx.events().addEvent(created.partition(),
-                        created.key(),
-                        locNodeId,
-                        (IgniteUuid)null,
-                        null,
-                        EVT_CACHE_ENTRY_CREATED,
-                        null,
-                        false,
-                        null,
-                        false,
-                        null,
-                        null,
-                        null,
-                        true);
-
-                if (touch)
-                    ctx.evicts().touch(
-                        cur,
-                        topVer);
-            }
+            if (touch)
+                ctx.evicts().touch(cur, topVer);
         }
 
         return cur;

http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
index 8293044..1c64387 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
@@ -237,6 +237,7 @@ public class GridCacheConcurrentMap {
      * @param ctx Cache context.
      * @param initCap the initial capacity. The implementation
      *      performs internal sizing to accommodate this many elements.
+     * @param factory Entry factory.
      * @param loadFactor  the load factor threshold, used to control resizing.
      *      Resizing may be performed when the average number of elements per
      *      bin exceeds this threshold.
@@ -248,8 +249,13 @@ public class GridCacheConcurrentMap {
      *      non-positive.
      */
     @SuppressWarnings({"unchecked"})
-    protected GridCacheConcurrentMap(GridCacheContext ctx, int initCap, float loadFactor,
-        int concurrencyLevel) {
+    protected GridCacheConcurrentMap(
+        GridCacheContext ctx,
+        int initCap,
+        GridCacheMapEntryFactory factory,
+        float loadFactor,
+        int concurrencyLevel
+    ) {
         this.ctx = ctx;
 
         if (!(loadFactor > 0) || initCap < 0 || concurrencyLevel <= 0)
@@ -289,6 +295,8 @@ public class GridCacheConcurrentMap {
 
         for (int i = 0; i < segs.length; ++i)
             segs[i] = new Segment(cap, loadFactor);
+
+        this.factory = factory;
     }
 
     /**
@@ -298,20 +306,16 @@ public class GridCacheConcurrentMap {
      * @param ctx Cache context.
      * @param initCap The implementation performs internal
      *      sizing to accommodate this many elements.
-     * @param loadFactor  the load factor threshold, used to control resizing.
-     *      Resizing may be performed when the average number of elements per
-     *      bin exceeds this threshold.
      * @param factory Entries factory.
      * @throws IllegalArgumentException if the initial capacity of
      *      elements is negative or the load factor is non-positive.
      */
-    public GridCacheConcurrentMap(GridCacheContext ctx,
+    public GridCacheConcurrentMap(
+        GridCacheContext ctx,
         int initCap,
-        float loadFactor,
-        @Nullable GridCacheMapEntryFactory factory) {
-        this(ctx, initCap, loadFactor, DFLT_CONCUR_LEVEL);
-
-        this.factory = factory;
+        @Nullable GridCacheMapEntryFactory factory
+    ) {
+        this(ctx, initCap, factory, DFLT_LOAD_FACTOR, DFLT_CONCUR_LEVEL);
     }
 
     /**
@@ -1425,13 +1429,6 @@ public class GridCacheConcurrentMap {
         }
 
         /**
-         * @return Number of reads.
-         */
-        long reads() {
-            return reads.sum();
-        }
-
-        /**
          * @return Header ID.
          */
         int id() {
@@ -1439,21 +1436,6 @@ public class GridCacheConcurrentMap {
         }
 
         /**
-         * @return {@code True} if {@code ID} is even.
-         */
-        boolean even() {
-            return id % 2 == 0;
-        }
-
-        /**
-         * @return {@code True} if {@code ID} is odd.
-         */
-        @SuppressWarnings("BadOddness")
-        boolean odd() {
-            return id % 2 == 1;
-        }
-
-        /**
          * @return Table.
          */
         GridCacheMapEntry[] table() {
@@ -2108,9 +2090,7 @@ public class GridCacheConcurrentMap {
             it.next();
 
             // Cached value.
-            V val = it.currentValue();
-
-            return val;
+            return it.currentValue();
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
index ef6612b..c6b969d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
@@ -41,7 +41,7 @@ public class GridNoStorageCacheMap extends GridCacheConcurrentMap {
      * @param ctx Cache context.
      */
     public GridNoStorageCacheMap(GridCacheContext ctx) {
-        super(ctx, 0, 0.75f, 1);
+        super(ctx, 0, null, 0.75f, 1);
     }
 
     /** {@inheritDoc} */
@@ -119,4 +119,4 @@ public class GridNoStorageCacheMap extends GridCacheConcurrentMap {
     @Override public String toString() {
         return S.toString(GridNoStorageCacheMap.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index b471486..c92e4e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -123,9 +123,9 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
 
     /** {@inheritDoc} */
     @Override public void onReconnected() {
-        map = new GridCacheConcurrentMap(ctx,
+        map = new GridCacheConcurrentMap(
+            ctx,
             ctx.config().getNearConfiguration().getNearStartSize(),
-            0.75F,
             map.getEntryFactory());
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
index 3381a34..1f494c0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
@@ -362,4 +362,4 @@ public class GridCacheConcurrentMapSelfTest extends GridCommonAbstractTest {
             assertEquals(0, local().map.iteratorMapSize());
         }
     }
-}
\ No newline at end of file
+}


[37/50] [abbrv] ignite git commit: IGNITE-2018 Refactored examples to use common model classes.

Posted by ag...@apache.org.
IGNITE-2018 Refactored examples to use common model classes.


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

Branch: refs/heads/ignite-1282
Commit: e519c2f5b1e05f886c861eb2bd05aec7cffa5bbc
Parents: 3080f61
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Nov 27 20:30:46 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Nov 27 20:30:46 2015 +0700

----------------------------------------------------------------------
 .../hibernate/CacheHibernatePersonStore.java    |   4 +-
 .../hibernate/CacheHibernateStoreExample.java   |   2 +-
 .../datagrid/store/hibernate/Person.hbm.xml     |   2 +-
 .../apache/ignite/examples/binary/Address.java  |  72 ---------
 .../apache/ignite/examples/binary/Employee.java |  93 -----------
 .../ignite/examples/binary/EmployeeKey.java     |  93 -----------
 .../ignite/examples/binary/Organization.java    |  93 -----------
 .../examples/binary/OrganizationType.java       |  32 ----
 ...ComputeClientBinaryTaskExecutionExample.java |   4 +-
 .../CacheClientBinaryPutGetExample.java         |   6 +-
 .../datagrid/CacheClientBinaryQueryExample.java |  22 +--
 .../examples/datagrid/CacheQueryExample.java    | 161 ++++---------------
 .../ignite/examples/datagrid/store/Person.java  | 154 ------------------
 .../store/auto/CacheAutoStoreExample.java       |   4 +-
 .../auto/CacheAutoStoreLoadDataExample.java     |   4 +-
 .../datagrid/store/auto/CacheConfig.java        |   6 +-
 .../store/dummy/CacheDummyPersonStore.java      |  12 +-
 .../store/dummy/CacheDummyStoreExample.java     |   4 +-
 .../store/jdbc/CacheJdbcPersonStore.java        |  18 +--
 .../store/jdbc/CacheJdbcStoreExample.java       |   4 +-
 .../store/spring/CacheSpringPersonStore.java    |  10 +-
 .../store/spring/CacheSpringStoreExample.java   |   4 +-
 .../ignite/examples/model/Organization.java     |  55 +++++++
 .../apache/ignite/examples/model/Person.java    | 120 ++++++++++++++
 .../ignite/examples/model/binary/Address.java   |  72 +++++++++
 .../ignite/examples/model/binary/Employee.java  |  93 +++++++++++
 .../examples/model/binary/EmployeeKey.java      |  93 +++++++++++
 .../examples/model/binary/Organization.java     |  93 +++++++++++
 .../examples/model/binary/OrganizationType.java |  32 ++++
 .../examples/ScalarCacheQueryExample.scala      |  66 ++------
 30 files changed, 651 insertions(+), 777 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
index d040b88..ade5d18 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
@@ -24,7 +24,7 @@ import javax.cache.integration.CacheWriterException;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.CacheStoreAdapter;
 import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.lang.IgniteBiInClosure;
 import org.apache.ignite.resources.CacheStoreSessionResource;
 import org.hibernate.HibernateException;
@@ -107,7 +107,7 @@ public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> {
                 for (Object obj : list) {
                     Person person = (Person)obj;
 
-                    clo.apply(person.getId(), person);
+                    clo.apply(person.id, person);
 
                     cnt++;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
index f993d81..71c4f68 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
@@ -29,7 +29,7 @@ import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreSessionListene
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
 import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.transactions.Transaction;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
index 035ab98..1314b71 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
@@ -23,7 +23,7 @@
         "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
 
 <hibernate-mapping default-access="field">
-    <class name="org.apache.ignite.examples.datagrid.store.Person" table="PERSONS">
+    <class name="org.apache.ignite.examples.model.Person" table="PERSONS">
         <!-- ID. -->
         <id name="id"/>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/Address.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/Address.java b/examples/src/main/java/org/apache/ignite/examples/binary/Address.java
deleted file mode 100644
index 76d8774..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/Address.java
+++ /dev/null
@@ -1,72 +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.examples.binary;
-
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-
-/**
- * Employee address.
- * <p>
- * This class implements {@link org.apache.ignite.binary.Binarylizable} only for example purposes,
- * in order to show how to customize serialization and deserialization of
- * binary objects.
- */
-public class Address implements Binarylizable {
-    /** Street. */
-    private String street;
-
-    /** ZIP code. */
-    private int zip;
-
-    /**
-     * Required for binary deserialization.
-     */
-    public Address() {
-        // No-op.
-    }
-
-    /**
-     * @param street Street.
-     * @param zip ZIP code.
-     */
-    public Address(String street, int zip) {
-        this.street = street;
-        this.zip = zip;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
-        writer.writeString("street", street);
-        writer.writeInt("zip", zip);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
-        street = reader.readString("street");
-        zip = reader.readInt("zip");
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Address [street=" + street +
-            ", zip=" + zip + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/Employee.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/Employee.java b/examples/src/main/java/org/apache/ignite/examples/binary/Employee.java
deleted file mode 100644
index 744b44f..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/Employee.java
+++ /dev/null
@@ -1,93 +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.examples.binary;
-
-import java.util.Collection;
-
-/**
- * This class represents employee object.
- */
-public class Employee {
-    /** Name. */
-    private String name;
-
-    /** Salary. */
-    private long salary;
-
-    /** Address. */
-    private Address address;
-
-    /** Departments. */
-    private Collection<String> departments;
-
-    /**
-     * Required for binary deserialization.
-     */
-    public Employee() {
-        // No-op.
-    }
-
-    /**
-     * @param name Name.
-     * @param salary Salary.
-     * @param address Address.
-     * @param departments Departments.
-     */
-    public Employee(String name, long salary, Address address, Collection<String> departments) {
-        this.name = name;
-        this.salary = salary;
-        this.address = address;
-        this.departments = departments;
-    }
-
-    /**
-     * @return Name.
-     */
-    public String name() {
-        return name;
-    }
-
-    /**
-     * @return Salary.
-     */
-    public long salary() {
-        return salary;
-    }
-
-    /**
-     * @return Address.
-     */
-    public Address address() {
-        return address;
-    }
-
-    /**
-     * @return Departments.
-     */
-    public Collection<String> departments() {
-        return departments;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Employee [name=" + name +
-            ", salary=" + salary +
-            ", address=" + address +
-            ", departments=" + departments + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/binary/EmployeeKey.java
deleted file mode 100644
index 7614f2c..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/EmployeeKey.java
+++ /dev/null
@@ -1,93 +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.examples.binary;
-
-import org.apache.ignite.cache.affinity.AffinityKeyMapped;
-
-/**
- * This class represents key for employee object.
- * <p>
- * Used in query example to collocate employees
- * with their organizations.
- */
-public class EmployeeKey {
-    /** ID. */
-    private int id;
-
-    /** Organization ID. */
-    @AffinityKeyMapped
-    private int organizationId;
-
-    /**
-     * Required for binary deserialization.
-     */
-    public EmployeeKey() {
-        // No-op.
-    }
-
-    /**
-     * @param id ID.
-     * @param organizationId Organization ID.
-     */
-    public EmployeeKey(int id, int organizationId) {
-        this.id = id;
-        this.organizationId = organizationId;
-    }
-
-    /**
-     * @return ID.
-     */
-    public int id() {
-        return id;
-    }
-
-    /**
-     * @return Organization ID.
-     */
-    public int organizationId() {
-        return organizationId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        EmployeeKey key = (EmployeeKey)o;
-
-        return id == key.id && organizationId == key.organizationId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = id;
-
-        res = 31 * res + organizationId;
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "EmployeeKey [id=" + id +
-            ", organizationId=" + organizationId + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/Organization.java b/examples/src/main/java/org/apache/ignite/examples/binary/Organization.java
deleted file mode 100644
index b42bb27..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/Organization.java
+++ /dev/null
@@ -1,93 +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.examples.binary;
-
-import java.sql.Timestamp;
-
-/**
- * This class represents organization object.
- */
-public class Organization {
-    /** Name. */
-    private String name;
-
-    /** Address. */
-    private Address address;
-
-    /** Type. */
-    private OrganizationType type;
-
-    /** Last update time. */
-    private Timestamp lastUpdated;
-
-    /**
-     * Required for binary deserialization.
-     */
-    public Organization() {
-        // No-op.
-    }
-
-    /**
-     * @param name Name.
-     * @param address Address.
-     * @param type Type.
-     * @param lastUpdated Last update time.
-     */
-    public Organization(String name, Address address, OrganizationType type, Timestamp lastUpdated) {
-        this.name = name;
-        this.address = address;
-        this.type = type;
-        this.lastUpdated = lastUpdated;
-    }
-
-    /**
-     * @return Name.
-     */
-    public String name() {
-        return name;
-    }
-
-    /**
-     * @return Address.
-     */
-    public Address address() {
-        return address;
-    }
-
-    /**
-     * @return Type.
-     */
-    public OrganizationType type() {
-        return type;
-    }
-
-    /**
-     * @return Last update time.
-     */
-    public Timestamp lastUpdated() {
-        return lastUpdated;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Organization [name=" + name +
-            ", address=" + address +
-            ", type=" + type +
-            ", lastUpdated=" + lastUpdated + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/OrganizationType.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/binary/OrganizationType.java
deleted file mode 100644
index 6548210..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/OrganizationType.java
+++ /dev/null
@@ -1,32 +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.examples.binary;
-
-/**
- * Organization type enum.
- */
-public enum OrganizationType {
-    /** Non-profit organization. */
-    NON_PROFIT,
-
-    /** Private organization. */
-    PRIVATE,
-
-    /** Government organization. */
-    GOVERNMENT
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
index ba1c968..49f254a 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
@@ -22,8 +22,8 @@ import java.util.Arrays;
 import java.util.Collection;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.examples.binary.Address;
-import org.apache.ignite.examples.binary.Employee;
+import org.apache.ignite.examples.model.binary.Address;
+import org.apache.ignite.examples.model.binary.Employee;
 import org.apache.ignite.binary.BinaryObject;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
index e49c16a..c416501 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
@@ -28,9 +28,9 @@ import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.binary.Address;
-import org.apache.ignite.examples.binary.Organization;
-import org.apache.ignite.examples.binary.OrganizationType;
+import org.apache.ignite.examples.model.binary.Address;
+import org.apache.ignite.examples.model.binary.Organization;
+import org.apache.ignite.examples.model.binary.OrganizationType;
 import org.apache.ignite.binary.BinaryObject;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
index ed01eb9..34452e4 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
@@ -34,11 +34,11 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.cache.query.TextQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.binary.Address;
-import org.apache.ignite.examples.binary.Employee;
-import org.apache.ignite.examples.binary.EmployeeKey;
-import org.apache.ignite.examples.binary.Organization;
-import org.apache.ignite.examples.binary.OrganizationType;
+import org.apache.ignite.examples.model.binary.Address;
+import org.apache.ignite.examples.model.binary.Employee;
+import org.apache.ignite.examples.model.binary.EmployeeKey;
+import org.apache.ignite.examples.model.binary.Organization;
+import org.apache.ignite.examples.model.binary.OrganizationType;
 import org.apache.ignite.binary.BinaryObject;
 
 /**
@@ -204,14 +204,14 @@ public class CacheClientBinaryQueryExample {
      * @param cache Ignite cache.
      */
     private static void sqlJoinQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
-        SqlQuery<BinaryObject, BinaryObject> query = new SqlQuery<>(Employee.class,
+        SqlQuery<BinaryObject, BinaryObject> qry = new SqlQuery<>(Employee.class,
             "from Employee, \"" + ORGANIZATION_CACHE_NAME + "\".Organization as org " +
                 "where Employee.organizationId = org._key and org.name = ?");
 
         String organizationName = "GridGain";
 
         QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees =
-            cache.query(query.setArgs(organizationName));
+            cache.query(qry.setArgs(organizationName));
 
         System.out.println();
         System.out.println(">>> Employees working for " + organizationName + ':');
@@ -226,9 +226,9 @@ public class CacheClientBinaryQueryExample {
      * @param cache Ignite cache.
      */
     private static void sqlFieldsQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
-        SqlFieldsQuery query = new SqlFieldsQuery("select name, salary from Employee");
+        SqlFieldsQuery qry = new SqlFieldsQuery("select name, salary from Employee");
 
-        QueryCursor<List<?>> employees = cache.query(query);
+        QueryCursor<List<?>> employees = cache.query(qry);
 
         System.out.println();
         System.out.println(">>> Employee names and their salaries:");
@@ -243,9 +243,9 @@ public class CacheClientBinaryQueryExample {
      * @param cache Ignite cache.
      */
     private static void textQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
-        TextQuery<BinaryObject, BinaryObject> query = new TextQuery<>(Employee.class, "TX");
+        TextQuery<BinaryObject, BinaryObject> qry = new TextQuery<>(Employee.class, "TX");
 
-        QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees = cache.query(query);
+        QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees = cache.query(qry);
 
         System.out.println();
         System.out.println(">>> Employees living in Texas:");

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
index 8fba3f6..a593562 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
@@ -17,9 +17,7 @@
 
 package org.apache.ignite.examples.datagrid;
 
-import java.io.Serializable;
 import java.util.List;
-import java.util.UUID;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
@@ -31,10 +29,10 @@ import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.cache.query.TextQuery;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.cache.query.annotations.QueryTextField;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.model.Organization;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.lang.IgniteBiPredicate;
 
 /**
@@ -80,19 +78,19 @@ public class CacheQueryExample {
             System.out.println();
             System.out.println(">>> Cache query example started.");
 
-            CacheConfiguration<UUID, Organization> orgCacheCfg = new CacheConfiguration<>(ORG_CACHE);
+            CacheConfiguration<Long, Organization> orgCacheCfg = new CacheConfiguration<>(ORG_CACHE);
 
             orgCacheCfg.setCacheMode(CacheMode.PARTITIONED); // Default.
-            orgCacheCfg.setIndexedTypes(UUID.class, Organization.class);
+            orgCacheCfg.setIndexedTypes(Long.class, Organization.class);
 
-            CacheConfiguration<AffinityKey<UUID>, Person> personCacheCfg = new CacheConfiguration<>(PERSON_CACHE);
+            CacheConfiguration<AffinityKey<Long>, Person> personCacheCfg = new CacheConfiguration<>(PERSON_CACHE);
 
             personCacheCfg.setCacheMode(CacheMode.PARTITIONED); // Default.
             personCacheCfg.setIndexedTypes(AffinityKey.class, Person.class);
 
             try (
-                IgniteCache<UUID, Organization> orgCache = ignite.getOrCreateCache(orgCacheCfg);
-                IgniteCache<AffinityKey<UUID>, Person> personCache = ignite.getOrCreateCache(personCacheCfg)
+                IgniteCache<Long, Organization> orgCache = ignite.getOrCreateCache(orgCacheCfg);
+                IgniteCache<AffinityKey<Long>, Person> personCache = ignite.getOrCreateCache(personCacheCfg)
             ) {
                 // Populate cache.
                 initialize();
@@ -128,11 +126,11 @@ public class CacheQueryExample {
      * Example for scan query based on a predicate.
      */
     private static void scanQuery() {
-        IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+        IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
 
-        ScanQuery<AffinityKey<UUID>, Person> scan = new ScanQuery<>(
-            new IgniteBiPredicate<AffinityKey<UUID>, Person>() {
-                @Override public boolean apply(AffinityKey<UUID> key, Person person) {
+        ScanQuery<AffinityKey<Long>, Person> scan = new ScanQuery<>(
+            new IgniteBiPredicate<AffinityKey<Long>, Person>() {
+                @Override public boolean apply(AffinityKey<Long> key, Person person) {
                     return person.salary <= 1000;
                 }
             }
@@ -146,18 +144,18 @@ public class CacheQueryExample {
      * Example for SQL queries based on salary ranges.
      */
     private static void sqlQuery() {
-        IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+        IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
 
         // SQL clause which selects salaries based on range.
         String sql = "salary > ? and salary <= ?";
 
         // Execute queries for salary ranges.
         print("People with salaries between 0 and 1000 (queried with SQL query): ",
-            cache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, sql).
+            cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, sql).
                 setArgs(0, 1000)).getAll());
 
         print("People with salaries between 1000 and 2000 (queried with SQL query): ",
-            cache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, sql).
+            cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, sql).
                 setArgs(1000, 2000)).getAll());
     }
 
@@ -165,7 +163,7 @@ public class CacheQueryExample {
      * Example for SQL queries based on all employees working for a specific organization.
      */
     private static void sqlQueryWithJoin() {
-        IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+        IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
 
         // SQL clause query which joins on 2 types to select people for a specific organization.
         String joinSql =
@@ -175,11 +173,11 @@ public class CacheQueryExample {
 
         // Execute queries for find employees for different organizations.
         print("Following people are 'ApacheIgnite' employees: ",
-            cache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, joinSql).
+            cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, joinSql).
                 setArgs("ApacheIgnite")).getAll());
 
         print("Following people are 'Other' employees: ",
-            cache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, joinSql).
+            cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, joinSql).
                 setArgs("Other")).getAll());
     }
 
@@ -187,15 +185,15 @@ public class CacheQueryExample {
      * Example for TEXT queries using LUCENE-based indexing of people's resumes.
      */
     private static void textQuery() {
-        IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+        IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
 
         //  Query for all people with "Master Degree" in their resumes.
-        QueryCursor<Cache.Entry<AffinityKey<UUID>, Person>> masters =
-            cache.query(new TextQuery<AffinityKey<UUID>, Person>(Person.class, "Master"));
+        QueryCursor<Cache.Entry<AffinityKey<Long>, Person>> masters =
+            cache.query(new TextQuery<AffinityKey<Long>, Person>(Person.class, "Master"));
 
         // Query for all people with "Bachelor Degree" in their resumes.
-        QueryCursor<Cache.Entry<AffinityKey<UUID>, Person>> bachelors =
-            cache.query(new TextQuery<AffinityKey<UUID>, Person>(Person.class, "Bachelor"));
+        QueryCursor<Cache.Entry<AffinityKey<Long>, Person>> bachelors =
+            cache.query(new TextQuery<AffinityKey<Long>, Person>(Person.class, "Bachelor"));
 
         print("Following people have 'Master Degree' in their resumes: ", masters.getAll());
         print("Following people have 'Bachelor Degree' in their resumes: ", bachelors.getAll());
@@ -205,7 +203,7 @@ public class CacheQueryExample {
      * Example for SQL queries to calculate average salary for a specific organization.
      */
     private static void sqlQueryWithAggregation() {
-        IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+        IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
 
         // Calculate average of salary of all persons in ApacheIgnite.
         // Note that we also join on Organization cache as well.
@@ -226,7 +224,7 @@ public class CacheQueryExample {
      * fields instead of whole key-value pairs.
      */
     private static void sqlFieldsQuery() {
-        IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+        IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
 
         // Execute query to get names of all employees.
         QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery(
@@ -244,7 +242,7 @@ public class CacheQueryExample {
      * fields instead of whole key-value pairs.
      */
     private static void sqlFieldsQueryWithJoin() {
-        IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+        IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
 
         // Execute query to get names of all employees.
         String sql =
@@ -265,7 +263,7 @@ public class CacheQueryExample {
      * Populate cache with test data.
      */
     private static void initialize() {
-        IgniteCache<UUID, Organization> orgCache = Ignition.ignite().cache(ORG_CACHE);
+        IgniteCache<Long, Organization> orgCache = Ignition.ignite().cache(ORG_CACHE);
 
         // Organizations.
         Organization org1 = new Organization("ApacheIgnite");
@@ -274,7 +272,7 @@ public class CacheQueryExample {
         orgCache.put(org1.id, org1);
         orgCache.put(org2.id, org2);
 
-        IgniteCache<AffinityKey<UUID>, Person> personCache = Ignition.ignite().cache(PERSON_CACHE);
+        IgniteCache<AffinityKey<Long>, Person> personCache = Ignition.ignite().cache(PERSON_CACHE);
 
         // People.
         Person p1 = new Person(org1, "John", "Doe", 2000, "John Doe has Master Degree.");
@@ -320,109 +318,4 @@ public class CacheQueryExample {
         for (Object next : col)
             System.out.println(">>>     " + next);
     }
-
-    /**
-     * Person class.
-     */
-    private static class Person implements Serializable {
-        /** Person ID (indexed). */
-        @QuerySqlField(index = true)
-        private UUID id;
-
-        /** Organization ID (indexed). */
-        @QuerySqlField(index = true)
-        private UUID orgId;
-
-        /** First name (not-indexed). */
-        @QuerySqlField
-        private String firstName;
-
-        /** Last name (not indexed). */
-        @QuerySqlField
-        private String lastName;
-
-        /** Resume text (create LUCENE-based TEXT index for this field). */
-        @QueryTextField
-        private String resume;
-
-        /** Salary (indexed). */
-        @QuerySqlField(index = true)
-        private double salary;
-
-        /** Custom cache key to guarantee that person is always collocated with its organization. */
-        private transient AffinityKey<UUID> key;
-
-        /**
-         * Constructs person record.
-         *
-         * @param org Organization.
-         * @param firstName First name.
-         * @param lastName Last name.
-         * @param salary Salary.
-         * @param resume Resume text.
-         */
-        Person(Organization org, String firstName, String lastName, double salary, String resume) {
-            // Generate unique ID for this person.
-            id = UUID.randomUUID();
-
-            orgId = org.id;
-
-            this.firstName = firstName;
-            this.lastName = lastName;
-            this.resume = resume;
-            this.salary = salary;
-        }
-
-        /**
-         * Gets cache affinity key. Since in some examples person needs to be collocated with organization, we create
-         * custom affinity key to guarantee this collocation.
-         *
-         * @return Custom affinity key to guarantee that person is always collocated with organization.
-         */
-        public AffinityKey<UUID> key() {
-            if (key == null)
-                key = new AffinityKey<>(id, orgId);
-
-            return key;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return "Person [firstName=" + firstName +
-                ", lastName=" + lastName +
-                ", id=" + id +
-                ", orgId=" + orgId +
-                ", resume=" + resume +
-                ", salary=" + salary + ']';
-        }
-    }
-
-    /**
-     * Organization class.
-     */
-    private static class Organization implements Serializable {
-        /** Organization ID (indexed). */
-        @QuerySqlField(index = true)
-        private UUID id;
-
-        /** Organization name (indexed). */
-        @QuerySqlField(index = true)
-        private String name;
-
-        /**
-         * Create organization.
-         *
-         * @param name Organization name.
-         */
-        Organization(String name) {
-            id = UUID.randomUUID();
-
-            this.name = name;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return "Organization [id=" + id + ", name=" + name + ']';
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java
deleted file mode 100644
index b54010f..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java
+++ /dev/null
@@ -1,154 +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.examples.datagrid.store;
-
-import java.io.Serializable;
-
-/**
- * Person definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 02/24/2015.
- */
-public class Person implements Serializable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Value for id. */
-    private long id;
-
-    /** Value for first name. */
-    private String firstName;
-
-    /** Value for last name. */
-    private String lastName;
-
-    /**
-     * Empty constructor.
-     */
-    public Person() {
-        // No-op.
-    }
-
-    /**
-     * Full constructor.
-     */
-    public Person(
-        long id,
-        String firstName,
-        String lastName
-    ) {
-        this.id = id;
-        this.firstName = firstName;
-        this.lastName = lastName;
-    }
-
-    /**
-     * Gets id.
-     *
-     * @return Value for id.
-     */
-    public long getId() {
-        return id;
-    }
-
-    /**
-     * Sets id.
-     *
-     * @param id New value for id.
-     */
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    /**
-     * Gets first name.
-     *
-     * @return Value for first name.
-     */
-    public String getFirstName() {
-        return firstName;
-    }
-
-    /**
-     * Sets first name.
-     *
-     * @param firstName New value for first name.
-     */
-    public void setFirstName(String firstName) {
-        this.firstName = firstName;
-    }
-
-    /**
-     * Gets last name.
-     *
-     * @return Value for last name.
-     */
-    public String getLastName() {
-        return lastName;
-    }
-
-    /**
-     * Sets last name.
-     *
-     * @param lastName New value for last name.
-     */
-    public void setLastName(String lastName) {
-        this.lastName = lastName;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (!(o instanceof Person))
-            return false;
-
-        Person that = (Person)o;
-
-        if (id != that.id)
-            return false;
-
-        if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null)
-            return false;
-
-        if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null)
-            return false;
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = (int)(id ^ (id >>> 32));
-
-        res = 31 * res + (firstName != null ? firstName.hashCode() : 0);
-
-        res = 31 * res + (lastName != null ? lastName.hashCode() : 0);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Person [id=" + id +
-            ", firstName=" + firstName +
-            ", lastName=" + lastName +
-            "]";
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
index f8cd4dd..37a31d7 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
@@ -24,7 +24,7 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore;
 import org.apache.ignite.examples.ExampleNodeStartup;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.transactions.Transaction;
 
 /**
@@ -85,4 +85,4 @@ public class CacheAutoStoreExample {
             }
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
index f0f9feb..63a8c6f 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
@@ -25,7 +25,7 @@ import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
 import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 
 /**
  * Demonstrates how to load data from database.
@@ -82,4 +82,4 @@ public class CacheAutoStoreLoadDataExample {
             }
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
index 1eb7cd2..3b38aeb 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
@@ -26,7 +26,7 @@ import org.apache.ignite.cache.CacheTypeMetadata;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.h2.jdbcx.JdbcConnectionPool;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -59,7 +59,7 @@ public class CacheConfig {
         meta.setDatabaseTable("PERSON");
 
         meta.setKeyType("java.lang.Long");
-        meta.setValueType("org.apache.ignite.examples.datagrid.store.Person");
+        meta.setValueType("org.apache.ignite.examples.model.Person");
 
         meta.setKeyFields(Collections.singletonList(new CacheTypeFieldMetadata("ID", Types.BIGINT, "id", Long.class)));
 
@@ -78,4 +78,4 @@ public class CacheConfig {
 
         return cfg;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
index f85e92b..6c0fecb 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
@@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.cache.store.CacheStoreAdapter;
 import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.lang.IgniteBiInClosure;
 import org.apache.ignite.resources.CacheNameResource;
 import org.apache.ignite.resources.CacheStoreSessionResource;
@@ -85,7 +85,7 @@ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> {
 
         System.out.println(">>> Store loadCache for entry count: " + cnt);
 
-        for (int i = 0; i < cnt; i++) {
+        for (long i = 0; i < cnt; i++) {
             // Generate dummy person on the fly.
             Person p = new Person(i, "first-" + i, "last-" + 1);
 
@@ -93,13 +93,13 @@ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> {
             // but we check if local node is primary or backup anyway just to demonstrate that we can.
             // Ideally, partition ID of a key would be stored  in the database and only keys
             // for partitions that belong on this node would be loaded from database.
-            if (ignite.affinity(cacheName).isPrimaryOrBackup(ignite.cluster().localNode(), p.getId())) {
+            if (ignite.affinity(cacheName).isPrimaryOrBackup(ignite.cluster().localNode(), p.id)) {
                 // Update dummy database.
                 // In real life data would be loaded from database.
-                dummyDB.put(p.getId(), p);
+                dummyDB.put(p.id, p);
 
                 // Pass data to cache.
-                clo.apply(p.getId(), p);
+                clo.apply(p.id, p);
             }
         }
     }
@@ -110,4 +110,4 @@ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> {
     @Nullable private Transaction transaction() {
         return ses != null ? ses.transaction() : null;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
index 20e6b8f..a631df3 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
@@ -26,7 +26,7 @@ import org.apache.ignite.Ignition;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
 import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.transactions.Transaction;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -130,4 +130,4 @@ public class CacheDummyStoreExample {
 
         System.out.println("Read value after commit: " + cache.get(id));
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
index e0ea13a..6ba181e 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
@@ -29,7 +29,7 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.CacheStoreAdapter;
 import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.lang.IgniteBiInClosure;
 import org.apache.ignite.resources.CacheStoreSessionResource;
 import org.h2.jdbcx.JdbcConnectionPool;
@@ -107,9 +107,9 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
             // Some databases would allow these to be done in one 'upsert' operation.
             try (PreparedStatement st = conn.prepareStatement(
                 "update PERSONS set firstName = ?, lastName = ? where id = ?")) {
-                st.setString(1, val.getFirstName());
-                st.setString(2, val.getLastName());
-                st.setLong(3, val.getId());
+                st.setString(1, val.firstName);
+                st.setString(2, val.lastName);
+                st.setLong(3, val.id);
 
                 updated = st.executeUpdate();
             }
@@ -118,9 +118,9 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
             if (updated == 0) {
                 try (PreparedStatement st = conn.prepareStatement(
                     "insert into PERSONS (id, firstName, lastName) values (?, ?, ?)")) {
-                    st.setLong(1, val.getId());
-                    st.setString(2, val.getFirstName());
-                    st.setString(3, val.getLastName());
+                    st.setLong(1, val.id);
+                    st.setString(2, val.firstName);
+                    st.setString(3, val.lastName);
 
                     st.executeUpdate();
                 }
@@ -166,7 +166,7 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
             while (rs.next()) {
                 Person person = new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
 
-                clo.apply(person.getId(), person);
+                clo.apply(person.id, person);
 
                 cnt++;
             }
@@ -177,4 +177,4 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
             throw new CacheLoaderException("Failed to load values from cache store.", e);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
index 9d3014f..55ad5df 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
@@ -29,7 +29,7 @@ import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
 import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.transactions.Transaction;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -144,4 +144,4 @@ public class CacheJdbcStoreExample {
 
         System.out.println("Read value after commit: " + cache.get(id));
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
index 7a0ea33..0029890 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
@@ -26,7 +26,7 @@ import javax.sql.DataSource;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.lang.IgniteBiInClosure;
 import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -92,11 +92,11 @@ public class CacheSpringPersonStore extends CacheStoreAdapter<Long, Person> {
         System.out.println(">>> Store write [key=" + key + ", val=" + val + ']');
 
         int updated = jdbcTemplate.update("update PERSONS set firstName = ?, lastName = ? where id = ?",
-            val.getFirstName(), val.getLastName(), val.getId());
+            val.firstName, val.lastName, val.id);
 
         if (updated == 0) {
             jdbcTemplate.update("insert into PERSONS (id, firstName, lastName) values (?, ?, ?)",
-                val.getId(), val.getFirstName(), val.getLastName());
+                val.id, val.firstName, val.lastName);
         }
     }
 
@@ -120,7 +120,7 @@ public class CacheSpringPersonStore extends CacheStoreAdapter<Long, Person> {
             @Override public void processRow(ResultSet rs) throws SQLException {
                 Person person = new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
 
-                clo.apply(person.getId(), person);
+                clo.apply(person.id, person);
 
                 cnt.incrementAndGet();
             }
@@ -128,4 +128,4 @@ public class CacheSpringPersonStore extends CacheStoreAdapter<Long, Person> {
 
         System.out.println(">>> Loaded " + cnt + " values into cache.");
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
index 16437da..273ea1c 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
@@ -29,7 +29,7 @@ import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
 import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
 import org.apache.ignite.transactions.Transaction;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -144,4 +144,4 @@ public class CacheSpringStoreExample {
 
         System.out.println("Read value after commit: " + cache.get(id));
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Organization.java b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
new file mode 100644
index 0000000..3881719
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
@@ -0,0 +1,55 @@
+/*
+ * 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.examples.model;
+
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+
+import java.io.Serializable;
+import java.util.Random;
+
+/**
+ * Organization class.
+ */
+public class Organization implements Serializable {
+    /** */
+    private static final Random RND = new Random();
+
+    /** Organization ID (indexed). */
+    @QuerySqlField(index = true)
+    public Long id;
+
+    /** Organization name (indexed). */
+    @QuerySqlField(index = true)
+    public String name;
+
+    /**
+     * Create organization.
+     *
+     * @param name Organization name.
+     */
+    public Organization(String name) {
+        id = RND.nextLong();
+
+        this.name = name;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Organization [id=" + id + ", name=" + name + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/Person.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Person.java b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
new file mode 100644
index 0000000..616cf6a
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
@@ -0,0 +1,120 @@
+/*
+ * 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.examples.model;
+
+import org.apache.ignite.cache.affinity.AffinityKey;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.cache.query.annotations.QueryTextField;
+
+import java.io.Serializable;
+import java.util.Random;
+
+/**
+ * Person class.
+ */
+public class Person implements Serializable {
+    /** */
+    private static final Random RND = new Random();
+
+    /** Person ID (indexed). */
+    @QuerySqlField(index = true)
+    public Long id;
+
+    /** Organization ID (indexed). */
+    @QuerySqlField(index = true)
+    public Long orgId;
+
+    /** First name (not-indexed). */
+    @QuerySqlField
+    public String firstName;
+
+    /** Last name (not indexed). */
+    @QuerySqlField
+    public String lastName;
+
+    /** Resume text (create LUCENE-based TEXT index for this field). */
+    @QueryTextField
+    public String resume;
+
+    /** Salary (indexed). */
+    @QuerySqlField(index = true)
+    public double salary;
+
+    /** Custom cache key to guarantee that person is always collocated with its organization. */
+    private transient AffinityKey<Long> key;
+
+    /**
+     * Constructs person record.
+     *
+     * @param org       Organization.
+     * @param firstName First name.
+     * @param lastName  Last name.
+     * @param salary    Salary.
+     * @param resume    Resume text.
+     */
+    public Person(Organization org, String firstName, String lastName, double salary, String resume) {
+        // Generate unique ID for this person.
+        id = RND.nextLong();
+
+        orgId = org.id;
+
+        this.firstName = firstName;
+        this.lastName = lastName;
+        this.resume = resume;
+        this.salary = salary;
+    }
+
+    /**
+     * Constructs person record.
+     *
+     * @param id Person ID.
+     * @param firstName First name.
+     * @param lastName Last name.
+     */
+    public Person(Long id, String firstName, String lastName) {
+        this.id = id;
+
+        this.firstName = firstName;
+        this.lastName = lastName;
+    }
+
+    /**
+     * Gets cache affinity key. Since in some examples person needs to be collocated with organization, we create
+     * custom affinity key to guarantee this collocation.
+     *
+     * @return Custom affinity key to guarantee that person is always collocated with organization.
+     */
+    public AffinityKey<Long> key() {
+        if (key == null)
+            key = new AffinityKey<>(id, orgId);
+
+        return key;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override public String toString() {
+        return "Person [firstName=" + firstName +
+                ", lastName=" + lastName +
+                ", id=" + id +
+                ", orgId=" + orgId +
+                ", resume=" + resume +
+                ", salary=" + salary + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java
new file mode 100644
index 0000000..2d17cb8
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java
@@ -0,0 +1,72 @@
+/*
+ * 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.examples.model.binary;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+
+/**
+ * Employee address.
+ * <p>
+ * This class implements {@link org.apache.ignite.binary.Binarylizable} only for example purposes,
+ * in order to show how to customize serialization and deserialization of
+ * binary objects.
+ */
+public class Address implements Binarylizable {
+    /** Street. */
+    private String street;
+
+    /** ZIP code. */
+    private int zip;
+
+    /**
+     * Required for binary deserialization.
+     */
+    public Address() {
+        // No-op.
+    }
+
+    /**
+     * @param street Street.
+     * @param zip ZIP code.
+     */
+    public Address(String street, int zip) {
+        this.street = street;
+        this.zip = zip;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+        writer.writeString("street", street);
+        writer.writeInt("zip", zip);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+        street = reader.readString("street");
+        zip = reader.readInt("zip");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Address [street=" + street +
+            ", zip=" + zip + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java
new file mode 100644
index 0000000..ad82065
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java
@@ -0,0 +1,93 @@
+/*
+ * 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.examples.model.binary;
+
+import java.util.Collection;
+
+/**
+ * This class represents employee object.
+ */
+public class Employee {
+    /** Name. */
+    private String name;
+
+    /** Salary. */
+    private long salary;
+
+    /** Address. */
+    private Address addr;
+
+    /** Departments. */
+    private Collection<String> departments;
+
+    /**
+     * Required for binary deserialization.
+     */
+    public Employee() {
+        // No-op.
+    }
+
+    /**
+     * @param name Name.
+     * @param salary Salary.
+     * @param addr Address.
+     * @param departments Departments.
+     */
+    public Employee(String name, long salary, Address addr, Collection<String> departments) {
+        this.name = name;
+        this.salary = salary;
+        this.addr = addr;
+        this.departments = departments;
+    }
+
+    /**
+     * @return Name.
+     */
+    public String name() {
+        return name;
+    }
+
+    /**
+     * @return Salary.
+     */
+    public long salary() {
+        return salary;
+    }
+
+    /**
+     * @return Address.
+     */
+    public Address address() {
+        return addr;
+    }
+
+    /**
+     * @return Departments.
+     */
+    public Collection<String> departments() {
+        return departments;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Employee [name=" + name +
+            ", salary=" + salary +
+            ", address=" + addr +
+            ", departments=" + departments + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java
new file mode 100644
index 0000000..20367ac
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java
@@ -0,0 +1,93 @@
+/*
+ * 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.examples.model.binary;
+
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
+
+/**
+ * This class represents key for employee object.
+ * <p>
+ * Used in query example to collocate employees
+ * with their organizations.
+ */
+public class EmployeeKey {
+    /** ID. */
+    private int id;
+
+    /** Organization ID. */
+    @AffinityKeyMapped
+    private int organizationId;
+
+    /**
+     * Required for binary deserialization.
+     */
+    public EmployeeKey() {
+        // No-op.
+    }
+
+    /**
+     * @param id ID.
+     * @param organizationId Organization ID.
+     */
+    public EmployeeKey(int id, int organizationId) {
+        this.id = id;
+        this.organizationId = organizationId;
+    }
+
+    /**
+     * @return ID.
+     */
+    public int id() {
+        return id;
+    }
+
+    /**
+     * @return Organization ID.
+     */
+    public int organizationId() {
+        return organizationId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        EmployeeKey key = (EmployeeKey)o;
+
+        return id == key.id && organizationId == key.organizationId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = id;
+
+        res = 31 * res + organizationId;
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "EmployeeKey [id=" + id +
+            ", organizationId=" + organizationId + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java
new file mode 100644
index 0000000..6b7aca4
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java
@@ -0,0 +1,93 @@
+/*
+ * 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.examples.model.binary;
+
+import java.sql.Timestamp;
+
+/**
+ * This class represents organization object.
+ */
+public class Organization {
+    /** Name. */
+    private String name;
+
+    /** Address. */
+    private Address addr;
+
+    /** Type. */
+    private OrganizationType type;
+
+    /** Last update time. */
+    private Timestamp lastUpdated;
+
+    /**
+     * Required for binary deserialization.
+     */
+    public Organization() {
+        // No-op.
+    }
+
+    /**
+     * @param name Name.
+     * @param addr Address.
+     * @param type Type.
+     * @param lastUpdated Last update time.
+     */
+    public Organization(String name, Address addr, OrganizationType type, Timestamp lastUpdated) {
+        this.name = name;
+        this.addr = addr;
+        this.type = type;
+        this.lastUpdated = lastUpdated;
+    }
+
+    /**
+     * @return Name.
+     */
+    public String name() {
+        return name;
+    }
+
+    /**
+     * @return Address.
+     */
+    public Address address() {
+        return addr;
+    }
+
+    /**
+     * @return Type.
+     */
+    public OrganizationType type() {
+        return type;
+    }
+
+    /**
+     * @return Last update time.
+     */
+    public Timestamp lastUpdated() {
+        return lastUpdated;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Organization [name=" + name +
+            ", address=" + addr +
+            ", type=" + type +
+            ", lastUpdated=" + lastUpdated + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java
new file mode 100644
index 0000000..69804c0
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.examples.model.binary;
+
+/**
+ * Organization type enum.
+ */
+public enum OrganizationType {
+    /** Non-profit organization. */
+    NON_PROFIT,
+
+    /** Private organization. */
+    PRIVATE,
+
+    /** Government organization. */
+    GOVERNMENT
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
index 1a42947..6d6c8c3 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
@@ -17,11 +17,13 @@
 
 package org.apache.ignite.scalar.examples
 
+import java.lang.{Long => JLong}
 import java.util._
 
 import org.apache.ignite.cache.CacheMode._
 import org.apache.ignite.cache.affinity.AffinityKey
 import org.apache.ignite.configuration.CacheConfiguration
+import org.apache.ignite.examples.model.{Person, Organization}
 import org.apache.ignite.scalar.scalar
 import org.apache.ignite.scalar.scalar._
 import org.apache.ignite.{Ignite, IgniteCache}
@@ -48,7 +50,7 @@ object ScalarCacheQueryExample {
      */
     def main(args: Array[String]) {
         scalar(CONFIG) {
-            val cache = createCache$(NAME, indexedTypes = Seq(classOf[UUID], classOf[Organization],
+            val cache = createCache$(NAME, indexedTypes = Seq(classOf[JLong], classOf[Organization],
                 classOf[AffinityKey[_]], classOf[Person]))
 
             try {
@@ -70,12 +72,12 @@ object ScalarCacheQueryExample {
         initialize()
 
         // Cache instance shortcut.
-        val cache = mkCache[AffinityKey[UUID], Person]
+        val cache = mkCache[AffinityKey[JLong], Person]
 
         // Using distributed queries for partitioned cache and local queries for replicated cache.
         // Since in replicated caches data is available on all nodes, including local one,
         // it is enough to just query the local node.
-        val prj = if (cache.getConfiguration(classOf[CacheConfiguration[AffinityKey[UUID], Person]]).getCacheMode == PARTITIONED)
+        val prj = if (cache.getConfiguration(classOf[CacheConfiguration[AffinityKey[JLong], Person]]).getCacheMode == PARTITIONED)
             ignite.cluster().forRemotes()
         else
             ignite.cluster().forLocal()
@@ -104,23 +106,23 @@ object ScalarCacheQueryExample {
         cache$(NAME).get.clear()
 
         // Organization cache projection.
-        val orgCache = mkCache[UUID, Organization]
+        val orgCache = mkCache[JLong, Organization]
 
         // Organizations.
-        val org1 = Organization("Ignite")
-        val org2 = Organization("Other")
+        val org1 = new Organization("Ignite")
+        val org2 = new Organization("Other")
 
         orgCache += (org1.id -> org1)
         orgCache += (org2.id -> org2)
 
         // Person cache projection.
-        val prnCache = mkCache[AffinityKey[UUID], Person]
+        val prnCache = mkCache[AffinityKey[JLong], Person]
 
         // People.
-        val p1 = Person(org1, "John", "Doe", 2000, "John Doe has Master Degree.")
-        val p2 = Person(org1, "Jane", "Doe", 1000, "Jane Doe has Bachelor Degree.")
-        val p3 = Person(org2, "John", "Smith", 1500, "John Smith has Bachelor Degree.")
-        val p4 = Person(org2, "Jane", "Smith", 2500, "Jane Smith has Master Degree.")
+        val p1 = new Person(org1, "John", "Doe", 2000, "John Doe has Master Degree.")
+        val p2 = new Person(org1, "Jane", "Doe", 1000, "Jane Doe has Bachelor Degree.")
+        val p3 = new Person(org2, "John", "Smith", 1500, "John Smith has Bachelor Degree.")
+        val p4 = new Person(org2, "Jane", "Smith", 2500, "Jane Smith has Master Degree.")
 
         // Note that in this example we use custom affinity key for Person objects
         // to ensure that all persons are collocated with their organizations.
@@ -148,45 +150,3 @@ object ScalarCacheQueryExample {
         }
     }
 }
-
-/**
- * Organization class.
- */
-private case class Organization(
-    @ScalarCacheQuerySqlField
-    name: String
-) {
-    /** Organization ID. */
-    @ScalarCacheQuerySqlField
-    val id = UUID.randomUUID
-}
-
-/**
- * Person class.
- */
-private case class Person(
-    org: Organization,
-    firstName: String,
-    lastName: String,
-    @ScalarCacheQuerySqlField
-    salary: Double,
-    @ScalarCacheQueryTextField
-    resume: String
-) {
-    /** Person ID. */
-    val id = UUID.randomUUID
-
-    /** Organization ID. */
-    @ScalarCacheQuerySqlField
-    val orgId = org.id
-
-    /** Affinity key for this person. */
-    val key = new AffinityKey[UUID](id, org.id)
-
-    /**
-     * `toString` implementation.
-     */
-    override def toString: String = {
-        firstName + " " + lastName + " [salary: " + salary + ", resume: " + resume + "]"
-    }
-}


[24/50] [abbrv] ignite git commit: IGNITE-1956: Added binary enums support.

Posted by ag...@apache.org.
IGNITE-1956: Added binary enums support.


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

Branch: refs/heads/ignite-1282
Commit: 663e78dc65dcf6d8369f13ef8bf6c4aeacb6299d
Parents: 30c9b8d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 12:37:27 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 12:37:27 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteBinary.java    |   9 +
 .../org/apache/ignite/binary/BinaryObject.java  |   8 +
 .../org/apache/ignite/binary/BinaryType.java    |   7 +
 .../ignite/binary/BinaryTypeConfiguration.java  |  21 +
 .../communication/GridIoMessageFactory.java     |   8 +-
 .../internal/portable/BinaryEnumObjectImpl.java | 311 +++++++++++++
 .../internal/portable/BinaryMetadata.java       |  16 +-
 .../internal/portable/BinaryObjectExImpl.java   |   5 +
 .../internal/portable/BinaryObjectImpl.java     |   3 -
 .../internal/portable/BinaryTypeImpl.java       |   9 +-
 .../internal/portable/BinaryWriteMode.java      |   3 +
 .../internal/portable/BinaryWriterExImpl.java   |  19 +
 .../portable/PortableClassDescriptor.java       |  23 +-
 .../internal/portable/PortableContext.java      |  39 +-
 .../ignite/internal/portable/PortableUtils.java | 147 +++++-
 .../builder/BinaryObjectBuilderImpl.java        |   2 +-
 .../builder/PortableBuilderSerializer.java      |  10 +-
 .../internal/processors/cache/CacheObject.java  |   3 +
 .../processors/cache/CacheObjectContext.java    |  19 +
 .../portable/CacheObjectBinaryProcessor.java    |  11 +-
 .../CacheObjectBinaryProcessorImpl.java         |  18 +-
 .../cache/portable/IgniteBinaryImpl.java        |  12 +
 .../processors/cacheobject/NoOpBinary.java      |   5 +
 .../platform/PlatformContextImpl.java           |  53 ++-
 .../transactions/PlatformTransactions.java      |   4 +-
 .../platform/utils/PlatformUtils.java           |   1 +
 .../PlatformDotNetBinaryTypeConfiguration.java  |  23 +
 .../internal/portable/BinaryEnumsSelfTest.java  | 446 +++++++++++++++++++
 .../portable/BinaryMarshallerSelfTest.java      |  37 +-
 .../platform/PlatformComputeEchoTask.java       |   4 +-
 .../IgnitePortableObjectsTestSuite.java         |   2 +
 .../impl/binary/binary_type_updater_impl.cpp    |   4 +-
 .../Binary/BinaryBuilderSelfTest.cs             |  97 ++--
 .../Binary/BinarySelfTest.cs                    |  48 +-
 .../Cache/CacheAbstractTest.cs                  |  17 +-
 .../Compute/ComputeApiTest.cs                   |   6 +
 .../Config/Compute/compute-grid1.xml            |   3 +-
 .../Config/native-client-test-cache-store.xml   |   1 +
 .../Services/ServiceProxyTest.cs                |  22 +-
 .../Apache.Ignite.Core.csproj                   |   5 +-
 .../Binary/BinaryTypeConfiguration.cs           |  16 +-
 .../dotnet/Apache.Ignite.Core/Binary/IBinary.cs | 136 ++++++
 .../Apache.Ignite.Core/Binary/IBinaryObject.cs  |  23 +-
 .../Apache.Ignite.Core/Binary/IBinaryType.cs    |  13 +
 .../Apache.Ignite.Core/Binary/IIgniteBinary.cs  | 120 -----
 .../dotnet/Apache.Ignite.Core/IIgnite.cs        |   6 +-
 .../Apache.Ignite.Core/Impl/Binary/Binary.cs    | 216 +++++++++
 .../Impl/Binary/BinaryEnum.cs                   | 134 ++++++
 .../Impl/Binary/BinaryFullTypeDescriptor.cs     |  14 +-
 .../Impl/Binary/BinaryObject.cs                 |  29 ++
 .../Impl/Binary/BinaryObjectBuilder.cs          |  44 +-
 .../Impl/Binary/BinaryReader.cs                 |  51 ++-
 .../Binary/BinarySurrogateTypeDescriptor.cs     |   6 +
 .../Impl/Binary/BinarySystemHandlers.cs         |  34 +-
 .../Impl/Binary/BinaryUtils.cs                  |  96 ++--
 .../Impl/Binary/BinaryWriter.cs                 | 104 +++--
 .../Impl/Binary/IBinaryTypeDescriptor.cs        |  50 +--
 .../Impl/Binary/IgniteBinary.cs                 | 192 --------
 .../Impl/Binary/Marshaller.cs                   |  88 ++--
 .../Impl/Binary/Metadata/BinaryType.cs          | 184 ++++----
 .../Impl/Binary/Metadata/BinaryTypeHolder.cs    |  34 +-
 .../Binary/Structure/BinaryStructureTracker.cs  |   2 +-
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |  11 +-
 .../Apache.Ignite.Core/Impl/IgniteProxy.cs      |   2 +-
 .../Apache.Ignite.Core/Impl/PlatformTarget.cs   |  11 +-
 .../Impl/Transactions/TransactionsImpl.cs       |   4 +-
 .../examples/Config/example-cache-query.xml     |   9 +-
 .../dotnet/examples/Config/example-cache.xml    |   9 +-
 68 files changed, 2354 insertions(+), 765 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/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 30db9d9..a1c656b 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
@@ -351,4 +351,13 @@ public interface IgniteBinary {
      * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
     public Collection<BinaryType> types() throws BinaryObjectException;
+
+    /**
+     * Create enum object.
+     *
+     * @param typeName Type name.
+     * @param ord Ordinal.
+     * @return Enum object.
+     */
+    public BinaryObject buildEnum(String typeName, int ord);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/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 249daab..f4afd8d 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
@@ -139,4 +139,12 @@ public interface BinaryObject extends Serializable, Cloneable {
      * @return Copy of this binary object.
      */
     public BinaryObject clone() throws CloneNotSupportedException;
+
+    /**
+     * Get ordinal for this enum object. Use {@link BinaryType#isEnum()} to check if object is of enum type.
+     *
+     * @return Ordinal.
+     * @throws BinaryObjectException If object is not enum.
+     */
+    public int enumOrdinal() throws BinaryObjectException;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
index debd7e5..f184a8c 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
@@ -72,4 +72,11 @@ public interface BinaryType {
      * @return Affinity key field name.
      */
     public String affinityKeyFieldName();
+
+    /**
+     * Check whether type represents enum or not.
+     *
+     * @return {@code True} if type is enum.
+     */
+    public boolean isEnum();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/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 d216866..a694eaf 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
@@ -38,6 +38,9 @@ public class BinaryTypeConfiguration {
     /** Serializer. */
     private BinarySerializer serializer;
 
+    /** Enum flag. */
+    private boolean isEnum;
+
     /**
      */
     public BinaryTypeConfiguration() {
@@ -105,6 +108,24 @@ public class BinaryTypeConfiguration {
         this.serializer = serializer;
     }
 
+    /**
+     * Gets whether this is enum type.
+     *
+     * @return {@code True} if enum.
+     */
+    public boolean isEnum() {
+        return isEnum;
+    }
+
+    /**
+     * Sets whether this is enum type.
+     *
+     * @param isEnum {@code True} if enum.
+     */
+    public void setEnum(boolean isEnum) {
+        this.isEnum = isEnum;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(BinaryTypeConfiguration.class, this, super.toString());

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 02bd5ec..c9b8e27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean;
 import org.apache.ignite.internal.managers.deployment.GridDeploymentRequest;
 import org.apache.ignite.internal.managers.deployment.GridDeploymentResponse;
 import org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage;
+import org.apache.ignite.internal.portable.BinaryEnumObjectImpl;
 import org.apache.ignite.internal.portable.BinaryObjectImpl;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheEntryInfoCollection;
@@ -714,7 +715,12 @@ public class GridIoMessageFactory implements MessageFactory {
 
                 break;
 
-            // [-3..118] - this
+            case 119:
+                msg = new BinaryEnumObjectImpl();
+
+                break;
+
+            // [-3..119] - this
             // [120..123] - DR
             // [-4..-22] - SQL
             default:

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
new file mode 100644
index 0000000..e13c076
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
@@ -0,0 +1,311 @@
+/*
+ * 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.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.util.typedef.internal.SB;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.nio.ByteBuffer;
+
+/**
+ * Binary enum object.
+ */
+public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, CacheObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Context. */
+    @GridDirectTransient
+    private PortableContext ctx;
+
+    /** Type ID. */
+    private int typeId;
+
+    /** Raw data. */
+    private String clsName;
+
+    /** Ordinal. */
+    private int ord;
+
+    /**
+     * {@link Externalizable} support.
+     */
+    public BinaryEnumObjectImpl() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param ctx Context.
+     * @param typeId Type ID.
+     * @param clsName Class name.
+     * @param ord Ordinal.
+     */
+    public BinaryEnumObjectImpl(PortableContext ctx, int typeId, @Nullable String clsName, int ord) {
+        assert ctx != null;
+
+        this.ctx = ctx;
+        this.typeId = typeId;
+        this.clsName = clsName;
+        this.ord = ord;
+    }
+
+    /**
+     * @return Class name.
+     */
+    @Nullable public String className() {
+        return clsName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int typeId() {
+        return typeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public BinaryType type() throws BinaryObjectException {
+        return ctx.metadata(typeId());
+    }
+
+    /** {@inheritDoc} */
+    @Override public <F> F field(String fieldName) throws BinaryObjectException {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean hasField(String fieldName) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public <T> T deserialize() throws BinaryObjectException {
+        Class cls = PortableUtils.resolveClass(ctx, typeId, clsName, null);
+
+        return BinaryEnumCache.get(cls, ord);
+    }
+
+    /** {@inheritDoc} */
+    @Override public BinaryObject clone() throws CloneNotSupportedException {
+        return (BinaryObject)super.clone();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int enumOrdinal() throws BinaryObjectException {
+        return ord;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return 31 * typeId + ord;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (obj != null && (obj instanceof BinaryEnumObjectImpl)) {
+            BinaryEnumObjectImpl other = (BinaryEnumObjectImpl)obj;
+
+            return typeId == other.typeId && ord == other.ord;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        // 1. Try deserializing the object.
+        try {
+            Object val = deserialize();
+
+            return new SB().a(val).toString();
+        }
+        catch (Exception e) {
+            // No-op.
+        }
+
+        // 2. Try getting meta.
+        BinaryType type;
+
+        try {
+            type = type();
+        }
+        catch (Exception e) {
+            type = null;
+        }
+
+        if (type != null) {
+            return type.typeName() + "[ordinal=" + ord  + ']';
+        }
+        else {
+            if (typeId == GridPortableMarshaller.UNREGISTERED_TYPE_ID)
+                return "BinaryEnum[clsName=" + clsName + ", ordinal=" + ord + ']';
+            else
+                return "BinaryEnum[typeId=" + typeId + ", ordinal=" + ord + ']';
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(ctx);
+
+        out.writeInt(typeId);
+        out.writeObject(clsName);
+        out.writeInt(ord);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        ctx = (PortableContext)in.readObject();
+
+        typeId = in.readInt();
+        clsName = (String)in.readObject();
+        ord = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean cpy) {
+        return deserialize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte[] valueBytes(CacheObjectContext cacheCtx) throws IgniteCheckedException {
+        return ctx.marshaller().marshal(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte cacheObjectType() {
+        return TYPE_BINARY;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isPlatformType() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheObject prepareForCache(CacheObjectContext ctx) {
+        return this;
+    }
+
+    /** {@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 byte directType() {
+        return 119;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte fieldsCount() {
+        return 3;
+    }
+
+    /** {@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.writeString("clsName", clsName))
+                    return false;
+
+                writer.incrementState();
+
+            case 1:
+                if (!writer.writeInt("ord", ord))
+                    return false;
+
+                writer.incrementState();
+
+            case 2:
+                if (!writer.writeInt("typeId", typeId))
+                    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:
+                clsName = reader.readString("clsName");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 1:
+                ord = reader.readInt("ord");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 2:
+                typeId = reader.readInt("typeId");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+        }
+
+        return reader.afterMessageRead(BinaryEnumObjectImpl.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
index a464d6e..8ba2e23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
@@ -52,6 +52,9 @@ public class BinaryMetadata implements Externalizable {
     /** Schemas associated with type. */
     private Collection<PortableSchema> schemas;
 
+    /** Whether this is enum type. */
+    private boolean isEnum;
+
     /**
      * For {@link Externalizable}.
      */
@@ -67,9 +70,10 @@ public class BinaryMetadata implements Externalizable {
      * @param fields Fields map.
      * @param affKeyFieldName Affinity key field name.
      * @param schemas Schemas.
+     * @param isEnum Enum flag.
      */
     public BinaryMetadata(int typeId, String typeName, @Nullable Map<String, Integer> fields,
-        @Nullable String affKeyFieldName, @Nullable Collection<PortableSchema> schemas) {
+        @Nullable String affKeyFieldName, @Nullable Collection<PortableSchema> schemas, boolean isEnum) {
         assert typeName != null;
 
         this.typeId = typeId;
@@ -77,6 +81,7 @@ public class BinaryMetadata implements Externalizable {
         this.fields = fields;
         this.affKeyFieldName = affKeyFieldName;
         this.schemas = schemas;
+        this.isEnum = isEnum;
     }
 
     /**
@@ -132,6 +137,13 @@ public class BinaryMetadata implements Externalizable {
     }
 
     /**
+     * @return {@code True} if this is enum type.
+     */
+    public boolean isEnum() {
+        return isEnum;
+    }
+
+    /**
      * Wrap metadata into binary type.
      *
      * @param ctx Portable context.
@@ -148,6 +160,7 @@ public class BinaryMetadata implements Externalizable {
         U.writeMap(out, fields);
         U.writeString(out, affKeyFieldName);
         U.writeCollection(out, schemas);
+        out.writeBoolean(isEnum);
     }
 
     /** {@inheritDoc} */
@@ -157,6 +170,7 @@ public class BinaryMetadata implements Externalizable {
         fields = U.readMap(in);
         affKeyFieldName = U.readString(in);
         schemas = U.readCollection(in);
+        isEnum = in.readBoolean();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
index 7497bd3..2ea71ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
@@ -66,6 +66,11 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
      */
     @Nullable public abstract <F> F field(int fieldId) throws BinaryObjectException;
 
+    /** {@inheritDoc} */
+    @Override public int enumOrdinal() throws BinaryObjectException {
+        throw new BinaryObjectException("Object is not enum.");
+    }
+
     /**
      * Get field by offset.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/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 f683ed9..87a03dc 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
@@ -66,9 +66,6 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.UUID;
 @IgniteCodeGeneratingFail // Fields arr and start should not be generated by MessageCodeGenerator.
 public final class BinaryObjectImpl extends BinaryObjectExImpl implements Externalizable, KeyCacheObject {
     /** */
-    public static final byte TYPE_BINARY = 100;
-
-    /** */
     private static final long serialVersionUID = 0L;
 
     /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
index c3fee7e..9512cdb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
@@ -72,9 +72,12 @@ public class BinaryTypeImpl implements BinaryType {
         return meta.affinityKeyFieldName();
     }
 
-    /**
-     * @return Portable context.
-     */
+    /** {@inheritDoc} */
+    @Override public boolean isEnum() {
+        return meta.isEnum();
+    }
+
+    /** {@inheritDoc} */
     public PortableContext context() {
         return ctx;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java
index a26b741..bd73ad0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java
@@ -141,6 +141,9 @@ public enum BinaryWriteMode {
     /** */
     ENUM(GridPortableMarshaller.ENUM),
 
+    /** Portable enum. */
+    PORTABLE_ENUM(GridPortableMarshaller.ENUM),
+
     /** */
     ENUM_ARR(GridPortableMarshaller.ENUM_ARR),
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
index ec47f57..9d1d037 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
@@ -803,6 +803,25 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
     }
 
     /**
+     * @param val Value.
+     */
+    void doWritePortableEnum(BinaryEnumObjectImpl val) {
+        assert val != null;
+
+        int typeId = val.typeId();
+
+        out.unsafeEnsure(1 + 4);
+
+        out.unsafeWriteByte(ENUM);
+        out.unsafeWriteInt(typeId);
+
+        if (typeId == UNREGISTERED_TYPE_ID)
+            doWriteString(val.className());
+
+        out.writeInt(val.enumOrdinal());
+    }
+
+    /**
      * @param val Array.
      */
     void doWriteEnumArray(@Nullable Object[] val) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/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 fa6ea3a..dba15f5 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
@@ -161,8 +161,12 @@ public class PortableClassDescriptor {
 
         if (excluded)
             mode = BinaryWriteMode.EXCLUSION;
-        else
-            mode = serializer != null ? BinaryWriteMode.PORTABLE : PortableUtils.mode(cls);
+        else {
+            if (cls == BinaryEnumObjectImpl.class)
+                mode = BinaryWriteMode.PORTABLE_ENUM;
+            else
+                mode = serializer != null ? BinaryWriteMode.PORTABLE : PortableUtils.mode(cls);
+        }
 
         switch (mode) {
             case P_BYTE:
@@ -205,6 +209,7 @@ public class PortableClassDescriptor {
             case MAP_ENTRY:
             case PORTABLE_OBJ:
             case ENUM:
+            case PORTABLE_ENUM:
             case ENUM_ARR:
             case CLASS:
             case EXCLUSION:
@@ -286,6 +291,13 @@ public class PortableClassDescriptor {
     }
 
     /**
+     * @return {@code True} if enum.
+     */
+    boolean isEnum() {
+        return mode == BinaryWriteMode.ENUM;
+    }
+
+    /**
      * @return Described class.
      */
     Class<?> describedClass() {
@@ -534,6 +546,11 @@ public class PortableClassDescriptor {
 
                 break;
 
+            case PORTABLE_ENUM:
+                writer.doWritePortableEnum((BinaryEnumObjectImpl)obj);
+
+                break;
+
             case ENUM_ARR:
                 writer.doWriteEnumArray((Object[])obj);
 
@@ -576,7 +593,7 @@ public class PortableClassDescriptor {
                                 PortableSchema newSchema = collector.schema();
 
                                 BinaryMetadata meta = new BinaryMetadata(typeId, typeName, collector.meta(),
-                                    affKeyFieldName, Collections.singleton(newSchema));
+                                    affKeyFieldName, Collections.singleton(newSchema), false);
 
                                 ctx.updateMetadata(typeId, meta);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/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 ab96ed1..ae0d940 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
@@ -117,6 +117,9 @@ public class PortableContext implements Externalizable {
     /** */
     private BinaryMetadataHandler metaHnd;
 
+    /** Actual marshaller. */
+    private BinaryMarshaller marsh;
+
     /** */
     private MarshallerContext marshCtx;
 
@@ -222,6 +225,13 @@ public class PortableContext implements Externalizable {
     }
 
     /**
+     * @return Marshaller.
+     */
+    public BinaryMarshaller marshaller() {
+        return marsh;
+    }
+
+    /**
      * @param marsh Portable marshaller.
      * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
@@ -229,6 +239,8 @@ public class PortableContext implements Externalizable {
         if (marsh == null)
             return;
 
+        this.marsh = marsh;
+
         marshCtx = marsh.getContext();
 
         BinaryConfiguration binaryCfg = cfg.getBinaryConfiguration();
@@ -293,16 +305,16 @@ public class PortableContext implements Externalizable {
 
                     for (String clsName0 : classesInPackage(pkgName))
                         descs.add(clsName0, idMapper, serializer, affFields.get(clsName0),
-                            true);
+                            typeCfg.isEnum(), true);
                 }
                 else
                     descs.add(clsName, idMapper, serializer, affFields.get(clsName),
-                        false);
+                        typeCfg.isEnum(), false);
             }
         }
 
         for (TypeDescriptor desc : descs.descriptors()) {
-            registerUserType(desc.clsName, desc.idMapper, desc.serializer, desc.affKeyFieldName);
+            registerUserType(desc.clsName, desc.idMapper, desc.serializer, desc.affKeyFieldName, desc.isEnum);
         }
 
         BinaryInternalIdMapper dfltMapper = BinaryInternalIdMapper.create(globalIdMapper);
@@ -535,7 +547,8 @@ public class PortableContext implements Externalizable {
 
         Collection<PortableSchema> schemas = desc.schema() != null ? Collections.singleton(desc.schema()) : null;
 
-        metaHnd.addMeta(typeId, new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, schemas).wrap(this));
+        metaHnd.addMeta(typeId, 
+            new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, schemas, desc.isEnum()).wrap(this));
 
         // perform put() instead of putIfAbsent() because "registered" flag might have been changed or class loader
         // might have reloaded described class.
@@ -628,7 +641,7 @@ public class PortableContext implements Externalizable {
      * @return Affinity field name or {@code null} if field name was not found.
      */
     private String affinityFieldName(Class cls) {
-        for (; cls != Object.class; cls = cls.getSuperclass()) {
+        for (; cls != Object.class && cls != null; cls = cls.getSuperclass()) {
             for (Field f : cls.getDeclaredFields()) {
                 if (f.getAnnotation(AffinityKeyMapped.class) != null)
                     return f.getName();
@@ -701,13 +714,15 @@ public class PortableContext implements Externalizable {
      * @param idMapper ID mapper.
      * @param serializer Serializer.
      * @param affKeyFieldName Affinity key field name.
+     * @param isEnum If enum.
      * @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)
+        @Nullable String affKeyFieldName,
+        boolean isEnum)
         throws BinaryObjectException {
         assert idMapper != null;
 
@@ -765,7 +780,7 @@ public class PortableContext implements Externalizable {
             descByCls.put(cls, desc);
         }
 
-        metaHnd.addMeta(id, new BinaryMetadata(id, typeName, fieldsMeta, affKeyFieldName, schemas).wrap(this));
+        metaHnd.addMeta(id, new BinaryMetadata(id, typeName, fieldsMeta, affKeyFieldName, schemas, isEnum).wrap(this));
     }
 
     /**
@@ -940,6 +955,7 @@ public class PortableContext implements Externalizable {
          * @param idMapper ID mapper.
          * @param serializer Serializer.
          * @param affKeyFieldName Affinity key field name.
+         * @param isEnum Enum flag.
          * @param canOverride Whether this descriptor can be override.
          * @throws org.apache.ignite.binary.BinaryObjectException If failed.
          */
@@ -947,12 +963,14 @@ public class PortableContext implements Externalizable {
             BinaryIdMapper idMapper,
             BinarySerializer serializer,
             String affKeyFieldName,
+            boolean isEnum,
             boolean canOverride)
             throws BinaryObjectException {
             TypeDescriptor desc = new TypeDescriptor(clsName,
                 idMapper,
                 serializer,
                 affKeyFieldName,
+                isEnum,
                 canOverride);
 
             TypeDescriptor oldDesc = descs.get(clsName);
@@ -989,6 +1007,9 @@ public class PortableContext implements Externalizable {
         /** Affinity key field name. */
         private String affKeyFieldName;
 
+        /** Enum flag. */
+        private boolean isEnum;
+
         /** Whether this descriptor can be override. */
         private boolean canOverride;
 
@@ -999,14 +1020,16 @@ public class PortableContext implements Externalizable {
          * @param idMapper ID mapper.
          * @param serializer Serializer.
          * @param affKeyFieldName Affinity key field name.
+         * @param isEnum Enum type.
          * @param canOverride Whether this descriptor can be override.
          */
         private TypeDescriptor(String clsName, BinaryIdMapper idMapper, BinarySerializer serializer,
-            String affKeyFieldName, boolean canOverride) {
+            String affKeyFieldName, boolean isEnum, boolean canOverride) {
             this.clsName = clsName;
             this.idMapper = idMapper;
             this.serializer = serializer;
             this.affKeyFieldName = affKeyFieldName;
+            this.isEnum = isEnum;
             this.canOverride = canOverride;
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index a83405d..e543c41 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -877,6 +877,16 @@ public class PortableUtils {
                 );
             }
 
+            // Check enum flag.
+            if (oldMeta.isEnum() != newMeta.isEnum()) {
+                if (oldMeta.isEnum())
+                    throw new BinaryObjectException("Binary type already registered as enum: " +
+                        newMeta.typeName());
+                else
+                    throw new BinaryObjectException("Binary type already registered as non-enum: " +
+                        newMeta.typeName());
+            }
+
             // Check and merge fields.
             boolean changed = false;
 
@@ -908,7 +918,7 @@ public class PortableUtils {
 
             // Return either old meta if no changes detected, or new merged meta.
             return changed ? new BinaryMetadata(oldMeta.typeId(), oldMeta.typeName(), mergedFields,
-                oldMeta.affinityKeyFieldName(), mergedSchemas) : oldMeta;
+                oldMeta.affinityKeyFieldName(), mergedSchemas, oldMeta.isEnum()) : oldMeta;
         }
     }
 
@@ -1314,6 +1324,37 @@ public class PortableUtils {
     }
 
     /**
+     * Read plain type.
+     *
+     * @param in Input stream.
+     * @return Plain type.
+     */
+    private static EnumType doReadEnumType(PortableInputStream in) {
+        int typeId = in.readInt();
+
+        if (typeId != UNREGISTERED_TYPE_ID)
+            return new EnumType(typeId, null);
+        else {
+            String clsName = doReadClassName(in);
+
+            return new EnumType(UNREGISTERED_TYPE_ID, clsName);
+        }
+    }
+
+    /**
+     * @param in Input stream.
+     * @return Class name.
+     */
+    private static String doReadClassName(PortableInputStream in) {
+        byte flag = in.readByte();
+
+        if (flag != STRING)
+            throw new BinaryObjectException("Failed to read class name [position=" + (in.position() - 1) + ']');
+
+        return doReadString(in);
+    }
+
+    /**
      * @param typeId Type id.
      * @return Value.
      */
@@ -1327,13 +1368,41 @@ public class PortableUtils {
         if (typeId != UNREGISTERED_TYPE_ID)
             cls = ctx.descriptorForTypeId(true, typeId, ldr).describedClass();
         else {
-            byte flag = in.readByte();
+            String clsName = doReadClassName(in);
+
+            try {
+                cls = U.forName(clsName, ldr);
+            }
+            catch (ClassNotFoundException e) {
+                throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
+            }
 
-            if (flag != STRING)
-                throw new BinaryObjectException("No class definition for typeId: " + typeId);
+            // forces registering of class by type id, at least locally
+            ctx.descriptorForClass(cls);
+        }
+
+        return cls;
+    }
+
+    /**
+     * Resolve the class.
+     *
+     * @param ctx Portable context.
+     * @param typeId Type ID.
+     * @param clsName Class name.
+     * @param ldr Class loaded.
+     * @return Resovled class.
+     */
+    public static Class resolveClass(PortableContext ctx, int typeId, @Nullable String clsName,
+        @Nullable ClassLoader ldr) {
+        Class cls;
 
-            String clsName = doReadString(in);
+        if (typeId == OBJECT_TYPE_ID)
+            return Object.class;
 
+        if (typeId != UNREGISTERED_TYPE_ID)
+            cls = ctx.descriptorForTypeId(true, typeId, ldr).describedClass();
+        else {
             try {
                 cls = U.forName(clsName, ldr);
             }
@@ -1349,6 +1418,43 @@ public class PortableUtils {
     }
 
     /**
+     * Read portable enum.
+     *
+     * @param in Input stream.
+     * @param ctx Portable context.
+     * @param type Plain type.
+     * @return Enum.
+     */
+    private static BinaryEnumObjectImpl doReadPortableEnum(PortableInputStream in, PortableContext ctx,
+        EnumType type) {
+        return new BinaryEnumObjectImpl(ctx, type.typeId, type.clsName, in.readInt());
+    }
+
+    /**
+     * Read portable enum array.
+     *
+     * @param in Input stream.
+     * @param ctx Portable context.
+     * @return Enum array.
+     */
+    private static Object[] doReadPortableEnumArray(PortableInputStream in, PortableContext ctx) {
+        int len = in.readInt();
+
+        Object[] arr = (Object[]) Array.newInstance(BinaryObject.class, len);
+
+        for (int i = 0; i < len; i++) {
+            byte flag = in.readByte();
+
+            if (flag == NULL)
+                arr[i] = null;
+            else
+                arr[i] = doReadPortableEnum(in, ctx, doReadEnumType(in));
+        }
+
+        return arr;
+    }
+
+    /**
      * Having target class in place we simply read ordinal and create final representation.
      *
      * @param cls Enum class.
@@ -1589,10 +1695,12 @@ public class PortableUtils {
                 return doReadPortableObject(in, ctx);
 
             case ENUM:
-                return doReadEnum(in, doReadClass(in, ctx, ldr));
+                return doReadPortableEnum(in, ctx, doReadEnumType(in));
 
             case ENUM_ARR:
-                return doReadEnumArray(in, ctx, ldr, doReadClass(in, ctx, ldr));
+                doReadEnumType(in); // Simply skip this part as we do not need it.
+
+                return doReadPortableEnumArray(in, ctx);
 
             case CLASS:
                 return doReadClass(in, ctx, ldr);
@@ -1843,4 +1951,29 @@ public class PortableUtils {
     public static int positionForHandle(PortableInputStream in) {
         return in.position() - 1;
     }
+
+    /**
+     * Enum type.
+     */
+    private static class EnumType {
+        /** Type ID. */
+        private final int typeId;
+
+        /** Class name. */
+        private final String clsName;
+
+        /**
+         * Constructor.
+         *
+         * @param typeId Type ID.
+         * @param clsName Class name.
+         */
+        public EnumType(int typeId, @Nullable String clsName) {
+            assert typeId != UNREGISTERED_TYPE_ID && clsName == null ||
+                typeId == UNREGISTERED_TYPE_ID && clsName != null;
+
+            this.typeId = typeId;
+            this.clsName = clsName;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
index d330c72..5c2c713 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
@@ -377,7 +377,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
                 PortableSchema curSchema = writer.currentSchema();
 
                 ctx.updateMetadata(typeId, new BinaryMetadata(typeId, typeName, fieldsMeta,
-                    ctx.affinityKeyFieldName(typeId), Collections.singleton(curSchema)));
+                    ctx.affinityKeyFieldName(typeId), Collections.singleton(curSchema), false));
 
                 schemaReg.addSchema(curSchema.schemaId(), curSchema);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
index ee7bd65..52f84c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
@@ -18,8 +18,10 @@
 package org.apache.ignite.internal.portable.builder;
 
 import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.internal.portable.BinaryMetadata;
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.BinaryObjectExImpl;
+import org.apache.ignite.internal.portable.PortableContext;
 import org.apache.ignite.internal.portable.PortableUtils;
 import org.apache.ignite.internal.portable.BinaryWriterExImpl;
 import org.apache.ignite.internal.util.*;
@@ -97,8 +99,14 @@ class PortableBuilderSerializer {
         }
 
         if (val.getClass().isEnum()) {
+            String typeName = PortableContext.typeName(val.getClass().getName());
+            int typeId = writer.context().typeId(typeName);
+
+            BinaryMetadata meta = new BinaryMetadata(typeId, typeName, null, null, null, true);
+            writer.context().updateMetadata(typeId, meta);
+
             writer.writeByte(GridPortableMarshaller.ENUM);
-            writer.writeInt(writer.context().typeId(val.getClass().getName()));
+            writer.writeInt(typeId);
             writer.writeInt(((Enum)val).ordinal());
 
             return;

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java
index 81129bd..2385335 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java
@@ -31,6 +31,9 @@ public interface CacheObject extends Message {
     /** */
     public static final byte TYPE_BYTE_ARR = 2;
 
+    /** */
+    public static final byte TYPE_BINARY = 100;
+
     /**
      * @param ctx Context.
      * @param cpy If {@code true} need to copy value.

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
index b4ac5f4..b99c99f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
@@ -176,6 +176,23 @@ import org.apache.ignite.internal.util.typedef.F;
     }
 
     /**
+     * Unwrap array of portables if needed.
+     *
+     * @param arr Array.
+     * @param keepPortable Keep portable flag.
+     * @param cpy Copy.
+     * @return Result.
+     */
+    public Object[] unwrapPortablesInArrayIfNeeded(Object[] arr, boolean keepPortable, boolean cpy) {
+        Object[] res = new Object[arr.length];
+
+        for (int i = 0; i < arr.length; i++)
+            res[i] = unwrapPortable(arr[i], keepPortable, cpy);
+
+        return res;
+    }
+
+    /**
      * Unwraps map.
      *
      * @param map Map to unwrap.
@@ -252,6 +269,8 @@ import org.apache.ignite.internal.util.typedef.F;
             return unwrapPortablesIfNeeded((Collection<Object>)o, keepPortable, cpy);
         else if (o instanceof Map)
             return unwrapPortablesIfNeeded((Map<Object, Object>)o, keepPortable, cpy);
+        else if (o instanceof Object[])
+            return unwrapPortablesInArrayIfNeeded((Object[])o, keepPortable, cpy);
         else if (o instanceof CacheObject) {
             CacheObject co = (CacheObject)o;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java
index e4db77c..7ef4b91 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java
@@ -57,10 +57,11 @@ public interface CacheObjectBinaryProcessor extends IgniteCacheObjectProcessor {
      * @param typeName Type name.
      * @param affKeyFieldName Affinity key field name.
      * @param fieldTypeIds Fields map.
+     * @param isEnum Enum flag.
      * @throws IgniteException In case of error.
      */
     public void updateMetadata(int typeId, String typeName, @Nullable String affKeyFieldName,
-        Map<String, Integer> fieldTypeIds) throws IgniteException;
+        Map<String, Integer> fieldTypeIds, boolean isEnum) throws IgniteException;
 
     /**
      * @param typeId Type ID.
@@ -83,6 +84,14 @@ public interface CacheObjectBinaryProcessor extends IgniteCacheObjectProcessor {
     public Collection<BinaryType> metadata() throws IgniteException;
 
     /**
+     * @param typeName Type name.
+     * @param ord ordinal.
+     * @return Enum object.
+     * @throws IgniteException If failed.
+     */
+    public BinaryObject buildEnum(String typeName, int ord) throws IgniteException;
+
+    /**
      * @return Portables interface.
      * @throws IgniteException If failed.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/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 eef39be..5b70f2a 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
@@ -30,6 +30,7 @@ import org.apache.ignite.cluster.ClusterTopologyException;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.portable.BinaryEnumObjectImpl;
 import org.apache.ignite.internal.portable.BinaryMetadata;
 import org.apache.ignite.internal.portable.BinaryMetadataHandler;
 import org.apache.ignite.internal.portable.BinaryObjectEx;
@@ -467,8 +468,10 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
 
     /** {@inheritDoc} */
     @Override public void updateMetadata(int typeId, String typeName, @Nullable String affKeyFieldName,
-        Map<String, Integer> fieldTypeIds) throws BinaryObjectException {
-        portableCtx.updateMetadata(typeId, new BinaryMetadata(typeId, typeName, fieldTypeIds, affKeyFieldName, null));
+        Map<String, Integer> fieldTypeIds, boolean isEnum) throws BinaryObjectException {
+        BinaryMetadata meta = new BinaryMetadata(typeId, typeName, fieldTypeIds, affKeyFieldName, null, isEnum);
+
+        portableCtx.updateMetadata(typeId, meta);
     }
 
     /** {@inheritDoc} */
@@ -555,6 +558,17 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
     }
 
     /** {@inheritDoc} */
+    @Override public BinaryObject buildEnum(String typeName, int ord) throws IgniteException {
+        typeName = PortableContext.typeName(typeName);
+
+        int typeId = portableCtx.typeId(typeName);
+
+        updateMetadata(typeId, typeName, null, null, true);
+
+        return new BinaryEnumObjectImpl(portableCtx, typeId, null, ord);
+    }
+
+    /** {@inheritDoc} */
     @Override public IgniteBinary binary() throws IgniteException {
         return portables;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java
index 41aa68c..7008502 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java
@@ -143,6 +143,18 @@ public class IgniteBinaryImpl implements IgniteBinary {
         }
     }
 
+    /** {@inheritDoc} */
+    @Override public BinaryObject buildEnum(String typeName, int ord) {
+        guard();
+
+        try {
+            return proc.buildEnum(typeName, ord);
+        }
+        finally {
+            unguard();
+        }
+    }
+
     /**
      * @return Portable processor.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java
index 252baed..80e7b39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java
@@ -69,6 +69,11 @@ public class NoOpBinary implements IgniteBinary {
     }
 
     /** {@inheritDoc} */
+    @Override public BinaryObject buildEnum(String typeName, int ord) {
+        throw unsupported();
+    }
+
+    /** {@inheritDoc} */
     private BinaryObjectException unsupported() {
         return new BinaryObjectException("Binary marshaller is not configured.");
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 7db752a..71f42e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -69,7 +69,6 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformReaderBiClos
 import org.apache.ignite.internal.processors.platform.utils.PlatformReaderClosure;
 import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T4;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
@@ -341,9 +340,9 @@ public class PlatformContextImpl implements PlatformContext {
     /** {@inheritDoc} */
     @SuppressWarnings("ConstantConditions")
     @Override public void processMetadata(BinaryRawReaderEx reader) {
-        Collection<T4<Integer, String, String, Map<String, Integer>>> metas = PlatformUtils.readCollection(reader,
-            new PlatformReaderClosure<T4<Integer, String, String, Map<String, Integer>>>() {
-                @Override public T4<Integer, String, String, Map<String, Integer>> read(BinaryRawReaderEx reader) {
+        Collection<Metadata> metas = PlatformUtils.readCollection(reader,
+            new PlatformReaderClosure<Metadata>() {
+                @Override public Metadata read(BinaryRawReaderEx reader) {
                     int typeId = reader.readInt();
                     String typeName = reader.readString();
                     String affKey = reader.readString();
@@ -355,13 +354,15 @@ public class PlatformContextImpl implements PlatformContext {
                             }
                         });
 
-                    return new T4<>(typeId, typeName, affKey, fields);
+                    boolean isEnum = reader.readBoolean();
+
+                    return new Metadata(typeId, typeName, affKey, fields, isEnum);
                 }
             }
         );
 
-        for (T4<Integer, String, String, Map<String, Integer>> meta : metas)
-            cacheObjProc.updateMetadata(meta.get1(), meta.get2(), meta.get3(), meta.get4());
+        for (Metadata meta : metas)
+            cacheObjProc.updateMetadata(meta.typeId, meta.typeName, meta.affKey, meta.fields, meta.isEnum);
     }
 
     /** {@inheritDoc} */
@@ -398,6 +399,7 @@ public class PlatformContextImpl implements PlatformContext {
             writer.writeString(meta.typeName());
             writer.writeString(meta.affinityKeyFieldName());
             writer.writeMap(fields);
+            writer.writeBoolean(meta.isEnum());
         }
     }
 
@@ -615,4 +617,41 @@ public class PlatformContextImpl implements PlatformContext {
     @Override public PlatformClusterNodeFilter createClusterNodeFilter(Object filter) {
         return new PlatformClusterNodeFilterImpl(filter, this);
     }
+
+    /**
+     * Metadata holder.
+     */
+    private static class Metadata {
+        /** Type ID. */
+        private final int typeId;
+
+        /** Type name. */
+        private final String typeName;
+
+        /** Affinity key. */
+        private final String affKey;
+
+        /** Fields map. */
+        private final Map<String, Integer> fields;
+
+        /** Enum flag. */
+        private final boolean isEnum;
+
+        /**
+         * Constructor.
+         *
+         * @param typeId Type ID.
+         * @param typeName Type name.
+         * @param affKey Affinity key.
+         * @param fields Fields.
+         * @param isEnum Enum flag.
+         */
+        public Metadata(int typeId, String typeName, String affKey, Map<String, Integer> fields, boolean isEnum) {
+            this.typeId = typeId;
+            this.typeName = typeName;
+            this.affKey = affKey;
+            this.fields = fields;
+            this.isEnum = isEnum;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
index 5f5f5c3..d97e071 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
@@ -236,8 +236,8 @@ public class PlatformTransactions extends PlatformAbstractTarget {
             case OP_CACHE_CONFIG_PARAMETERS:
                 TransactionConfiguration txCfg = platformCtx.kernalContext().config().getTransactionConfiguration();
 
-                writer.writeEnum(txCfg.getDefaultTxConcurrency());
-                writer.writeEnum(txCfg.getDefaultTxIsolation());
+                writer.writeInt(txCfg.getDefaultTxConcurrency().ordinal());
+                writer.writeInt(txCfg.getDefaultTxIsolation().ordinal());
                 writer.writeLong(txCfg.getDefaultTxTimeout());
 
                 break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
index 14c040c..6572764 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
@@ -787,6 +787,7 @@ public class PlatformUtils {
                     writer.writeString(typ.getSerializer());
                     writer.writeString(typ.getAffinityKeyFieldName());
                     writer.writeObject(typ.getKeepDeserialized());
+                    writer.writeBoolean(typ.isEnum());
                 }
             });
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
index df28aef..cae5760 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
@@ -42,6 +42,9 @@ public class PlatformDotNetBinaryTypeConfiguration {
     /** Whether to cache deserialized value. */
     private Boolean keepDeserialized;
 
+    /** Enum flag. */
+    private boolean isEnum;
+
     /**
      * Default constructor.
      */
@@ -60,6 +63,7 @@ public class PlatformDotNetBinaryTypeConfiguration {
         serializer = cfg.getSerializer();
         affinityKeyFieldName = cfg.getAffinityKeyFieldName();
         keepDeserialized = cfg.isKeepDeserialized();
+        isEnum = cfg.isEnum();
     }
 
     /**
@@ -164,6 +168,25 @@ public class PlatformDotNetBinaryTypeConfiguration {
         this.keepDeserialized = keepDeserialized;
     }
 
+    /**
+     * Gets whether this is enum type.
+     *
+     * @return {@code True} if enum.
+     */
+    public boolean isEnum() {
+        return isEnum;
+    }
+
+    /**
+     * Sets whether this is enum type.
+     *
+     * @param isEnum {@code True} if enum.
+     */
+    public void setEnum(boolean isEnum) {
+        this.isEnum = isEnum;
+    }
+
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(PlatformDotNetBinaryTypeConfiguration.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
new file mode 100644
index 0000000..3bc3922
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
@@ -0,0 +1,446 @@
+/*
+ * 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.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryTypeConfiguration;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.BinaryConfiguration;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * Contains tests for binary enums.
+ */
+@SuppressWarnings("unchecked")
+public class BinaryEnumsSelfTest extends GridCommonAbstractTest {
+    /** Cache name. */
+    private static String CACHE_NAME = "cache";
+
+    /** Whether to register types or not. */
+    private boolean register;
+
+    /** Node 1. */
+    private Ignite node1;
+
+    /** Node 2. */
+    private Ignite node2;
+
+    /** Cache 1. */
+    private IgniteCache cache1;
+
+    /** Cache 2. */
+    private IgniteCache cache2;
+
+    /** Binary cache 1. */
+    private IgniteCache cacheBinary1;
+
+    /** Binary cache 2. */
+    private IgniteCache cacheBinary2;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        register = false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        if (register) {
+            BinaryConfiguration bCfg = new BinaryConfiguration();
+
+            BinaryTypeConfiguration enumCfg = new BinaryTypeConfiguration(EnumType.class.getName());
+            enumCfg.setEnum(true);
+
+            bCfg.setTypeConfigurations(Arrays.asList(enumCfg, new BinaryTypeConfiguration(EnumHolder.class.getName())));
+
+            cfg.setBinaryConfiguration(bCfg);
+        }
+
+        cfg.setMarshaller(new BinaryMarshaller());
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+        ccfg.setName(CACHE_NAME);
+        ccfg.setCacheMode(CacheMode.PARTITIONED);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        return cfg;
+    }
+
+    /**
+     * Start up routine.
+     *
+     * @throws Exception If failed.
+     */
+    private void startUp(boolean register) throws Exception {
+        this.register = register;
+
+        node1 = startGrid(0);
+        cache1 = node1.cache(CACHE_NAME);
+        cacheBinary1 = cache1.withKeepBinary();
+
+        node2 = startGrid(1);
+        cache2 = node2.cache(CACHE_NAME);
+        cacheBinary2 = cache2.withKeepBinary();
+    }
+
+    /**
+     * Test operations on simple type which is registered in advance.
+     *
+     * @throws Exception If failed.
+     */
+    public void testSimpleRegistered() throws Exception {
+        checkSimple(true);
+    }
+
+    /**
+     * Test operations on simple type which is not registered in advance.
+     *
+     * @throws Exception If failed.
+     */
+    public void testSimpleNotRegistered() throws Exception {
+        checkSimple(false);
+    }
+
+    /**
+     * Test operations when enum is nested into an object (registered).
+     *
+     * @throws Exception If failed.
+     */
+    public void testNestedRegistered() throws Exception {
+        checkNested(true);
+    }
+
+    /**
+     * Test operations when enum is nested into an object (not registered).
+     *
+     * @throws Exception If failed.
+     */
+    public void testNestedNotRegistered() throws Exception {
+        checkNested(false);
+    }
+
+    /**
+     * Test builder operations on simple type which is registered in advance.
+     *
+     * @throws Exception If failed.
+     */
+    public void testSimpleBuilderRegistered() throws Exception {
+        checkSimpleBuilder(true);
+    }
+
+    /**
+     * Test builder operations on simple type which is not registered in advance.
+     *
+     * @throws Exception If failed.
+     */
+    public void testSimpleBuilderNotRegistered() throws Exception {
+        checkSimpleBuilder(false);
+    }
+
+    /**
+     * Test builder operations when enum is nested into an object (registered).
+     *
+     * @throws Exception If failed.
+     */
+    public void testNestedBuilderRegistered() throws Exception {
+        checkNestedBuilder(true);
+    }
+
+    /**
+     * Test builder operations when enum is nested into an object (not registered).
+     *
+     * @throws Exception If failed.
+     */
+    public void testNestedBuilderNotRegistered() throws Exception {
+        checkNestedBuilder(false);
+    }
+
+    /**
+     * Check simple serialization - deserialization.
+     *
+     * @param registered If type should be registered in advance.
+     * @throws Exception If failed.
+     */
+    public void checkSimple(boolean registered) throws Exception {
+        startUp(registered);
+
+        cache1.put(1, EnumType.ONE);
+
+        validateSimple(1, EnumType.ONE, registered);
+    }
+
+    /**
+     * Check nested serialization - deserialization.
+     *
+     * @param registered If type should be registered in advance.
+     * @throws Exception If failed.
+     */
+    private void checkNested(boolean registered) throws Exception {
+        startUp(registered);
+
+        cache1.put(1, new EnumHolder(EnumType.ONE));
+
+        validateNested(1, EnumType.ONE, registered);
+    }
+
+    /**
+     * Check nested builder serialization - deserialization.
+     *
+     * @param registered If type should be registered in advance.
+     * @throws Exception If failed.
+     */
+    private void checkNestedBuilder(boolean registered) throws Exception {
+        startUp(registered);
+
+        BinaryObject obj = node1.binary().builder("EnumHolder").setField("val", EnumType.ONE).build();
+
+        assert node1.binary().type("EnumHolder") != null;
+        assert node1.binary().type("EnumType") != null;
+
+        cacheBinary1.put(1, obj);
+
+        validateNested(1, EnumType.ONE, registered);
+
+        obj = (BinaryObject)cacheBinary1.get(1);
+        obj = node1.binary().builder(obj).setField("val", EnumType.TWO).build();
+
+        cacheBinary1.put(1, obj);
+
+        validateNested(1, EnumType.TWO, registered);
+    }
+
+    /**
+     * Validate nested object.
+     *
+     * @param key Key.
+     * @param val Value.
+     * @param registered Registered flag.
+     * @throws Exception If failed.
+     */
+    private void validateNested(int key, EnumType val, boolean registered) throws Exception {
+        if (registered) {
+            EnumHolder res1 = (EnumHolder) cache1.get(key);
+            EnumHolder res2 = (EnumHolder) cache2.get(key);
+
+            assertEquals(val, res1.val);
+            assertEquals(val, res2.val);
+        }
+
+        BinaryObject resBinary1 = (BinaryObject)cacheBinary1.get(key);
+        BinaryObject resBinary2 = (BinaryObject)cacheBinary2.get(key);
+
+        validate((BinaryObject)resBinary1.field("val"), val);
+        validate((BinaryObject)resBinary2.field("val"), val);
+    }
+
+    /**
+     * Check simple serialization - deserialization using builder.
+     *
+     * @param registered If type should be registered in advance.
+     * @throws Exception If failed.
+     */
+    public void checkSimpleBuilder(boolean registered) throws Exception {
+        startUp(registered);
+
+        BinaryObject binary = node1.binary().buildEnum(EnumType.class.getSimpleName(), EnumType.ONE.ordinal());
+
+        cacheBinary1.put(1, binary);
+
+        validateSimple(1, EnumType.ONE, registered);
+    }
+
+    /**
+     * Test enum array (registered).
+     *
+     * @throws Exception If failed.
+     */
+    public void testSimpleArrayRegistered() throws Exception {
+        checkSimpleArray(true);
+    }
+
+    /**
+     * Test enum array (not registered).
+     *
+     * @throws Exception If failed.
+     */
+    public void testSimpleArrayNotRegistered() throws Exception {
+        checkSimpleArray(false);
+    }
+
+    /**
+     * Test enum array created using builder (registered).
+     *
+     * @throws Exception If failed.
+     */
+    public void testSimpleBuilderArrayRegistered() throws Exception {
+        checkSimpleBuilderArray(true);
+    }
+
+    /**
+     * Test enum array created using builder (not registered).
+     *
+     * @throws Exception If failed.
+     */
+    public void testSimpleBuilderArrayNotRegistered() throws Exception {
+        checkSimpleBuilderArray(false);
+    }
+
+    /**
+     * Check arrays with builder.
+     *
+     * @param registered Registered flag.
+     * @throws Exception If failed.
+     */
+    public void checkSimpleArray(boolean registered) throws Exception {
+        startUp(registered);
+
+        cache1.put(1, new EnumType[] { EnumType.ONE, EnumType.TWO });
+
+        validateSimpleArray(registered);
+    }
+
+    /**
+     * Check arrays with builder.
+     *
+     * @param registered Registered flag.
+     * @throws Exception If failed.
+     */
+    public void checkSimpleBuilderArray(boolean registered) throws Exception {
+        startUp(registered);
+
+        BinaryObject binaryOne = node1.binary().buildEnum(EnumType.class.getSimpleName(), EnumType.ONE.ordinal());
+        BinaryObject binaryTwo = node1.binary().buildEnum(EnumType.class.getSimpleName(), EnumType.TWO.ordinal());
+
+        cacheBinary1.put(1, new BinaryObject[] { binaryOne, binaryTwo });
+
+        validateSimpleArray(registered);
+    }
+
+    /**
+     * Validate simple array.
+     *
+     * @param registered Registered flag.
+     */
+    private void validateSimpleArray(boolean registered) {
+        if (registered) {
+            Object[] arr1 = (Object[])cache1.get(1);
+            Object[] arr2 = (Object[])cache2.get(1);
+
+            assertEquals(2, arr1.length);
+            assertEquals(2, arr2.length);
+
+            assertEquals(EnumType.ONE, arr1[0]);
+            assertEquals(EnumType.TWO, arr1[1]);
+
+            assertEquals(EnumType.ONE, arr2[0]);
+            assertEquals(EnumType.TWO, arr2[1]);
+        }
+
+        Object[] arrBinary1 = (Object[])cacheBinary1.get(1);
+        Object[] arrBinary2 = (Object[])cacheBinary2.get(1);
+
+        assertEquals(2, arrBinary1.length);
+        assertEquals(2, arrBinary2.length);
+
+        validate((BinaryObject) arrBinary1[0], EnumType.ONE);
+        validate((BinaryObject) arrBinary1[1], EnumType.TWO);
+
+        validate((BinaryObject) arrBinary2[0], EnumType.ONE);
+        validate((BinaryObject) arrBinary2[1], EnumType.TWO);
+    }
+
+    /**
+     * Internal check routine for simple scenario.
+     *
+     * @param key Key.
+     * @param val Value.
+     * @param registered Registered flag.
+     * @throws Exception If failed.
+     */
+    private void validateSimple(int key, EnumType val, boolean registered) throws Exception {
+        if (registered) {
+            assertEquals(val, cache1.get(key));
+            assertEquals(val, cache2.get(key));
+        }
+
+        validate((BinaryObject) cacheBinary1.get(key), val);
+        validate((BinaryObject) cacheBinary2.get(key), val);
+    }
+
+    /**
+     * Validate single value.
+     *
+     * @param obj Binary value.
+     * @param val Expected value.
+     */
+    private void validate(BinaryObject obj, EnumType val) {
+        assertTrue(obj.type().isEnum());
+
+        assertEquals(node1.binary().typeId(EnumType.class.getName()), obj.type().typeId());
+        assertEquals(node2.binary().typeId(EnumType.class.getName()), obj.type().typeId());
+
+        assertEquals(val.ordinal(), obj.enumOrdinal());
+    }
+
+    /**
+     * Enumeration holder.
+     */
+    public static class EnumHolder implements Serializable {
+        /** Value. */
+        public EnumType val;
+
+        /**
+         * Default constructor.
+         */
+        @SuppressWarnings("UnusedDeclaration")
+        public EnumHolder() {
+            // No-op.
+        }
+
+        /**
+         * Constructor.
+         *
+         * @param val Value.
+         */
+        public EnumHolder(EnumType val) {
+            this.val = val;
+        }
+    }
+
+    /**
+     * Enumeration for tests.
+     */
+    public static enum EnumType {
+        ONE,
+        TWO
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index 655582e..9f7822c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -487,8 +487,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
         assertArrayEquals(obj.objArr, (Object[])po.field("objArr"));
         assertEquals(obj.col, po.field("col"));
         assertEquals(obj.map, po.field("map"));
-        assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("enumArr")));
+        assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((BinaryObject)po.field("enumVal")).enumOrdinal()));
+        assertArrayEquals(ordinals(obj.enumArr), ordinals((BinaryObject[])po.field("enumArr")));
         assertNull(po.field("unknown"));
 
         BinaryObject innerPo = po.field("inner");
@@ -523,8 +523,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
         assertEquals(obj.inner.col, innerPo.field("col"));
         assertEquals(obj.inner.map, innerPo.field("map"));
         assertEquals(new Integer(obj.inner.enumVal.ordinal()),
-            new Integer(((Enum<?>)innerPo.field("enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.inner.enumArr), ordinals((Enum<?>[])innerPo.field("enumArr")));
+            new Integer(((BinaryObject)innerPo.field("enumVal")).enumOrdinal()));
+        assertArrayEquals(ordinals(obj.inner.enumArr), ordinals((BinaryObject[])innerPo.field("enumArr")));
         assertNull(innerPo.field("inner"));
         assertNull(innerPo.field("unknown"));
     }
@@ -572,8 +572,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
         assertArrayEquals(obj.objArr, (Object[])po.field("_objArr"));
         assertEquals(obj.col, po.field("_col"));
         assertEquals(obj.map, po.field("_map"));
-        assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("_enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("_enumArr")));
+        assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((BinaryObject)po.field("_enumVal")).enumOrdinal()));
+        assertArrayEquals(ordinals(obj.enumArr), ordinals((BinaryObject[])po.field("_enumArr")));
         assertNull(po.field("unknown"));
 
         BinaryObject simplePo = po.field("_simple");
@@ -608,8 +608,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
         assertEquals(obj.simple.col, simplePo.field("col"));
         assertEquals(obj.simple.map, simplePo.field("map"));
         assertEquals(new Integer(obj.simple.enumVal.ordinal()),
-            new Integer(((Enum<?>)simplePo.field("enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.simple.enumArr), ordinals((Enum<?>[])simplePo.field("enumArr")));
+            new Integer(((BinaryObject)simplePo.field("enumVal")).enumOrdinal()));
+        assertArrayEquals(ordinals(obj.simple.enumArr), ordinals((BinaryObject[])simplePo.field("enumArr")));
         assertNull(simplePo.field("simple"));
         assertNull(simplePo.field("portable"));
         assertNull(simplePo.field("unknown"));
@@ -645,8 +645,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
         assertEquals(obj.portable.col, portablePo.field("_col"));
         assertEquals(obj.portable.map, portablePo.field("_map"));
         assertEquals(new Integer(obj.portable.enumVal.ordinal()),
-            new Integer(((Enum<?>)portablePo.field("_enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.portable.enumArr), ordinals((Enum<?>[])portablePo.field("_enumArr")));
+            new Integer(((BinaryObject)portablePo.field("_enumVal")).enumOrdinal()));
+        assertArrayEquals(ordinals(obj.portable.enumArr), ordinals((BinaryObject[])portablePo.field("_enumArr")));
         assertNull(portablePo.field("_simple"));
         assertNull(portablePo.field("_portable"));
         assertNull(portablePo.field("unknown"));
@@ -684,8 +684,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
         assertArrayEquals(obj.objArr, (Object[])po.field("objArr"));
         assertEquals(obj.col, po.field("col"));
         assertEquals(obj.map, po.field("map"));
-        assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("enumArr")));
+        assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((BinaryObject)po.field("enumVal")).enumOrdinal()));
+        assertArrayEquals(ordinals(obj.enumArr), ordinals((BinaryObject[])po.field("enumArr")));
         assertNull(po.field("unknown"));
 
         assertEquals(obj, po.deserialize());
@@ -2203,6 +2203,19 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @param enumArr Enum array.
+     * @return Ordinals.
+     */
+    private <T extends Enum<?>> Integer[] ordinals(BinaryObject[] enumArr) {
+        Integer[] ords = new Integer[enumArr.length];
+
+        for (int i = 0; i < enumArr.length; i++)
+            ords[i] = enumArr[i].enumOrdinal();
+
+        return ords;
+    }
+
+    /**
      * @param po Portable object.
      * @param off Offset.
      * @return Value.

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
index c464945..a284883 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
@@ -194,9 +194,9 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
                 case TYPE_ENUM_FIELD:
                     IgniteCache<Integer, BinaryObject> cache = ignite.cache(null).withKeepBinary();
                     BinaryObject obj = cache.get(TYPE_ENUM_FIELD);
-                    PlatformComputeEnum val = obj.field("interopEnum");
+                    BinaryObject val = obj.field("interopEnum");
 
-                    return val;
+                    return val.deserialize();
 
                 default:
                     throw new IgniteException("Unknown type: " + type);

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
index 16eeb2b..629835b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
+import org.apache.ignite.internal.portable.BinaryEnumsSelfTest;
 import org.apache.ignite.internal.portable.GridPortableAffinityKeySelfTest;
 import org.apache.ignite.internal.portable.BinaryObjectBuilderAdditionalSelfTest;
 import org.apache.ignite.internal.portable.BinaryObjectBuilderSelfTest;
@@ -72,6 +73,7 @@ public class IgnitePortableObjectsTestSuite extends TestSuite {
         suite.addTestSuite(BinaryFieldsOffheapSelfTest.class);
         suite.addTestSuite(BinaryFooterOffsetsHeapSelfTest.class);
         suite.addTestSuite(BinaryFooterOffsetsOffheapSelfTest.class);
+        suite.addTestSuite(BinaryEnumsSelfTest.class);
         suite.addTestSuite(GridPortableMetaDataSelfTest.class);
         suite.addTestSuite(GridPortableAffinityKeySelfTest.class);
         suite.addTestSuite(GridPortableWildcardsSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp b/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
index 2e86ccd..6c3bf7f 100644
--- a/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
@@ -32,7 +32,7 @@ namespace ignite
     {
         namespace binary
         {
-            /** Operation: Clear. */
+            /** Operation: metadata update. */
             const int32_t OP_METADATA = -1;
 
             BinaryTypeUpdaterImpl::BinaryTypeUpdaterImpl(SharedPointer<IgniteEnvironment> env,
@@ -78,6 +78,8 @@ namespace ignite
                 else
                     rawWriter.WriteInt32(0);
 
+                rawWriter.WriteBool(false); // Enums are not supported for now.
+
                 out.Synchronize();
 
                 long long res = env.Get()->Context()->TargetInStreamOutLong(javaRef, OP_METADATA, mem.Get()->PointerLong(), &jniErr);


[08/50] [abbrv] ignite git commit: Fixing examples.

Posted by ag...@apache.org.
Fixing examples.


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

Branch: refs/heads/ignite-1282
Commit: df9658bf9e77427290e0f548532f5d7dc61c1e18
Parents: 2f20040
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Nov 26 19:10:39 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Nov 26 19:32:46 2015 +0300

----------------------------------------------------------------------
 .../ComputeFibonacciContinuationExample.java    |  15 ++-
 .../computegrid/ComputeTaskMapExample.java      |   6 +-
 .../computegrid/ComputeTaskSplitExample.java    |   4 +-
 .../examples/messaging/MessagingExample.java    |  18 +--
 .../examples/misc/springbean/spring-bean.xml    |   7 --
 .../testsuites/IgniteExamplesSelfTestSuite.java |   4 +-
 .../portable/GridPortableMarshaller.java        |   3 +
 .../internal/portable/PortableContext.java      |  10 +-
 .../ignite/internal/portable/PortableUtils.java |   7 ++
 .../processors/cache/GridCacheEventManager.java |   4 +-
 .../processors/query/GridQueryProcessor.java    |   8 ++
 .../sharedfs/SharedFsCheckpointSpi.java         |  14 ++-
 .../session/GridSessionCheckpointSelfTest.java  |  16 +++
 ...ObjectsCacheDataStructuresSelfTestSuite.java |  33 +++++
 ...BinaryObjectsCacheExpiryPolicyTestSuite.java |  34 ++++++
 ...gniteBinaryObjectsCacheRestartTestSuite.java |  33 +++++
 .../IgniteBinaryObjectsCacheTestSuite3.java     |  33 +++++
 .../IgniteBinaryObjectsCacheTestSuite4.java     |  33 +++++
 ...IgniteBinaryObjectsComputeGridTestSuite.java |  33 +++++
 .../cache/IgniteCacheNoClassQuerySelfTest.java  | 122 +++++++++++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 21 files changed, 402 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java
index 706ec18..6642e9d 100644
--- a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java
@@ -42,7 +42,9 @@ import org.jetbrains.annotations.Nullable;
  * performing the distributed recursive calculation of {@code 'Fibonacci'}
  * numbers on the cluster. Continuations
  * functionality is exposed via {@link ComputeJobContext#holdcc()} and
- * {@link ComputeJobContext#callcc()} method calls in {@link ComputeFibonacciContinuationExample.FibonacciClosure} class.
+ * {@link ComputeJobContext#callcc()} method calls in
+ * {@link org.apache.ignite.examples.computegrid.ComputeFibonacciContinuationExample.ContinuationFibonacciClosure}
+ * class.
  * <p>
  * Remote nodes should always be started with special configuration file which
  * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
@@ -76,7 +78,8 @@ public final class ComputeFibonacciContinuationExample {
 
             long start = System.currentTimeMillis();
 
-            BigInteger fib = ignite.compute(ignite.cluster().forPredicate(nodeFilter)).apply(new FibonacciClosure(nodeFilter), N);
+            BigInteger fib = ignite.compute(ignite.cluster().forPredicate(nodeFilter)).apply(
+                new ContinuationFibonacciClosure(nodeFilter), N);
 
             long duration = System.currentTimeMillis() - start;
 
@@ -93,7 +96,7 @@ public final class ComputeFibonacciContinuationExample {
     /**
      * Closure to execute.
      */
-    private static class FibonacciClosure implements IgniteClosure<Long, BigInteger> {
+    private static class ContinuationFibonacciClosure implements IgniteClosure<Long, BigInteger> {
         /** Future for spawned task. */
         private IgniteFuture<BigInteger> fut1;
 
@@ -114,7 +117,7 @@ public final class ComputeFibonacciContinuationExample {
         /**
          * @param nodeFilter Predicate to filter nodes.
          */
-        FibonacciClosure(IgnitePredicate<ClusterNode> nodeFilter) {
+        ContinuationFibonacciClosure(IgnitePredicate<ClusterNode> nodeFilter) {
             this.nodeFilter = nodeFilter;
         }
 
@@ -143,7 +146,7 @@ public final class ComputeFibonacciContinuationExample {
 
                 // If future is not cached in node-local-map, cache it.
                 if (fut1 == null) {
-                    compute.apply(new FibonacciClosure(nodeFilter), n - 1);
+                    compute.apply(new ContinuationFibonacciClosure(nodeFilter), n - 1);
 
                     ComputeTaskFuture<BigInteger> futVal = compute.future();
 
@@ -155,7 +158,7 @@ public final class ComputeFibonacciContinuationExample {
 
                 // If future is not cached in node-local-map, cache it.
                 if (fut2 == null) {
-                    compute.apply(new FibonacciClosure(nodeFilter), n - 2);
+                    compute.apply(new ContinuationFibonacciClosure(nodeFilter), n - 2);
 
                     ComputeTaskFuture<BigInteger> futVal = compute.<BigInteger>future();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java
index 1c880e8..3de5293 100644
--- a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java
@@ -59,7 +59,7 @@ public class ComputeTaskMapExample {
             System.out.println("Compute task map example started.");
 
             // Execute task on the cluster and wait for its completion.
-            int cnt = ignite.compute().execute(CharacterCountTask.class, "Hello Ignite Enabled World!");
+            int cnt = ignite.compute().execute(MapExampleCharacterCountTask.class, "Hello Ignite Enabled World!");
 
             System.out.println();
             System.out.println(">>> Total number of characters in the phrase is '" + cnt + "'.");
@@ -70,7 +70,7 @@ public class ComputeTaskMapExample {
     /**
      * Task to count non-white-space characters in a phrase.
      */
-    private static class CharacterCountTask extends ComputeTaskAdapter<String, Integer> {
+    private static class MapExampleCharacterCountTask extends ComputeTaskAdapter<String, Integer> {
         /**
          * Splits the received string to words, creates a child job for each word, and sends
          * these jobs to other nodes for processing. Each such job simply prints out the received word.
@@ -80,8 +80,6 @@ public class ComputeTaskMapExample {
          * @return Map of jobs to nodes.
          */
         @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> nodes, String arg) {
-            String[] words = arg.split(" ");
-
             Map<ComputeJob, ClusterNode> map = new HashMap<>();
 
             Iterator<ClusterNode> it = nodes.iterator();

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java
index a1358e0..60bce4a 100644
--- a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java
@@ -56,7 +56,7 @@ public class ComputeTaskSplitExample {
             System.out.println("Compute task split example started.");
 
             // Execute task on the cluster and wait for its completion.
-            int cnt = ignite.compute().execute(CharacterCountTask.class, "Hello Ignite Enabled World!");
+            int cnt = ignite.compute().execute(SplitExampleCharacterCountTask.class, "Hello Ignite Enabled World!");
 
             System.out.println();
             System.out.println(">>> Total number of characters in the phrase is '" + cnt + "'.");
@@ -67,7 +67,7 @@ public class ComputeTaskSplitExample {
     /**
      * Task to count non-white-space characters in a phrase.
      */
-    private static class CharacterCountTask extends ComputeTaskSplitAdapter<String, Integer> {
+    private static class SplitExampleCharacterCountTask extends ComputeTaskSplitAdapter<String, Integer> {
         /**
          * Splits the received string to words, creates a child job for each word, and sends
          * these jobs to other nodes for processing. Each such job simply prints out the received word.

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java b/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java
index 8f37d59..a810e02 100644
--- a/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java
@@ -47,7 +47,7 @@ public final class MessagingExample {
     private static final int MESSAGES_NUM = 10;
 
     /** Message topics. */
-    private enum TOPIC { ORDERED, UNORDERED }
+    private enum EXAMPLE_TOPIC { ORDERED, UNORDERED }
 
     /**
      * Executes example.
@@ -79,13 +79,13 @@ public final class MessagingExample {
 
             // Send unordered messages to all remote nodes.
             for (int i = 0; i < MESSAGES_NUM; i++)
-                ignite.message(rmts).send(TOPIC.UNORDERED, Integer.toString(i));
+                ignite.message(rmts).send(EXAMPLE_TOPIC.UNORDERED, Integer.toString(i));
 
             System.out.println(">>> Finished sending unordered messages.");
 
             // Send ordered messages to all remote nodes.
             for (int i = 0; i < MESSAGES_NUM; i++)
-                ignite.message(rmts).sendOrdered(TOPIC.ORDERED, Integer.toString(i), 0);
+                ignite.message(rmts).sendOrdered(EXAMPLE_TOPIC.ORDERED, Integer.toString(i), 0);
 
             System.out.println(">>> Finished sending ordered messages.");
             System.out.println(">>> Check output on all nodes for message printouts.");
@@ -105,7 +105,7 @@ public final class MessagingExample {
      */
     private static void startListening(IgniteMessaging msg) {
         // Add ordered message listener.
-        msg.remoteListen(TOPIC.ORDERED, new IgniteBiPredicate<UUID, String>() {
+        msg.remoteListen(EXAMPLE_TOPIC.ORDERED, new IgniteBiPredicate<UUID, String>() {
             @IgniteInstanceResource
             private Ignite ignite;
 
@@ -113,7 +113,7 @@ public final class MessagingExample {
                 System.out.println("Received ordered message [msg=" + msg + ", fromNodeId=" + nodeId + ']');
 
                 try {
-                    ignite.message(ignite.cluster().forNodeId(nodeId)).send(TOPIC.ORDERED, msg);
+                    ignite.message(ignite.cluster().forNodeId(nodeId)).send(EXAMPLE_TOPIC.ORDERED, msg);
                 }
                 catch (IgniteException e) {
                     e.printStackTrace();
@@ -124,7 +124,7 @@ public final class MessagingExample {
         });
 
         // Add unordered message listener.
-        msg.remoteListen(TOPIC.UNORDERED, new IgniteBiPredicate<UUID, String>() {
+        msg.remoteListen(EXAMPLE_TOPIC.UNORDERED, new IgniteBiPredicate<UUID, String>() {
             @IgniteInstanceResource
             private Ignite ignite;
 
@@ -132,7 +132,7 @@ public final class MessagingExample {
                 System.out.println("Received unordered message [msg=" + msg + ", fromNodeId=" + nodeId + ']');
 
                 try {
-                    ignite.message(ignite.cluster().forNodeId(nodeId)).send(TOPIC.UNORDERED, msg);
+                    ignite.message(ignite.cluster().forNodeId(nodeId)).send(EXAMPLE_TOPIC.UNORDERED, msg);
                 }
                 catch (IgniteException e) {
                     e.printStackTrace();
@@ -155,7 +155,7 @@ public final class MessagingExample {
         final CountDownLatch orderedLatch,
         final CountDownLatch unorderedLatch
     ) {
-        msg.localListen(TOPIC.ORDERED, new IgniteBiPredicate<UUID, String>() {
+        msg.localListen(EXAMPLE_TOPIC.ORDERED, new IgniteBiPredicate<UUID, String>() {
             @Override public boolean apply(UUID nodeId, String msg) {
                 orderedLatch.countDown();
 
@@ -164,7 +164,7 @@ public final class MessagingExample {
             }
         });
 
-        msg.localListen(TOPIC.UNORDERED, new IgniteBiPredicate<UUID, String>() {
+        msg.localListen(EXAMPLE_TOPIC.UNORDERED, new IgniteBiPredicate<UUID, String>() {
             @Override public boolean apply(UUID nodeId, String msg) {
                 unorderedLatch.countDown();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml b/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml
index 393b9cf..b9fcb86 100644
--- a/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml
+++ b/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml
@@ -35,13 +35,6 @@
                 <!-- Set to true to enable ignite-aware class loading for examples, default is false. -->
                 <property name="peerClassLoadingEnabled" value="true"/>
 
-                <property name="marshaller">
-                    <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
-                        <!-- Set to false to allow non-serializable objects in examples, default is true. -->
-                        <property name="requireSerializable" value="false"/>
-                    </bean>
-                </property>
-
                 <!-- Enable task execution events for examples. -->
                 <property name="includeEventTypes">
                     <util:constant static-field="org.apache.ignite.events.EventType.EVTS_TASK_EXECUTION"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
index f68ce95..4412af3 100644
--- a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
+++ b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
@@ -59,8 +59,8 @@ public class IgniteExamplesSelfTestSuite extends TestSuite {
      * @throws Exception If failed.
      */
     public static TestSuite suite() throws Exception {
-        System.setProperty(IGNITE_OVERRIDE_MCAST_GRP,
-            GridTestUtils.getNextMulticastGroup(IgniteExamplesSelfTestSuite.class));
+//        System.setProperty(IGNITE_OVERRIDE_MCAST_GRP,
+//            GridTestUtils.getNextMulticastGroup(IgniteExamplesSelfTestSuite.class));
 
         TestSuite suite = new TestSuite("Ignite Examples Test Suite");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
index af1ed68..5244da8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
@@ -173,6 +173,9 @@ public class GridPortableMarshaller {
     public static final byte CONC_SKIP_LIST_SET = 6;
 
     /** */
+    public static final byte CONC_LINKED_QUEUE = 7;
+
+    /** */
     public static final byte HASH_MAP = 1;
 
     /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/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 765babc..ab96ed1 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
@@ -47,6 +47,7 @@ import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ConcurrentSkipListSet;
 import java.util.jar.JarEntry;
@@ -160,6 +161,7 @@ public class PortableContext implements Externalizable {
         colTypes.put(LinkedHashSet.class, GridPortableMarshaller.LINKED_HASH_SET);
         colTypes.put(TreeSet.class, GridPortableMarshaller.TREE_SET);
         colTypes.put(ConcurrentSkipListSet.class, GridPortableMarshaller.CONC_SKIP_LIST_SET);
+        colTypes.put(ConcurrentLinkedQueue.class, GridPortableMarshaller.CONC_LINKED_QUEUE);
 
         mapTypes.put(HashMap.class, GridPortableMarshaller.HASH_MAP);
         mapTypes.put(LinkedHashMap.class, GridPortableMarshaller.LINKED_HASH_MAP);
@@ -893,8 +895,12 @@ public class PortableContext implements Externalizable {
                 // This is an anonymous class. Don't cut off enclosing class name for it.
                 idx = -1;
             }
-            catch (NumberFormatException e) {
-                return typeName;
+            catch (NumberFormatException ignore) {
+                // This is a lambda class.
+                if (clsName.indexOf("$$Lambda$") > 0)
+                    idx = -1;
+                else
+                    return typeName;
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index 0c569cf..a83405d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.portable;
 
+import java.util.concurrent.ConcurrentLinkedQueue;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.binary.BinaryInvalidTypeException;
 import org.apache.ignite.binary.BinaryObject;
@@ -68,6 +69,7 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR_AR
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.CLASS;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.COL;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.CONC_HASH_MAP;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.CONC_LINKED_QUEUE;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.CONC_SKIP_LIST_SET;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE_ARR;
@@ -1692,6 +1694,11 @@ public class PortableUtils {
 
                     break;
 
+                case CONC_LINKED_QUEUE:
+                    col = new ConcurrentLinkedQueue<>();
+
+                    break;
+
                 case USER_SET:
                     col = U.newHashSet(size);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java
index 7ff3a99..98579c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java
@@ -376,7 +376,9 @@ public class GridCacheEventManager extends GridCacheManagerAdapter {
      * @return {@code True} if event is recordable.
      */
     public boolean isRecordable(int type) {
-        return cctx.userCache() && cctx.gridEvents().isRecordable(type);
+        GridCacheContext cctx0 = cctx;
+
+        return cctx0 != null && cctx0.userCache() && cctx0.gridEvents().isRecordable(type);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 9009e00..64f2415 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -222,6 +222,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                             desc.keyClass(Object.class);
                     }
                     else {
+                        if (keyCls == null)
+                            throw new IgniteCheckedException("Failed to find key class in the node classpath " +
+                                "(use default marshaller to enable binary objects): " + qryEntity.getKeyType());
+
+                        if (valCls == null)
+                            throw new IgniteCheckedException("Failed to find value class in the node classpath " +
+                                "(use default marshaller to enable binary objects) : " + qryEntity.getValueType());
+
                         desc.valueClass(valCls);
                         desc.keyClass(keyCls);
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
index eb2b5a9..3a25455 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
@@ -28,12 +28,14 @@ import java.util.Queue;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiAdapter;
@@ -165,6 +167,9 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
     /** Listener. */
     private CheckpointListener lsnr;
 
+    /** Marshaller. */
+    private Marshaller marsh;
+
     /**
      * Initializes default directory paths.
      */
@@ -209,6 +214,9 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
 
         this.gridName = gridName;
 
+        marsh = ignite.configuration().getMarshaller() instanceof BinaryMarshaller ? new JdkMarshaller() :
+            ignite.configuration().getMarshaller();
+
         folder = getNextSharedPath();
 
         if (folder == null)
@@ -307,8 +315,6 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
         if (folder != null) {
             Map<File, SharedFsTimeData> files = new HashMap<>();
 
-            Marshaller marsh = ignite.configuration().getMarshaller();
-
             // Track expiration for only those files that are made by this node
             // to avoid file access conflicts.
             for (File file : getFiles()) {
@@ -380,7 +386,7 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
 
         if (file.exists())
             try {
-                SharedFsCheckpointData data = SharedFsUtils.read(file, ignite.configuration().getMarshaller(), log);
+                SharedFsCheckpointData data = SharedFsUtils.read(file, marsh, log);
 
                 return data != null ?
                     data.getExpireTime() == 0 || data.getExpireTime() > U.currentTimeMillis() ?
@@ -428,7 +434,7 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
 
             try {
                 SharedFsUtils.write(file, new SharedFsCheckpointData(state, expireTime, host, key),
-                    ignite.configuration().getMarshaller(), log);
+                    marsh, log);
             }
             catch (IOException e) {
                 // Select next shared directory if exists, otherwise throw exception

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java
index 07e558c..2fd62c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java
@@ -19,6 +19,12 @@ package org.apache.ignite.session;
 
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.portable.BinaryCachingMetadataHandler;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
+import org.apache.ignite.internal.portable.PortableContext;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.MarshallerContextTestImpl;
 import org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi;
 import org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi;
 import org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointSpi;
@@ -89,6 +95,16 @@ public class GridSessionCheckpointSelfTest extends GridSessionCheckpointAbstract
 
         cfg.setCheckpointSpi(spi);
 
+        if (cfg.getMarshaller() instanceof BinaryMarshaller) {
+            PortableContext ctx = new PortableContext(BinaryCachingMetadataHandler.create(), cfg);
+
+            Marshaller marsh = cfg.getMarshaller();
+
+            marsh.setContext(new MarshallerContextTestImpl(null));
+
+            IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, cfg);
+        }
+
         GridSessionCheckpointSelfTest.spi = spi;
 
         checkCheckpoints(cfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheDataStructuresSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheDataStructuresSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheDataStructuresSelfTestSuite.java
new file mode 100644
index 0000000..1a77518
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheDataStructuresSelfTestSuite.java
@@ -0,0 +1,33 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
+import org.apache.ignite.testframework.config.GridTestProperties;
+
+/**
+ *
+ */
+public class IgniteBinaryObjectsCacheDataStructuresSelfTestSuite {
+    public static TestSuite suite() throws Exception {
+        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+
+        return IgniteCacheDataStructuresSelfTestSuite.suite();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheExpiryPolicyTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheExpiryPolicyTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheExpiryPolicyTestSuite.java
new file mode 100644
index 0000000..b5bd4de
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheExpiryPolicyTestSuite.java
@@ -0,0 +1,34 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
+import org.apache.ignite.internal.processors.cache.expiry.IgniteCacheExpiryPolicyTestSuite;
+import org.apache.ignite.testframework.config.GridTestProperties;
+
+/**
+ *
+ */
+public class IgniteBinaryObjectsCacheExpiryPolicyTestSuite {
+    public static TestSuite suite() throws Exception {
+        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+
+        return IgniteCacheExpiryPolicyTestSuite.suite();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheRestartTestSuite.java
new file mode 100644
index 0000000..0ef9446
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheRestartTestSuite.java
@@ -0,0 +1,33 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
+import org.apache.ignite.testframework.config.GridTestProperties;
+
+/**
+ *
+ */
+public class IgniteBinaryObjectsCacheRestartTestSuite {
+    public static TestSuite suite() throws Exception {
+        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+
+        return IgniteCacheRestartTestSuite.suite();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java
new file mode 100644
index 0000000..736a862
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java
@@ -0,0 +1,33 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
+import org.apache.ignite.testframework.config.GridTestProperties;
+
+/**
+ *
+ */
+public class IgniteBinaryObjectsCacheTestSuite3 {
+    public static TestSuite suite() throws Exception {
+        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+
+        return IgniteCacheTestSuite3.suite();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite4.java
new file mode 100644
index 0000000..4f88e0a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite4.java
@@ -0,0 +1,33 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
+import org.apache.ignite.testframework.config.GridTestProperties;
+
+/**
+ *
+ */
+public class IgniteBinaryObjectsCacheTestSuite4 {
+    public static TestSuite suite() throws Exception {
+        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+
+        return IgniteCacheTestSuite4.suite();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsComputeGridTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsComputeGridTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsComputeGridTestSuite.java
new file mode 100644
index 0000000..878f59f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsComputeGridTestSuite.java
@@ -0,0 +1,33 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
+import org.apache.ignite.testframework.config.GridTestProperties;
+
+/**
+ *
+ */
+public class IgniteBinaryObjectsComputeGridTestSuite {
+    public static TestSuite suite() throws Exception {
+        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+
+        return IgniteComputeGridTestSuite.suite();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
new file mode 100644
index 0000000..9429226
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteCacheNoClassQuerySelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    protected Ignite ignite;
+
+    /**
+     * @return Atomicity mode.
+     */
+    protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+
+    /**
+     * @return Distribution.
+     */
+    protected NearCacheConfiguration nearCacheConfiguration() {
+        return new NearCacheConfiguration();
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(gridName);
+
+        c.setDiscoverySpi(new TcpDiscoverySpi().setForceServerMode(true).setIpFinder(ipFinder));
+
+        CacheConfiguration cc = defaultCacheConfiguration();
+
+        c.setMarshaller(new OptimizedMarshaller());
+
+        cc.setName("cache");
+
+        cc.setAtomicityMode(TRANSACTIONAL);
+        cc.setWriteSynchronizationMode(FULL_SYNC);
+        cc.setRebalanceMode(SYNC);
+
+        QueryEntity qryEntity = new QueryEntity();
+
+        qryEntity.setKeyType(Integer.class.getName());
+        qryEntity.setValueType("MyClass");
+
+        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+
+        fields.put("strField", String.class.getName());
+        fields.put("intField", Integer.class.getName());
+        fields.put("doubleField", Double.class.getName());
+
+        qryEntity.setFields(fields);
+
+        qryEntity.setFields(fields);
+
+        qryEntity.setIndexes(Arrays.asList(
+            new QueryIndex("strField"),
+            new QueryIndex("intField"),
+            new QueryIndex("doubleField")
+        ));
+
+        cc.setQueryEntities(Collections.singletonList(
+            qryEntity
+        ));
+
+        c.setCacheConfiguration(cc);
+
+        return c;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNoClass() throws Exception {
+        try {
+            startGrid();
+        }
+        catch (Exception e) {
+            assertTrue(e.getMessage().contains("default marshaller"));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 0745cd7..8311414 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithre
 import org.apache.ignite.internal.processors.cache.IgniteCacheCollocatedQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheFieldsQueryNoDataSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheLargeResultSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheNoClassQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapEvictQueryTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapTieredMultithreadedSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheP2pUnmarshallingQueryErrorTest;
@@ -204,6 +205,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
 
         //Unmarshallig query test.
         suite.addTestSuite(IgniteCacheP2pUnmarshallingQueryErrorTest.class);
+        suite.addTestSuite(IgniteCacheNoClassQuerySelfTest.class);
 
         return suite;
     }


[46/50] [abbrv] ignite git commit: Fixing tests

Posted by ag...@apache.org.
Fixing tests


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

Branch: refs/heads/ignite-1282
Commit: 6a95f88d4cea59d70dd02628b23be976dcb9f6d9
Parents: 0c03b91
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Nov 27 20:40:05 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Nov 27 20:40:05 2015 +0300

----------------------------------------------------------------------
 .../cache/eviction/random/RandomEvictionPolicySelfTest.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6a95f88d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
index 9d781eb..af04cdc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
@@ -92,7 +92,11 @@ public class RandomEvictionPolicySelfTest extends
                     info("Stats [cntr=" + i + ", total=" + runs + ']');
             }
 
-            assert g.cache(null).size() <= max;
+            int size = g.cache(null).size();
+
+            info("Cache size: " + size);
+
+            assert size <= (max * 1.2) : size; // Add 20% room for random evictions.
 
             info(policy(0));
         }
@@ -354,4 +358,4 @@ public class RandomEvictionPolicySelfTest extends
     @Override protected void checkPolicies() {
         // No-op.
     }
-}
\ No newline at end of file
+}


[35/50] [abbrv] ignite git commit: Add README.txt for jms11, mqtt and zookeeper modules.

Posted by ag...@apache.org.
Add README.txt for jms11, mqtt and zookeeper modules.


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

Branch: refs/heads/ignite-1282
Commit: 722fe14a6814a9cdbfea1cbfe53598ba5ed8ea8f
Parents: 95ab231
Author: Raul Kripalani <ra...@apache.org>
Authored: Fri Nov 27 11:54:32 2015 +0000
Committer: Raul Kripalani <ra...@apache.org>
Committed: Fri Nov 27 11:54:32 2015 +0000

----------------------------------------------------------------------
 modules/jms11/README.txt     | 29 +++++++++++++++++++++++++++++
 modules/mqtt/README.txt      | 29 +++++++++++++++++++++++++++++
 modules/zookeeper/README.txt | 29 +++++++++++++++++++++++++++++
 3 files changed, 87 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/722fe14a/modules/jms11/README.txt
----------------------------------------------------------------------
diff --git a/modules/jms11/README.txt b/modules/jms11/README.txt
new file mode 100644
index 0000000..3f0d213
--- /dev/null
+++ b/modules/jms11/README.txt
@@ -0,0 +1,29 @@
+Apache Ignite JMS 1.1 Module
+----------------------------
+
+Apache Ignite JMS 1.1 module provides a streamer to consume JMS queue and topic messages into
+Apache Ignite caches.
+
+Importing Apache Ignite JMS 1.1 Module In Maven Project
+--------------------------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add the JMS 1.1 module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    ...
+    <dependencies>
+        ...
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-jms11</artifactId>
+            <version>${ignite.version}</version>
+        </dependency>
+        ...
+    </dependencies>
+    ...
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/722fe14a/modules/mqtt/README.txt
----------------------------------------------------------------------
diff --git a/modules/mqtt/README.txt b/modules/mqtt/README.txt
new file mode 100644
index 0000000..62a1589
--- /dev/null
+++ b/modules/mqtt/README.txt
@@ -0,0 +1,29 @@
+Apache Ignite MQTT Module
+-------------------------
+
+Apache Ignite MQTT module provides a streamer to consume MQTT topic messages into
+Apache Ignite caches.
+
+Importing Apache Ignite MQTT Module In Maven Project
+----------------------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add the MQTT module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    ...
+    <dependencies>
+        ...
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-mqtt</artifactId>
+            <version>${ignite.version}</version>
+        </dependency>
+        ...
+    </dependencies>
+    ...
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/722fe14a/modules/zookeeper/README.txt
----------------------------------------------------------------------
diff --git a/modules/zookeeper/README.txt b/modules/zookeeper/README.txt
new file mode 100644
index 0000000..6d400ad
--- /dev/null
+++ b/modules/zookeeper/README.txt
@@ -0,0 +1,29 @@
+Apache Ignite ZooKeeper Module
+------------------------------
+
+Apache Ignite ZooKeeper module provides a TCP Discovery IP Finder that uses a ZooKeeper
+directory to locate other Ignite nodes to connect to.
+
+Importing Apache Ignite ZooKeeper Module In Maven Project
+---------------------------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add the ZooKeeper
+module dependency like this (replace '${ignite.version}' with actual Ignite version you
+are interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    ...
+    <dependencies>
+        ...
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-zookeeper</artifactId>
+            <version>${ignite.version}</version>
+        </dependency>
+        ...
+    </dependencies>
+    ...
+</project>


[19/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1282
Commit: 30c9b8dbdff3f635525c4d8a3d6442ef2e87b754
Parents: 60d9ddc bde1d1d
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Nov 27 12:29:42 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Nov 27 12:29:42 2015 +0300

----------------------------------------------------------------------
 modules/yarn/pom.xml                                     |  6 +++---
 .../ignite/yarn/IgniteApplicationMasterSelfTest.java     | 11 +++++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[32/50] [abbrv] ignite git commit: Fixed scalar examples

Posted by ag...@apache.org.
Fixed scalar examples


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

Branch: refs/heads/ignite-1282
Commit: 9c46fa961bb88524fcd6c8ccb85c28f8688758b8
Parents: 91f3f87
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Nov 27 14:12:43 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Nov 27 14:12:43 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/BinaryReaderExImpl.java   |  2 +-
 .../ignite/internal/portable/PortableUtils.java |  6 +--
 .../processors/cache/CacheInvokeResult.java     | 14 ++++++
 .../dht/atomic/GridDhtAtomicCache.java          | 50 ++++++++++++++++++--
 .../cache/GridCacheAbstractFullApiSelfTest.java |  2 +-
 5 files changed, 66 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
index 872d7a3..3cc2fbe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
@@ -1616,7 +1616,7 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
                 break;
 
             case OPTM_MARSH:
-                obj = PortableUtils.doReadOptimized(in, ctx);
+                obj = PortableUtils.doReadOptimized(in, ctx, ldr);
 
                 break;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index e543c41..1a8f156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -1498,13 +1498,13 @@ public class PortableUtils {
      *
      * @return Result.
      */
-    public static Object doReadOptimized(PortableInputStream in, PortableContext ctx) {
+    public static Object doReadOptimized(PortableInputStream in, PortableContext ctx, @Nullable ClassLoader clsLdr) {
         int len = in.readInt();
 
         ByteArrayInputStream input = new ByteArrayInputStream(in.array(), in.position(), len);
 
         try {
-            return ctx.optimizedMarsh().unmarshal(input, null);
+            return ctx.optimizedMarsh().unmarshal(input, clsLdr);
         }
         catch (IgniteCheckedException e) {
             throw new BinaryObjectException("Failed to unmarshal object with optimized marshaller", e);
@@ -1706,7 +1706,7 @@ public class PortableUtils {
                 return doReadClass(in, ctx, ldr);
 
             case OPTM_MARSH:
-                return doReadOptimized(in, ctx);
+                return doReadOptimized(in, ctx, ldr);
 
             default:
                 throw new BinaryObjectException("Invalid flag value: " + flag);

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
index 8d6d905..48dabb9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
@@ -64,6 +64,20 @@ public class CacheInvokeResult<T> implements EntryProcessorResult<T>, Externaliz
     }
 
     /**
+     * @return Result.
+     */
+    public T result() {
+        return res;
+    }
+
+    /**
+     * Entry processor error;
+     */
+    public Exception error() {
+        return err;
+    }
+
+    /**
      * Static constructor.
      *
      * @param err Exception thrown by {@link EntryProcessor#process(MutableEntry, Object...)}.

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index cd76a56..028f477 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -724,7 +724,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /** {@inheritDoc} */
     @Override public <T> EntryProcessorResult<T> invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... args)
         throws IgniteCheckedException {
-        EntryProcessorResult<T> res = invokeAsync(key, entryProcessor, args).get();
+        IgniteInternalFuture<EntryProcessorResult<T>> invokeFut = invokeAsync(key, entryProcessor, args);
+
+        EntryProcessorResult<T> res = invokeFut.get();
 
         return res != null ? res : new CacheInvokeResult<T>();
     }
@@ -750,6 +752,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         Map<? extends K, EntryProcessor> invokeMap =
             Collections.singletonMap(key, (EntryProcessor)entryProcessor);
 
+        CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+        final boolean keepBinary = opCtx != null && opCtx.isKeepBinary();
+
         IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> fut = updateAllAsync0(null,
             invokeMap,
             args,
@@ -768,7 +774,17 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                 if (resMap != null) {
                     assert resMap.isEmpty() || resMap.size() == 1 : resMap.size();
 
-                    return resMap.isEmpty() ? null : resMap.values().iterator().next();
+                    EntryProcessorResult<T> res = resMap.isEmpty() ? null : resMap.values().iterator().next();
+
+                    if (res instanceof CacheInvokeResult) {
+                        CacheInvokeResult invokeRes = (CacheInvokeResult)res;
+
+                        if (invokeRes.result() != null)
+                            res = CacheInvokeResult.fromResult((T)ctx.unwrapPortableIfNeeded(invokeRes.result(),
+                                keepBinary));
+                    }
+
+                    return res;
                 }
 
                 return null;
@@ -792,7 +808,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         });
 
-        return updateAllAsync0(null,
+        CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+        final boolean keepBinary = opCtx != null && opCtx.isKeepBinary();
+
+        IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> resFut = updateAllAsync0(null,
             invokeMap,
             args,
             null,
@@ -801,6 +821,30 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             false,
             null,
             true);
+
+        return resFut.chain(new CX1<IgniteInternalFuture<Map<K, EntryProcessorResult<T>>>, Map<K, EntryProcessorResult<T>>>() {
+            @Override public Map<K, EntryProcessorResult<T>> applyx(IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> fut) throws IgniteCheckedException {
+                Map<K, EntryProcessorResult<T>> resMap = fut.get();
+
+                if (resMap != null) {
+                    return F.viewReadOnly(resMap, new C1<EntryProcessorResult<T>, EntryProcessorResult<T>>() {
+                        @Override public EntryProcessorResult<T> apply(EntryProcessorResult<T> res) {
+                            if (res instanceof CacheInvokeResult) {
+                                CacheInvokeResult invokeRes = (CacheInvokeResult)res;
+
+                                if (invokeRes.result() != null)
+                                    res = CacheInvokeResult.fromResult((T)ctx.unwrapPortableIfNeeded(invokeRes.result(),
+                                        keepBinary));
+                            }
+
+                            return res;
+                        }
+                    });
+                }
+
+                return null;
+            }
+        });
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index c10f81a..084fe83 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -2408,7 +2408,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         assert oldVal != null && F.eq(val1, oldVal);
 
-        assert cache.remove("key1", val1);
+        assert cache.remove("key1");
 
         assert cache.get("key1") == null;
 


[31/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1282
Commit: 91f3f87524acb278726e6d6f1e27d4cfdc56a15a
Parents: 2806393 857c63e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 13:21:59 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 13:21:59 2015 +0300

----------------------------------------------------------------------
 ...gniteAtomicLongChangingTopologySelfTest.java |   8 +-
 modules/jms11/licenses/apache-2.0.txt           | 202 +++++++++++++++++++
 modules/kafka/README.txt                        |  32 +++
 modules/mqtt/licenses/apache-2.0.txt            | 202 +++++++++++++++++++
 modules/zookeeper/licenses/apache-2.0.txt       | 202 +++++++++++++++++++
 5 files changed, 645 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[18/50] [abbrv] ignite git commit: IGNITE-529: Fixed README

Posted by ag...@apache.org.
IGNITE-529: Fixed README

Signed-off-by: Anton Vinogradov <av...@apache.org>


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

Branch: refs/heads/ignite-1282
Commit: 60d9ddc091d17fa2b246b0525b54d772345c3d11
Parents: e9f22ab
Author: shtykh_roman <rs...@yahoo.com>
Authored: Thu Nov 26 11:40:48 2015 +0900
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Nov 27 12:28:50 2015 +0300

----------------------------------------------------------------------
 modules/flume/README.txt | 44 ++++++++++---------------------------------
 1 file changed, 10 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/60d9ddc0/modules/flume/README.txt
----------------------------------------------------------------------
diff --git a/modules/flume/README.txt b/modules/flume/README.txt
index 5b574e3..bf7e0ff 100644
--- a/modules/flume/README.txt
+++ b/modules/flume/README.txt
@@ -1,42 +1,18 @@
-Apache Ignite Flume Streamer Module
-------------------------
+Apache Ignite Flume Sink Module
+-------------------------------
 
-Apache Ignite Flume Streamer module provides streaming from Flume to Ignite cache.
-
-To enable Flume Streamer module when starting a standalone node, move 'optional/ignite-Flume' folder to
-'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
-be added to classpath in this case.
-
-Importing Ignite Flume Streamer Module In Maven Project
--------------------------------------
-
-If you are using Maven to manage dependencies of your project, you can add JCL module
-dependency like this (replace '${ignite.version}' with actual Ignite version you are
-interested in):
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
-                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    ...
-    <dependencies>
-        ...
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-Flume</artifactId>
-            <version>${ignite.version}</version>
-        </dependency>
-        ...
-    </dependencies>
-    ...
-</project>
+IgniteSink is a Flume sink that extracts Events from an associated Flume channel and injects into an Ignite cache.
+Flume 1.6.0 is supported.
 
+IgniteSink, which can be found in 'optional/ignite-flume', and its dependencies have to be included in the agent's classpath,
+as described in the following subsection, before starting the Flume agent.
 
 ## Setting up and running
 
 1. Create a transformer by implementing EventTransformer interface.
-2. Build it and copy to ${FLUME_HOME}/plugins.d/ignite-sink/lib.
-3. Copy other Ignite-related jar files to ${FLUME_HOME}/plugins.d/ignite-sink/libext to have them as shown below.
+2. Create 'ignite' directory inside plugins.d directory which is located in ${FLUME_HOME}. If the plugins.d directory is not there, create it.
+3. Build it and copy to ${FLUME_HOME}/plugins.d/ignite-sink/lib.
+4. Copy other Ignite-related jar files from Apache Ignite distribution to ${FLUME_HOME}/plugins.d/ignite-sink/libext to have them as shown below.
 
 ```
 plugins.d/
@@ -46,7 +22,7 @@ plugins.d/
     `-- libext
         |-- cache-api-1.0.0.jar
         |-- ignite-core-x.x.x.jar
-        |-- ignite-flume-x.x.x.jar
+        |-- ignite-flume-x.x.x.jar <-- IgniteSink
         |-- ignite-spring-x.x.x.jar
         |-- spring-aop-4.1.0.RELEASE.jar
         |-- spring-beans-4.1.0.RELEASE.jar


[28/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1282
Commit: 857c63e79ef5aa34c8213d4c1ecb298866724727
Parents: 712e62b fa8e478
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 13:13:17 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 13:13:17 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteBinary.java    |   9 +
 .../org/apache/ignite/binary/BinaryObject.java  |   8 +
 .../org/apache/ignite/binary/BinaryType.java    |   7 +
 .../ignite/binary/BinaryTypeConfiguration.java  |  21 +
 .../communication/GridIoMessageFactory.java     |   8 +-
 .../internal/portable/BinaryEnumObjectImpl.java | 311 +++++++++++++
 .../internal/portable/BinaryMetadata.java       |  16 +-
 .../internal/portable/BinaryObjectExImpl.java   |   5 +
 .../internal/portable/BinaryObjectImpl.java     |   3 -
 .../internal/portable/BinaryTypeImpl.java       |   9 +-
 .../internal/portable/BinaryWriteMode.java      |   3 +
 .../internal/portable/BinaryWriterExImpl.java   |  19 +
 .../portable/PortableClassDescriptor.java       |  23 +-
 .../internal/portable/PortableContext.java      |  39 +-
 .../ignite/internal/portable/PortableUtils.java | 147 +++++-
 .../builder/BinaryObjectBuilderImpl.java        |   2 +-
 .../builder/PortableBuilderSerializer.java      |  10 +-
 .../internal/processors/cache/CacheObject.java  |   3 +
 .../processors/cache/CacheObjectContext.java    |  19 +
 .../portable/CacheObjectBinaryProcessor.java    |  11 +-
 .../CacheObjectBinaryProcessorImpl.java         |  18 +-
 .../cache/portable/IgniteBinaryImpl.java        |  12 +
 .../processors/cacheobject/NoOpBinary.java      |   5 +
 .../platform/PlatformContextImpl.java           |  53 ++-
 .../transactions/PlatformTransactions.java      |   4 +-
 .../platform/utils/PlatformUtils.java           |   1 +
 .../PlatformDotNetBinaryTypeConfiguration.java  |  23 +
 .../internal/portable/BinaryEnumsSelfTest.java  | 446 +++++++++++++++++++
 .../portable/BinaryMarshallerSelfTest.java      |  37 +-
 .../platform/PlatformComputeEchoTask.java       |   4 +-
 .../IgnitePortableObjectsTestSuite.java         |   2 +
 modules/jms11/licenses/apache-2.0.txt           | 202 +++++++++
 modules/kafka/README.txt                        |  32 ++
 modules/mqtt/licenses/apache-2.0.txt            | 202 +++++++++
 .../impl/binary/binary_type_updater_impl.cpp    |   4 +-
 .../Binary/BinaryBuilderSelfTest.cs             |  97 ++--
 .../Binary/BinarySelfTest.cs                    |  48 +-
 .../Cache/CacheAbstractTest.cs                  |  17 +-
 .../Compute/ComputeApiTest.cs                   |   6 +
 .../Config/Compute/compute-grid1.xml            |   3 +-
 .../Config/native-client-test-cache-store.xml   |   1 +
 .../Services/ServiceProxyTest.cs                |  22 +-
 .../Apache.Ignite.Core.csproj                   |   5 +-
 .../Binary/BinaryTypeConfiguration.cs           |  16 +-
 .../dotnet/Apache.Ignite.Core/Binary/IBinary.cs | 136 ++++++
 .../Apache.Ignite.Core/Binary/IBinaryObject.cs  |  23 +-
 .../Apache.Ignite.Core/Binary/IBinaryType.cs    |  13 +
 .../Apache.Ignite.Core/Binary/IIgniteBinary.cs  | 120 -----
 .../dotnet/Apache.Ignite.Core/IIgnite.cs        |   6 +-
 .../Apache.Ignite.Core/Impl/Binary/Binary.cs    | 216 +++++++++
 .../Impl/Binary/BinaryEnum.cs                   | 134 ++++++
 .../Impl/Binary/BinaryFullTypeDescriptor.cs     |  14 +-
 .../Impl/Binary/BinaryObject.cs                 |  29 ++
 .../Impl/Binary/BinaryObjectBuilder.cs          |  44 +-
 .../Impl/Binary/BinaryReader.cs                 |  51 ++-
 .../Binary/BinarySurrogateTypeDescriptor.cs     |   6 +
 .../Impl/Binary/BinarySystemHandlers.cs         |  34 +-
 .../Impl/Binary/BinaryUtils.cs                  |  96 ++--
 .../Impl/Binary/BinaryWriter.cs                 | 104 +++--
 .../Impl/Binary/IBinaryTypeDescriptor.cs        |  50 +--
 .../Impl/Binary/IgniteBinary.cs                 | 192 --------
 .../Impl/Binary/Marshaller.cs                   |  88 ++--
 .../Impl/Binary/Metadata/BinaryType.cs          | 184 ++++----
 .../Impl/Binary/Metadata/BinaryTypeHolder.cs    |  34 +-
 .../Binary/Structure/BinaryStructureTracker.cs  |   2 +-
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |  11 +-
 .../Apache.Ignite.Core/Impl/IgniteProxy.cs      |   2 +-
 .../Apache.Ignite.Core/Impl/PlatformTarget.cs   |  11 +-
 .../Impl/Transactions/TransactionsImpl.cs       |   4 +-
 .../examples/Config/example-cache-query.xml     |   9 +-
 .../dotnet/examples/Config/example-cache.xml    |   9 +-
 modules/zookeeper/licenses/apache-2.0.txt       | 202 +++++++++
 72 files changed, 2992 insertions(+), 765 deletions(-)
----------------------------------------------------------------------



[50/50] [abbrv] ignite git commit: Fixing metadata update under changing topology.

Posted by ag...@apache.org.
Fixing metadata update under changing topology.


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

Branch: refs/heads/ignite-1282
Commit: 6ef7fb604f6e56e9ea72d3ef6d6ce199564c1c41
Parents: ee5d9fd
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Sat Nov 28 15:56:22 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sat Nov 28 15:56:22 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/BinaryEnumObjectImpl.java |   2 +-
 .../internal/portable/BinaryReaderExImpl.java   |   6 +-
 .../internal/portable/BinaryWriterExImpl.java   |  10 +-
 .../internal/portable/PortableContext.java      |  31 ++-
 .../ignite/internal/portable/PortableUtils.java |  10 +-
 .../builder/BinaryObjectBuilderImpl.java        |   2 +-
 .../portable/builder/PortableBuilderEnum.java   |   2 +-
 .../builder/PortableEnumArrayLazyValue.java     |   2 +-
 .../builder/PortableObjectArrayLazyValue.java   |   2 +-
 .../colocated/GridDhtColocatedLockFuture.java   |  17 +-
 .../distributed/near/GridNearLockFuture.java    |  17 +-
 ...arOptimisticSerializableTxPrepareFuture.java |  12 +-
 .../near/GridNearOptimisticTxPrepareFuture.java | 134 +++++-----
 .../cache/transactions/IgniteTxManager.java     |  22 +-
 .../portable/BinaryMarshallerSelfTest.java      |   2 +-
 ...yMetadataUpdateChangingTopologySelfTest.java | 245 +++++++++++++++++++
 .../replicated/GridReplicatedTxPreloadTest.java |   6 +
 .../IgnitePortableObjectsTestSuite.java         |   2 +
 18 files changed, 425 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
index e13c076..467d767 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
@@ -110,7 +110,7 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public <T> T deserialize() throws BinaryObjectException {
-        Class cls = PortableUtils.resolveClass(ctx, typeId, clsName, null);
+        Class cls = PortableUtils.resolveClass(ctx, typeId, clsName, null, true);
 
         return BinaryEnumCache.get(cls, ord);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
index 3cc2fbe..b9f851c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
@@ -234,7 +234,7 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
                 int off = in.position();
 
                 // Registers class by type ID, at least locally if the cache is not ready yet.
-                typeId = ctx.descriptorForClass(PortableUtils.doReadClass(in, ctx, ldr, typeId0)).typeId();
+                typeId = ctx.descriptorForClass(PortableUtils.doReadClass(in, ctx, ldr, typeId0), false).typeId();
 
                 int clsNameLen = in.position() - off;
 
@@ -277,7 +277,7 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
      * @return Descriptor.
      */
     PortableClassDescriptor descriptor() {
-        return ctx.descriptorForTypeId(userType, typeId, ldr);
+        return ctx.descriptorForTypeId(userType, typeId, ldr, true);
     }
 
     /**
@@ -1427,7 +1427,7 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
                 break;
 
             case OBJ:
-                PortableClassDescriptor desc = ctx.descriptorForTypeId(userType, typeId, ldr);
+                PortableClassDescriptor desc = ctx.descriptorForTypeId(userType, typeId, ldr, true);
 
                 streamPosition(dataStart);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
index 9d1d037..95807ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
@@ -182,7 +182,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
 
         Class<?> cls = obj.getClass();
 
-        PortableClassDescriptor desc = ctx.descriptorForClass(cls);
+        PortableClassDescriptor desc = ctx.descriptorForClass(cls, false);
 
         if (desc == null)
             throw new BinaryObjectException("Object is not portable: [class=" + cls + ']');
@@ -697,7 +697,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
             if (tryWriteAsHandle(val))
                 return;
 
-            PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass().getComponentType());
+            PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass().getComponentType(), false);
 
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(OBJ_ARR);
@@ -785,7 +785,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass());
+            PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass(), false);
 
             out.unsafeEnsure(1 + 4);
 
@@ -830,7 +830,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass().getComponentType());
+            PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass().getComponentType(), false);
 
             out.unsafeEnsure(1 + 4);
 
@@ -859,7 +859,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            PortableClassDescriptor desc = ctx.descriptorForClass(val);
+            PortableClassDescriptor desc = ctx.descriptorForClass(val, false);
 
             out.unsafeEnsure(1 + 4);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/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 ae0d940..1482df9 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
@@ -402,14 +402,14 @@ public class PortableContext implements Externalizable {
      * @return Class descriptor.
      * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
-    public PortableClassDescriptor descriptorForClass(Class<?> cls)
+    public PortableClassDescriptor descriptorForClass(Class<?> cls, boolean deserialize)
         throws BinaryObjectException {
         assert cls != null;
 
         PortableClassDescriptor desc = descByCls.get(cls);
 
         if (desc == null || !desc.registered())
-            desc = registerClassDescriptor(cls);
+            desc = registerClassDescriptor(cls, deserialize);
 
         return desc;
     }
@@ -420,7 +420,12 @@ public class PortableContext implements Externalizable {
      * @param ldr Class loader.
      * @return Class descriptor.
      */
-    public PortableClassDescriptor descriptorForTypeId(boolean userType, int typeId, ClassLoader ldr) {
+    public PortableClassDescriptor descriptorForTypeId(
+        boolean userType,
+        int typeId,
+        ClassLoader ldr,
+        boolean deserialize
+    ) {
         assert typeId != GridPortableMarshaller.UNREGISTERED_TYPE_ID;
 
         //TODO: As a workaround for IGNITE-1358 we always check the predefined map before without checking 'userType'
@@ -450,21 +455,21 @@ public class PortableContext implements Externalizable {
         }
         catch (ClassNotFoundException e) {
             // Class might have been loaded by default class loader.
-            if (userType && !ldr.equals(dfltLdr) && (desc = descriptorForTypeId(true, typeId, dfltLdr)) != null)
+            if (userType && !ldr.equals(dfltLdr) && (desc = descriptorForTypeId(true, typeId, dfltLdr, deserialize)) != null)
                 return desc;
 
             throw new BinaryInvalidTypeException(e);
         }
         catch (IgniteCheckedException e) {
             // Class might have been loaded by default class loader.
-            if (userType && !ldr.equals(dfltLdr) && (desc = descriptorForTypeId(true, typeId, dfltLdr)) != null)
+            if (userType && !ldr.equals(dfltLdr) && (desc = descriptorForTypeId(true, typeId, dfltLdr, deserialize)) != null)
                 return desc;
 
             throw new BinaryObjectException("Failed resolve class for ID: " + typeId, e);
         }
 
         if (desc == null) {
-            desc = registerClassDescriptor(cls);
+            desc = registerClassDescriptor(cls, deserialize);
 
             assert desc.typeId() == typeId;
         }
@@ -478,7 +483,7 @@ public class PortableContext implements Externalizable {
      * @param cls Class.
      * @return Class descriptor.
      */
-    private PortableClassDescriptor registerClassDescriptor(Class<?> cls) {
+    private PortableClassDescriptor registerClassDescriptor(Class<?> cls, boolean deserialize) {
         PortableClassDescriptor desc;
 
         String clsName = cls.getName();
@@ -503,7 +508,7 @@ public class PortableContext implements Externalizable {
                 desc = old;
         }
         else
-            desc = registerUserClassDescriptor(cls);
+            desc = registerUserClassDescriptor(cls, deserialize);
 
         return desc;
     }
@@ -514,7 +519,7 @@ public class PortableContext implements Externalizable {
      * @param cls Class.
      * @return Class descriptor.
      */
-    private PortableClassDescriptor registerUserClassDescriptor(Class<?> cls) {
+    private PortableClassDescriptor registerUserClassDescriptor(Class<?> cls, boolean deserialize) {
         boolean registered;
 
         String typeName = typeName(cls.getName());
@@ -545,10 +550,12 @@ public class PortableContext implements Externalizable {
             false /* predefined */
         );
 
-        Collection<PortableSchema> schemas = desc.schema() != null ? Collections.singleton(desc.schema()) : null;
+        if (!deserialize) {
+            Collection<PortableSchema> schemas = desc.schema() != null ? Collections.singleton(desc.schema()) : null;
 
-        metaHnd.addMeta(typeId, 
-            new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, schemas, desc.isEnum()).wrap(this));
+            metaHnd.addMeta(typeId,
+                new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, schemas, desc.isEnum()).wrap(this));
+        }
 
         // perform put() instead of putIfAbsent() because "registered" flag might have been changed or class loader
         // might have reloaded described class.

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index 1a8f156..5d794ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -1366,7 +1366,7 @@ public class PortableUtils {
             return Object.class;
 
         if (typeId != UNREGISTERED_TYPE_ID)
-            cls = ctx.descriptorForTypeId(true, typeId, ldr).describedClass();
+            cls = ctx.descriptorForTypeId(true, typeId, ldr, false).describedClass();
         else {
             String clsName = doReadClassName(in);
 
@@ -1378,7 +1378,7 @@ public class PortableUtils {
             }
 
             // forces registering of class by type id, at least locally
-            ctx.descriptorForClass(cls);
+            ctx.descriptorForClass(cls, true);
         }
 
         return cls;
@@ -1394,14 +1394,14 @@ public class PortableUtils {
      * @return Resovled class.
      */
     public static Class resolveClass(PortableContext ctx, int typeId, @Nullable String clsName,
-        @Nullable ClassLoader ldr) {
+        @Nullable ClassLoader ldr, boolean deserialize) {
         Class cls;
 
         if (typeId == OBJECT_TYPE_ID)
             return Object.class;
 
         if (typeId != UNREGISTERED_TYPE_ID)
-            cls = ctx.descriptorForTypeId(true, typeId, ldr).describedClass();
+            cls = ctx.descriptorForTypeId(true, typeId, ldr, deserialize).describedClass();
         else {
             try {
                 cls = U.forName(clsName, ldr);
@@ -1411,7 +1411,7 @@ public class PortableUtils {
             }
 
             // forces registering of class by type id, at least locally
-            ctx.descriptorForClass(cls);
+            ctx.descriptorForClass(cls, true);
         }
 
         return cls;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
index 5c2c713..caf3b88 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
@@ -161,7 +161,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
                 throw new BinaryInvalidTypeException("Failed to load the class: " + clsNameToWrite, e);
             }
 
-            this.typeId = ctx.descriptorForClass(cls).typeId();
+            this.typeId = ctx.descriptorForClass(cls, false).typeId();
 
             registeredType = false;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
index 9eb77b4..6f79e73 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
@@ -64,7 +64,7 @@ public class PortableBuilderEnum implements PortableBuilderSerializationAware {
                 throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
             }
 
-            this.typeId = reader.portableContext().descriptorForClass(cls).typeId();
+            this.typeId = reader.portableContext().descriptorForClass(cls, false).typeId();
         }
         else {
             this.typeId = typeId;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
index 1e2ebc9..91c1c87 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
@@ -57,7 +57,7 @@ class PortableEnumArrayLazyValue extends PortableAbstractLazyValue {
                 throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
             }
 
-            compTypeId = reader.portableContext().descriptorForClass(cls).typeId();
+            compTypeId = reader.portableContext().descriptorForClass(cls, true).typeId();
         }
         else {
             compTypeId = typeId;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
index 6634eea..8c8022b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
@@ -56,7 +56,7 @@ class PortableObjectArrayLazyValue extends PortableAbstractLazyValue {
                 throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
             }
 
-            compTypeId = reader.portableContext().descriptorForClass(cls).typeId();
+            compTypeId = reader.portableContext().descriptorForClass(cls, true).typeId();
         }
         else {
             compTypeId = typeId;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index ecdf641..d3028ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -977,12 +977,27 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
     }
 
     /**
+     * @throws IgniteCheckedException If failed.
+     */
+    private void proceedMapping() throws IgniteCheckedException {
+        boolean set = tx != null && cctx.shared().tm().setTxTopologyHint(tx);
+
+        try {
+            proceedMapping0();
+        }
+        finally {
+            if (set)
+                cctx.tm().setTxTopologyHint(null);
+        }
+    }
+
+    /**
      * Gets next near lock mapping and either acquires dht locks locally or sends near lock request to
      * remote primary node.
      *
      * @throws IgniteCheckedException If mapping can not be completed.
      */
-    private void proceedMapping()
+    private void proceedMapping0()
         throws IgniteCheckedException {
         GridNearLockMapping map;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index f1f9990..417303b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -1082,13 +1082,28 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
     }
 
     /**
+     * @throws IgniteCheckedException If failed.
+     */
+    private void proceedMapping() throws IgniteCheckedException {
+        boolean set = tx != null && cctx.shared().tm().setTxTopologyHint(tx);
+
+        try {
+            proceedMapping0();
+        }
+        finally {
+            if (set)
+                cctx.tm().setTxTopologyHint(null);
+        }
+    }
+
+    /**
      * Gets next near lock mapping and either acquires dht locks locally or sends near lock request to
      * remote primary node.
      *
      * @throws IgniteCheckedException If mapping can not be completed.
      */
     @SuppressWarnings("unchecked")
-    private void proceedMapping()
+    private void proceedMapping0()
         throws IgniteCheckedException {
         GridNearLockMapping map;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
index 916c7ab..f52b3fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
@@ -304,9 +304,17 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
             return;
         }
 
-        prepare(tx.readEntries(), tx.writeEntries(), remap, topLocked);
+        boolean set = cctx.tm().setTxTopologyHint(tx);
 
-        markInitialized();
+        try {
+            prepare(tx.readEntries(), tx.writeEntries(), remap, topLocked);
+
+            markInitialized();
+        }
+        finally {
+            if (set)
+                cctx.tm().setTxTopologyHint(null);
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index ca1d36c..2ce14af 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -405,82 +405,90 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
         if (isDone())
             return;
 
-        assert !m.empty();
-
-        final ClusterNode n = m.node();
-
-        GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
-            futId,
-            tx.topologyVersion(),
-            tx,
-            null,
-            m.writes(),
-            m.near(),
-            txMapping.transactionNodes(),
-            m.last(),
-            tx.onePhaseCommit(),
-            tx.needReturnValue() && tx.implicit(),
-            tx.implicitSingle(),
-            m.explicitLock(),
-            tx.subjectId(),
-            tx.taskNameHash(),
-            m.clientFirst(),
-            tx.activeCachesDeploymentEnabled());
-
-        for (IgniteTxEntry txEntry : m.writes()) {
-            if (txEntry.op() == TRANSFORM)
-                req.addDhtVersion(txEntry.txKey(), null);
-        }
-
-        // Must lock near entries separately.
-        if (m.near()) {
-            try {
-                tx.optimisticLockEntries(req.writes());
+        boolean set = cctx.tm().setTxTopologyHint(tx);
 
-                tx.userPrepare();
+        try {
+            assert !m.empty();
+
+            final ClusterNode n = m.node();
+
+            GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
+                futId,
+                tx.topologyVersion(),
+                tx,
+                null,
+                m.writes(),
+                m.near(),
+                txMapping.transactionNodes(),
+                m.last(),
+                tx.onePhaseCommit(),
+                tx.needReturnValue() && tx.implicit(),
+                tx.implicitSingle(),
+                m.explicitLock(),
+                tx.subjectId(),
+                tx.taskNameHash(),
+                m.clientFirst(),
+                tx.activeCachesDeploymentEnabled());
+
+            for (IgniteTxEntry txEntry : m.writes()) {
+                if (txEntry.op() == TRANSFORM)
+                    req.addDhtVersion(txEntry.txKey(), null);
             }
-            catch (IgniteCheckedException e) {
-                onError(e);
+
+            // Must lock near entries separately.
+            if (m.near()) {
+                try {
+                    tx.optimisticLockEntries(req.writes());
+
+                    tx.userPrepare();
+                }
+                catch (IgniteCheckedException e) {
+                    onError(e);
+                }
             }
-        }
 
-        final MiniFuture fut = new MiniFuture(m, mappings);
+            final MiniFuture fut = new MiniFuture(m, mappings);
 
-        req.miniId(fut.futureId());
+            req.miniId(fut.futureId());
 
-        add(fut); // Append new future.
+            add(fut); // Append new future.
 
-        // If this is the primary node for the keys.
-        if (n.isLocal()) {
-            // At this point, if any new node joined, then it is
-            // waiting for this transaction to complete, so
-            // partition reassignments are not possible here.
-            IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = cctx.tm().txHandler().prepareTx(n.id(), tx, req);
+            // If this is the primary node for the keys.
+            if (n.isLocal()) {
+                // At this point, if any new node joined, then it is
+                // waiting for this transaction to complete, so
+                // partition reassignments are not possible here.
+                IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = cctx.tm().txHandler().prepareTx(n.id(), tx, req);
 
-            prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
-                @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
-                    try {
-                        fut.onResult(n.id(), prepFut.get());
-                    }
-                    catch (IgniteCheckedException e) {
-                        fut.onResult(e);
+                prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
+                    @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
+                        try {
+                            fut.onResult(n.id(), prepFut.get());
+                        }
+                        catch (IgniteCheckedException e) {
+                            fut.onResult(e);
+                        }
                     }
-                }
-            });
-        }
-        else {
-            try {
-                cctx.io().send(n, req, tx.ioPolicy());
+                });
             }
-            catch (ClusterTopologyCheckedException e) {
-                e.retryReadyFuture(cctx.nextAffinityReadyFuture(tx.topologyVersion()));
+            else {
+                try {
+                    cctx.io().send(n, req, tx.ioPolicy());
+                }
+                catch (ClusterTopologyCheckedException e) {
+                    e.retryReadyFuture(cctx.nextAffinityReadyFuture(tx.topologyVersion()));
 
-                fut.onResult(e);
-            }
-            catch (IgniteCheckedException e) {
-                fut.onResult(e);
+                    fut.onResult(e);
+                }
+                catch (IgniteCheckedException e) {
+                    fut.onResult(e);
+                }
             }
         }
+        finally {
+            if (set)
+                cctx.tm().setTxTopologyHint(null);
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 421b0e6..243c4cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -114,6 +114,9 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     /** Committing transactions. */
     private final ThreadLocal<IgniteInternalTx> threadCtx = new ThreadLocal<>();
 
+    /** Transaction which topology version should be used when mapping internal tx. */
+    private final ThreadLocal<IgniteInternalTx> txTopology = new ThreadLocal<>();
+
     /** Per-thread transaction map. */
     private final ConcurrentMap<Long, IgniteInternalTx> threadMap = newMap();
 
@@ -622,7 +625,24 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
                 return tx;
         }
 
-        return null;
+        return txTopology.get();
+    }
+
+    /**
+     * @param tx Transaction.
+     */
+    public boolean setTxTopologyHint(IgniteInternalTx tx) {
+        if (tx == null)
+            txTopology.remove();
+        else {
+            if (txTopology.get() == null) {
+                txTopology.set(tx);
+
+                return true;
+            }
+        }
+
+        return false;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index ad0dcf2..cc035f6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -2105,7 +2105,7 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
             if (id == GridPortableMarshaller.UNREGISTERED_TYPE_ID)
                 continue;
 
-            PortableClassDescriptor desc = pCtx.descriptorForTypeId(false, entry.getValue(), null);
+            PortableClassDescriptor desc = pCtx.descriptorForTypeId(false, entry.getValue(), null, false);
 
             assertEquals(desc.typeId(), pCtx.typeId(desc.describedClass().getName()));
             assertEquals(desc.typeId(), pCtx.typeId(pCtx.typeName(desc.describedClass().getName())));

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
new file mode 100644
index 0000000..e53650c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteNodeAttributes;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Tests specific scenario when binary metadata should be updated from a system thread
+ * and topology has been already changed since the original transaction start.
+ */
+public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setMarshaller(null);
+
+        CacheConfiguration ccfg = new CacheConfiguration("cache");
+
+        ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+        ccfg.setBackups(1);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        cfg.setCommunicationSpi(new TestCommunicationSpi());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrids(4);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNoDeadlockOptimistic() throws Exception {
+        int key1 = primaryKey(ignite(1).cache("cache"));
+        int key2 = primaryKey(ignite(2).cache("cache"));
+
+        TestCommunicationSpi spi = (TestCommunicationSpi)ignite(1).configuration().getCommunicationSpi();
+
+        spi.blockMessages(GridNearTxPrepareResponse.class, ignite(0).cluster().localNode().id());
+
+        IgniteCache<Object, Object> cache = ignite(0).cache("cache").withAsync();
+
+        cache.putAll(F.asMap(key1, "val1", key2, new TestValue()));
+
+        try {
+            Thread.sleep(500);
+
+            IgniteInternalFuture<Void> fut = GridTestUtils.runAsync(new Callable<Void>() {
+                @Override public Void call() throws Exception {
+                    startGrid(4);
+
+                    return null;
+                }
+            });
+
+            Thread.sleep(500);
+
+            spi.stopBlock();
+
+            cache.future().get();
+
+            fut.get();
+        }
+        finally {
+            stopGrid(4);
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestCommunicationSpi extends TcpCommunicationSpi {
+        /** */
+        @LoggerResource
+        private IgniteLogger log;
+
+        /** */
+        private List<T2<ClusterNode, GridIoMessage>> blockedMsgs = new ArrayList<>();
+
+        /** */
+        private Map<Class<?>, Set<UUID>> blockCls = new HashMap<>();
+
+        /** */
+        private Class<?> recordCls;
+
+        /** */
+        private List<Object> recordedMsgs = new ArrayList<>();
+
+        /** {@inheritDoc} */
+        @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure)
+            throws IgniteSpiException {
+            if (msg instanceof GridIoMessage) {
+                Object msg0 = ((GridIoMessage)msg).message();
+
+                synchronized (this) {
+                    if (recordCls != null && msg0.getClass().equals(recordCls))
+                        recordedMsgs.add(msg0);
+
+                    Set<UUID> blockNodes = blockCls.get(msg0.getClass());
+
+                    if (F.contains(blockNodes, node.id())) {
+                        log.info("Block message [node=" + node.attribute(IgniteNodeAttributes.ATTR_GRID_NAME) +
+                            ", msg=" + msg0 + ']');
+
+                        blockedMsgs.add(new T2<>(node, (GridIoMessage)msg));
+
+                        return;
+                    }
+                }
+            }
+
+            super.sendMessage(node, msg, ackClosure);
+        }
+
+        /**
+         * @param recordCls Message class to record.
+         */
+        void record(@Nullable Class<?> recordCls) {
+            synchronized (this) {
+                this.recordCls = recordCls;
+            }
+        }
+
+        /**
+         * @return Recorded messages.
+         */
+        List<Object> recordedMessages() {
+            synchronized (this) {
+                List<Object> msgs = recordedMsgs;
+
+                recordedMsgs = new ArrayList<>();
+
+                return msgs;
+            }
+        }
+
+        /**
+         * @param cls Message class.
+         * @param nodeId Node ID.
+         */
+        void blockMessages(Class<?> cls, UUID nodeId) {
+            synchronized (this) {
+                Set<UUID> set = blockCls.get(cls);
+
+                if (set == null) {
+                    set = new HashSet<>();
+
+                    blockCls.put(cls, set);
+                }
+
+                set.add(nodeId);
+            }
+        }
+
+        /**
+         *
+         */
+        void stopBlock() {
+            synchronized (this) {
+                blockCls.clear();
+
+                for (T2<ClusterNode, GridIoMessage> msg : blockedMsgs) {
+                    ClusterNode node = msg.get1();
+
+                    log.info("Send blocked message: [node=" + node.attribute(IgniteNodeAttributes.ATTR_GRID_NAME) +
+                        ", msg=" + msg.get2().message() + ']');
+
+                    sendMessage(msg.get1(), msg.get2());
+                }
+
+                blockedMsgs.clear();
+            }
+        }
+    }
+
+    private static class TestValue {
+        /** Field1. */
+        private String field1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
index e7560c7..126ce61 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.distributed.replicated;
 
 import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteTxPreloadAbstractTest;
 
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -32,6 +33,11 @@ public class GridReplicatedTxPreloadTest extends IgniteTxPreloadAbstractTest {
     }
 
     /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        return super.getConfiguration(gridName).setMarshaller(null);
+    }
+
+    /** {@inheritDoc} */
     @Override public void testLocalTxPreloadingOptimistic() throws Exception {
         fail("https://issues.apache.org/jira/browse/IGNITE-1755");
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ef7fb60/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
index 629835b..62952b5 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.portable.noncompact.BinaryFooterOffsetsOffheap
 import org.apache.ignite.internal.portable.noncompact.BinaryMarshallerNonCompactSelfTest;
 import org.apache.ignite.internal.portable.noncompact.BinaryObjectBuilderAdditionalNonCompactSelfTest;
 import org.apache.ignite.internal.portable.noncompact.BinaryObjectBuilderNonCompactSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteBinaryMetadataUpdateChangingTopologySelfTest;
 import org.apache.ignite.internal.processors.cache.portable.GridCacheClientNodeBinaryObjectMetadataMultinodeTest;
 import org.apache.ignite.internal.processors.cache.portable.GridCacheClientNodeBinaryObjectMetadataTest;
 import org.apache.ignite.internal.processors.cache.portable.GridCachePortableStoreObjectsSelfTest;
@@ -106,6 +107,7 @@ public class IgnitePortableObjectsTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCacheClientNodeBinaryObjectMetadataTest.class);
         suite.addTestSuite(GridCacheClientNodeBinaryObjectMetadataMultinodeTest.class);
+        suite.addTestSuite(IgniteBinaryMetadataUpdateChangingTopologySelfTest.class);
 
         return suite;
     }


[49/50] [abbrv] ignite git commit: Use TcpDiscoveryVmIpFinder.

Posted by ag...@apache.org.
Use TcpDiscoveryVmIpFinder.


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

Branch: refs/heads/ignite-1282
Commit: ee5d9fd8beb3d6bf29ee2e932d4c1fe374e6dffc
Parents: 8a822d8
Author: sboikov <sb...@gridgain.com>
Authored: Sat Nov 28 15:01:57 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Sat Nov 28 15:01:57 2015 +0300

----------------------------------------------------------------------
 .../GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ee5d9fd8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
index f1e427b..321194f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
@@ -40,6 +40,9 @@ import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryReader;
 import org.apache.ignite.binary.BinaryTypeConfiguration;
 import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jsr166.LongAdder8;
 
@@ -50,6 +53,9 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC
  */
 public abstract class GridCacheBinaryObjectsAbstractMultiThreadedSelfTest extends GridCommonAbstractTest {
     /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
     private static final int THREAD_CNT = 64;
 
     /** */
@@ -59,6 +65,8 @@ public abstract class GridCacheBinaryObjectsAbstractMultiThreadedSelfTest extend
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
         CacheConfiguration cacheCfg = new CacheConfiguration();
 
         cacheCfg.setCacheMode(cacheMode());


[16/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5_

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5_


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

Branch: refs/heads/ignite-1282
Commit: e9f22aba2801636a3c8747dde143b9ceefeb669a
Parents: a8edb1e 2d62bbb
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Nov 27 11:34:04 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Nov 27 11:34:04 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  2 +-
 .../internal/GridMultipleJobsSelfTest.java      |  7 ++++++
 .../IgniteClientReconnectCacheTest.java         | 26 ++++++++++++--------
 3 files changed, 24 insertions(+), 11 deletions(-)
----------------------------------------------------------------------



[44/50] [abbrv] ignite git commit: typo fix

Posted by ag...@apache.org.
typo fix


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

Branch: refs/heads/ignite-1282
Commit: fb5d54a6b7b737b9dbf93651a478ed3d7a21e340
Parents: 292de51
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Nov 27 19:51:11 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Nov 27 19:51:11 2015 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fb5d54a6/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 42258f7..4985edb 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -10,7 +10,7 @@ Apache Ignite In-Memory Data Fabric 1.5
 * Added IgniteSemaphore data structure.
 * Added MQTT Streamer.
 * Fixed failover for continuous queries.
-* Fixed compilation and runtime errors under OpnJDK and IBM JDK.
+* Fixed compilation and runtime errors under OpenJDK and IBM JDK.
 * Fixed Integer.size limitation for cache.
 * Fixed and improved cache types configuration.
 * Fixed cache rebalancing.


[14/50] [abbrv] ignite git commit: Fixed test to do not hang if some asserts fail.

Posted by ag...@apache.org.
Fixed test to do not hang if some asserts fail.


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

Branch: refs/heads/ignite-1282
Commit: 2d62bbb96b568b0cf45f29540a2b440f1cbb0a34
Parents: e706216
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 11:07:49 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 11:07:49 2015 +0300

----------------------------------------------------------------------
 .../IgniteClientReconnectCacheTest.java         | 26 ++++++++++++--------
 1 file changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2d62bbb9/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index 3d8f601..14a770a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -723,15 +723,18 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         TestTcpDiscoverySpi srvSpi = spi(srv);
 
-        assertTrue(joinLatch.await(5000, MILLISECONDS));
-
-        U.sleep(1000);
+        try {
+            assertTrue(joinLatch.await(5000, MILLISECONDS));
 
-        assertNotDone(fut);
+            U.sleep(1000);
 
-        srvSpi.failNode(clientId, null);
+            assertNotDone(fut);
 
-        srvCommSpi.stopBlock(false);
+            srvSpi.failNode(clientId, null);
+        }
+        finally {
+            srvCommSpi.stopBlock(false);
+        }
 
         assertTrue(fut.get());
     }
@@ -1286,10 +1289,13 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         srvSpi.failNode(client.localNode().id(), null);
 
-        fut.get();
-
-        for (int i = 0; i < SRV_CNT; i++)
-            ((TestCommunicationSpi)grid(i).configuration().getCommunicationSpi()).stopBlock(false);
+        try {
+            fut.get();
+        }
+        finally {
+            for (int i = 0; i < SRV_CNT; i++)
+                ((TestCommunicationSpi)grid(i).configuration().getCommunicationSpi()).stopBlock(false);
+        }
 
         cache.put(1, 1);
 


[12/50] [abbrv] ignite git commit: Relaxed assert for now to avoid hangs in tests, to be fixed properly later.

Posted by ag...@apache.org.
Relaxed assert for now to avoid hangs in tests, to be fixed properly later.


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

Branch: refs/heads/ignite-1282
Commit: 96efa387e21b8d749800bb3e661faec630e10896
Parents: de08cd5
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 10:09:09 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 10:09:09 2015 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/96efa387/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 2c85b87..865f73f 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -4070,7 +4070,7 @@ class ServerImpl extends TcpDiscoveryImpl {
             }
 
             if (node != null) {
-                assert !node.isLocal() : msg;
+                assert !node.isLocal() || !msg.verified() : msg;
 
                 synchronized (mux) {
                     failedNodes.add(node);


[23/50] [abbrv] ignite git commit: IGNITE-1956: Added binary enums support.

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
index ea472eb..373e173 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
@@ -80,24 +80,13 @@ namespace Apache.Ignite.Core.Tests.Binary
                         new BinaryTypeConfiguration(typeof (BuilderCollection)),
                         new BinaryTypeConfiguration(typeof (BuilderCollectionItem)),
                         new BinaryTypeConfiguration(typeof (DecimalHolder)),
-                        new BinaryTypeConfiguration(TypeEmpty)
+                        new BinaryTypeConfiguration(TypeEmpty),
+                        new BinaryTypeConfiguration(typeof(TestEnumRegistered))
                     },
                     DefaultIdMapper = new IdMapper()
                 },
                 JvmClasspath = TestUtils.CreateTestClasspath(),
-                JvmOptions = new List<string>
-                {
-                    "-ea",
-                    "-Xcheck:jni",
-                    "-Xms4g",
-                    "-Xmx4g",
-                    "-DIGNITE_QUIET=false",
-                    "-Xnoagent",
-                    "-Djava.compiler=NONE",
-                    "-Xdebug",
-                    "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005",
-                    "-XX:+HeapDumpOnOutOfMemoryError"
-                },
+                JvmOptions = TestUtils.TestJavaOptions(),
                 SpringConfigUrl = "config\\binary.xml"
             };
 
@@ -198,7 +187,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             DateTime date = DateTime.Now.ToUniversalTime();
             Guid guid = Guid.NewGuid();
 
-            IIgniteBinary api = _grid.GetBinary();
+            IBinary api = _grid.GetBinary();
 
             // 1. Primitives.
             Assert.AreEqual(1, api.ToBinary<byte>((byte)1));
@@ -216,7 +205,8 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual("a", api.ToBinary<string>("a"));
             Assert.AreEqual(date, api.ToBinary<DateTime>(date));
             Assert.AreEqual(guid, api.ToBinary<Guid>(guid));
-            Assert.AreEqual(TestEnum.One, api.ToBinary<TestEnum>(TestEnum.One));
+            Assert.AreEqual(TestEnumRegistered.One, api.ToBinary<IBinaryObject>(TestEnumRegistered.One)
+                .Deserialize<TestEnumRegistered>());
 
             // 3. Arrays.
             Assert.AreEqual(new byte[] { 1 }, api.ToBinary<byte[]>(new byte[] { 1 }));
@@ -233,7 +223,9 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(new[] { "a" }, api.ToBinary<string[]>(new[] { "a" }));
             Assert.AreEqual(new[] { date }, api.ToBinary<DateTime[]>(new[] { date }));
             Assert.AreEqual(new[] { guid }, api.ToBinary<Guid[]>(new[] { guid }));
-            Assert.AreEqual(new[] { TestEnum.One }, api.ToBinary<TestEnum[]>(new[] { TestEnum.One }));
+            Assert.AreEqual(new[] { TestEnumRegistered.One},
+                api.ToBinary<IBinaryObject[]>(new[] { TestEnumRegistered.One})
+                .Select(x => x.Deserialize<TestEnumRegistered>()).ToArray());
 
             // 4. Objects.
             IBinaryObject binObj = api.ToBinary<IBinaryObject>(new ToBinary(1));
@@ -816,7 +808,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(new[] { "str" }, binObj.GetField<string[]>("fStrArr"));
             Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
             Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
-            Assert.AreEqual(new[] { TestEnum.One }, binObj.GetField<TestEnum[]>("fEnumArr"));
+            Assert.AreEqual(new[] {TestEnum.One}, binObj.GetField<TestEnum[]>("fEnumArr"));
 
             StringDateGuidEnum obj = binObj.Deserialize<StringDateGuidEnum>();
 
@@ -839,7 +831,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(new[] { "str" }, builder.GetField<string[]>("fStrArr"));
             Assert.AreEqual(new[] { nDate }, builder.GetField<DateTime?[]>("fDateArr"));
             Assert.AreEqual(new[] { nGuid }, builder.GetField<Guid?[]>("fGuidArr"));
-            Assert.AreEqual(new[] { TestEnum.One }, builder.GetField<TestEnum[]>("fEnumArr"));
+            Assert.AreEqual(new[] {TestEnum.One}, builder.GetField<TestEnum[]>("fEnumArr"));
 
             // Check reassemble.
             binObj = builder.Build();
@@ -851,7 +843,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(new[] { "str" }, binObj.GetField<string[]>("fStrArr"));
             Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
             Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
-            Assert.AreEqual(new[] { TestEnum.One }, binObj.GetField<TestEnum[]>("fEnumArr"));
+            Assert.AreEqual(new[] {TestEnum.One}, binObj.GetField<TestEnum[]>("fEnumArr"));
 
             obj = binObj.Deserialize<StringDateGuidEnum>();
 
@@ -889,7 +881,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(new[] { "str2" }, binObj.GetField<string[]>("fStrArr"));
             Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
             Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
-            Assert.AreEqual(new[] { TestEnum.Two }, binObj.GetField<TestEnum[]>("fEnumArr"));
+            Assert.AreEqual(new[] {TestEnum.Two}, binObj.GetField<TestEnum[]>("fEnumArr"));
 
             obj = binObj.Deserialize<StringDateGuidEnum>();
 
@@ -903,6 +895,24 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(new[] { TestEnum.Two }, obj.FEnumArr);
         }
 
+        [Test]
+        public void TestEnumMeta()
+        {
+            var bin = _grid.GetBinary();
+
+            // Put to cache to populate metas
+            var binEnum = bin.ToBinary<IBinaryObject>(TestEnumRegistered.One);
+
+            Assert.AreEqual(_marsh.GetDescriptor(typeof (TestEnumRegistered)).TypeId, binEnum.GetBinaryType().TypeId);
+            Assert.AreEqual(0, binEnum.EnumValue);
+
+            var meta = binEnum.GetBinaryType();
+
+            Assert.IsTrue(meta.IsEnum);
+            Assert.AreEqual(typeof (TestEnumRegistered).Name, meta.TypeName);
+            Assert.AreEqual(0, meta.Fields.Count);
+        }
+
         /// <summary>
         /// Test arrays.
         /// </summary>
@@ -923,7 +933,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(100, binObj.GetHashCode());
 
-            var binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+            var binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
 
             Assert.AreEqual(1, binInArr.Length);
             Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
@@ -936,11 +946,11 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             // 2. Test addition to array.
             binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(200)
-                .SetField("inArr", new object[] { binInArr[0], null }).Build();
+                .SetField("inArr", new[] { binInArr[0], null }).Build();
 
             Assert.AreEqual(200, binObj.GetHashCode());
 
-            binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+            binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
 
             Assert.AreEqual(2, binInArr.Length);
             Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
@@ -960,7 +970,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(300, binObj.GetHashCode());
 
-            binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+            binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
 
             Assert.AreEqual(2, binInArr.Length);
             Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
@@ -983,7 +993,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(100, binObj.GetHashCode());
 
-            binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+            binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
 
             Assert.AreEqual(2, binInArr.Length);
             Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
@@ -1003,7 +1013,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(200, binObj.GetHashCode());
 
-            binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+            binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
 
             Assert.AreEqual(2, binInArr.Length);
             Assert.AreEqual(2, binInArr[0].GetField<int>("val"));
@@ -1031,7 +1041,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(100, binObj.GetHashCode());
 
-            var binOutArr = binObj.GetField<object[]>("outArr").Cast<IBinaryObject>().ToArray();
+            var binOutArr = binObj.GetField<IBinaryObject[]>("outArr").ToArray();
 
             Assert.AreEqual(2, binOutArr.Length);
             Assert.AreEqual(1, binOutArr[0].GetField<IBinaryObject>("inner").GetField<int>("val"));
@@ -1052,7 +1062,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(200, binObj.GetHashCode());
 
-            binInArr = binObj.GetField<object[]>("outArr").Cast<IBinaryObject>().ToArray();
+            binInArr = binObj.GetField<IBinaryObject[]>("outArr").ToArray();
 
             Assert.AreEqual(2, binInArr.Length);
             Assert.AreEqual(2, binOutArr[0].GetField<IBinaryObject>("inner").GetField<int>("val"));
@@ -1387,6 +1397,27 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
         }
+
+        [Test]
+        public void TestBuildEnum()
+        {
+            var binary = _grid.GetBinary();
+
+            int val = (int) TestEnumRegistered.Two;
+
+            var binEnums = new[]
+            {
+                binary.BuildEnum(typeof (TestEnumRegistered), val),
+                binary.BuildEnum(typeof (TestEnumRegistered).Name, val)
+            };
+
+            foreach (var binEnum in binEnums)
+            {
+                Assert.IsTrue(binEnum.GetBinaryType().IsEnum);
+                Assert.AreEqual(val, binEnum.EnumValue);
+                Assert.AreEqual((TestEnumRegistered)val, binEnum.Deserialize<TestEnumRegistered>());
+            }
+        }
     }
 
     /// <summary>
@@ -1452,6 +1483,14 @@ namespace Apache.Ignite.Core.Tests.Binary
     }
 
     /// <summary>
+    /// Registered enumeration.
+    /// </summary>
+    public enum TestEnumRegistered
+    {
+        One, Two
+    }
+
+    /// <summary>
     /// binary with raw data.
     /// </summary>
     public class WithRaw : IBinarizable

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index f7455be..88328ec 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -25,6 +25,7 @@ namespace Apache.Ignite.Core.Tests.Binary
     using System;
     using System.Collections;
     using System.Collections.Generic;
+    using System.Diagnostics.CodeAnalysis;
     using System.Linq;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Common;
@@ -479,11 +480,18 @@ namespace Apache.Ignite.Core.Tests.Binary
         * <summary>Check write of enum.</summary>
         */
         [Test]
+        [SuppressMessage("ReSharper", "ExpressionIsAlwaysNull")]
         public void TestWriteEnum()
         {
             TestEnum val = TestEnum.Val1;
 
             Assert.AreEqual(_marsh.Unmarshal<TestEnum>(_marsh.Marshal(val)), val);
+
+            TestEnum? val2 = TestEnum.Val1;
+            Assert.AreEqual(_marsh.Unmarshal<TestEnum?>(_marsh.Marshal(val2)), val2);
+
+            val2 = null;
+            Assert.AreEqual(_marsh.Unmarshal<TestEnum?>(_marsh.Marshal(val2)), val2);
         }
 
         /// <summary>
@@ -500,7 +508,13 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             TestEnum val = TestEnum.Val1;
 
-            Assert.AreEqual(marsh.Unmarshal<TestEnum>(marsh.Marshal(val)), val);
+            var data = marsh.Marshal(val);
+
+            Assert.AreEqual(marsh.Unmarshal<TestEnum>(data), val);
+
+            var binEnum = marsh.Unmarshal<IBinaryObject>(data, true);
+
+            Assert.AreEqual(val, (TestEnum) binEnum.EnumValue);
         }
 
         /**
@@ -668,8 +682,13 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             IBinaryObject portNewObj = marsh.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
 
+            Assert.IsTrue(portNewObj.HasField("field1"));
+            Assert.IsTrue(portNewObj.HasField("field2"));
+            Assert.IsFalse(portNewObj.HasField("field3"));
+
             Assert.AreEqual(obj.Field1, portNewObj.GetField<int>("field1"));
             Assert.AreEqual(obj.Field2, portNewObj.GetField<int>("Field2"));
+            Assert.AreEqual(0, portNewObj.GetField<int>("field3"));
         }
 
         /**
@@ -881,8 +900,11 @@ namespace Apache.Ignite.Core.Tests.Binary
             Marshaller marsh =
                 new Marshaller(new BinaryConfiguration
                 {
-                    TypeConfigurations =
-                        new List<BinaryTypeConfiguration> {new BinaryTypeConfiguration(typeof (EnumType))}
+                    TypeConfigurations = new[]
+                    {
+                        new BinaryTypeConfiguration(typeof (EnumType)),
+                        new BinaryTypeConfiguration(typeof (TestEnum))
+                    }
                 });
 
             EnumType obj = new EnumType
@@ -897,6 +919,19 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
 
+            // Test enum field in binary form
+            var binEnum = portObj.GetField<IBinaryObject>("PEnum");
+            Assert.AreEqual(obj.PEnum.GetHashCode(), binEnum.GetHashCode());
+            Assert.AreEqual((int) obj.PEnum, binEnum.EnumValue);
+            Assert.AreEqual(obj.PEnum, binEnum.Deserialize<TestEnum>());
+            Assert.AreEqual(obj.PEnum, binEnum.Deserialize<object>());
+            Assert.AreEqual(typeof(TestEnum), binEnum.Deserialize<object>().GetType());
+            Assert.AreEqual(null, binEnum.GetField<object>("someField"));
+            Assert.IsFalse(binEnum.HasField("anyField"));
+
+            var binEnumArr = portObj.GetField<IBinaryObject[]>("PEnumArray");
+            Assert.IsTrue(binEnumArr.Select(x => x.Deserialize<TestEnum>()).SequenceEqual(obj.PEnumArray));
+
             EnumType newObj = portObj.Deserialize<EnumType>();
 
             Assert.AreEqual(obj.PEnum, newObj.PEnum);
@@ -1094,7 +1129,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             inner.RawOuter = outer;
 
             var bytes = asbinary
-                ? marsh.Marshal(new IgniteBinary(marsh).ToBinary<IBinaryObject>(outer))
+                ? marsh.Marshal(new Binary(marsh).ToBinary<IBinaryObject>(outer))
                 : marsh.Marshal(outer);
 
             IBinaryObject outerObj;
@@ -2057,6 +2092,11 @@ namespace Apache.Ignite.Core.Tests.Binary
             Val1, Val2, Val3 = 10
         }
 
+        public enum TestEnum2
+        {
+            Val1, Val2, Val3 = 10
+        }
+
         public class DecimalReflective
         {
             /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 64124d7..ce15739 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -347,17 +347,16 @@ namespace Apache.Ignite.Core.Tests.Cache
             for (int i = 0; i < GridCount(); i++)
             {
                 var cache = Cache(i);
+                var entries = cache.Select(pair => pair.ToString() + GetKeyAffinity(cache, pair.Key)).ToArray();
 
-                if (!cache.IsEmpty())
-                {
-                    var entries = Enumerable.Range(0, 2000)
-                        .Select(x => new KeyValuePair<int, int>(x, cache.LocalPeek(x)))
-                        .Where(x => x.Value != 0)
-                        .Select(pair => pair.ToString() + GetKeyAffinity(cache, pair.Key))
-                        .Aggregate((acc, val) => string.Format("{0}, {1}", acc, val));
+                if (entries.Any())
+                    Assert.Fail("Cache '{0}' is not empty in grid [{1}]: ({2})", CacheName(), i,
+                        entries.Aggregate((acc, val) => string.Format("{0}, {1}", acc, val)));
 
-                    Assert.Fail("Cache '{0}' is not empty in grid [{1}]: ({2})", CacheName(), i, entries);
-                }
+                var size = cache.GetSize();
+                Assert.AreEqual(0, size,
+                    "Cache enumerator returned no entries, but cache '{0}' size is {1} in grid [{2}]",
+                    CacheName(), size, i);
             }
 
             Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index 1e999e3..87b7f9d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -899,6 +899,12 @@ namespace Apache.Ignite.Core.Tests.Compute
 
             var res = _grid1.GetCompute().ExecuteJavaTask<PlatformComputeEnum>(EchoTask, EchoTypeEnumField);
 
+            var enumMeta = _grid1.GetBinary().GetBinaryType(typeof (PlatformComputeEnum));
+
+            Assert.IsTrue(enumMeta.IsEnum);
+            Assert.AreEqual(enumMeta.TypeName, typeof(PlatformComputeEnum).Name);
+            Assert.AreEqual(0, enumMeta.Fields.Count);
+
             Assert.AreEqual(enumVal, res);
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
index aa58054..3061773 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
@@ -64,7 +64,8 @@
                             <property name="typeName" value="org.apache.ignite.platform.PlatformComputeJavaBinarizable"/>
                         </bean>
                         <bean class="org.apache.ignite.binary.BinaryTypeConfiguration">
-                            <property name="typeName" value="org.apache.ignite.platform.PlatformComputeEnum"/>
+                            <property name="typeName" value="org.apache.ignite.platform.PlatformComputeEnum" />
+                            <property name="enum" value="true" />
                         </bean>
                     </list>
                 </property>

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
index b414a91..25a1d16 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
@@ -41,6 +41,7 @@
                     <property name="atomicityMode" value="TRANSACTIONAL"/>
                     <property name="writeThrough" value="true"/>
                     <property name="readThrough" value="true"/>
+                    <property name="keepBinaryInStore" value="true"/>
 
                     <property name="cacheStoreFactory">
                         <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
index 1797337..973381c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
@@ -48,7 +48,7 @@ namespace Apache.Ignite.Core.Tests.Services
         });
 
         /** */
-        protected readonly IIgniteBinary IgniteBinary;
+        protected readonly IBinary Binary;
 
         /** */
         private readonly PlatformMemoryManager _memory = new PlatformMemoryManager(1024);
@@ -64,7 +64,7 @@ namespace Apache.Ignite.Core.Tests.Services
         /// </summary>
         public ServiceProxyTest()
         {
-            IgniteBinary = new IgniteBinary(_marsh);
+            Binary = new Binary(_marsh);
         }
 
         /// <summary>
@@ -243,7 +243,7 @@ namespace Apache.Ignite.Core.Tests.Services
         /// </summary>
         protected T GetProxy<T>()
         {
-            _svc = new TestIgniteService(IgniteBinary);
+            _svc = new TestIgniteService(Binary);
 
             var prx = new ServiceProxy<T>(InvokeProxyMethod).GetTransparentProxy();
 
@@ -439,15 +439,15 @@ namespace Apache.Ignite.Core.Tests.Services
         private class TestIgniteService : ITestIgniteService, ITestIgniteServiceAmbiguity
         {
             /** */
-            private readonly IIgniteBinary _igniteBinary;
+            private readonly IBinary _binary;
 
             /// <summary>
             /// Initializes a new instance of the <see cref="TestIgniteService"/> class.
             /// </summary>
-            /// <param name="igniteBinary">Binary.</param>
-            public TestIgniteService(IIgniteBinary igniteBinary)
+            /// <param name="binary">Binary.</param>
+            public TestIgniteService(IBinary binary)
             {
-                _igniteBinary = igniteBinary;
+                _binary = binary;
             }
 
             /** <inheritdoc /> */
@@ -534,13 +534,13 @@ namespace Apache.Ignite.Core.Tests.Services
             /** <inheritdoc /> */
             public IBinaryObject BinarizableResultMethod(int arg1, TestBinarizableClass arg2)
             {
-                return _igniteBinary.ToBinary<IBinaryObject>(arg2);
+                return _binary.ToBinary<IBinaryObject>(arg2);
             }
 
             /** <inheritdoc /> */
             public IBinaryObject BinarizableArgAndResultMethod(int arg1, IBinaryObject arg2)
             {
-                return _igniteBinary.ToBinary<IBinaryObject>(arg2.Deserialize<TestBinarizableClass>());
+                return _binary.ToBinary<IBinaryObject>(arg2.Deserialize<TestBinarizableClass>());
             }
 
             /** <inheritdoc /> */
@@ -703,7 +703,7 @@ namespace Apache.Ignite.Core.Tests.Services
             var prx = GetProxy();
 
             var obj = new TestBinarizableClass { Prop = "PropValue" };
-            var portObj = IgniteBinary.ToBinary<IBinaryObject>(obj);
+            var portObj = Binary.ToBinary<IBinaryObject>(obj);
 
             var result = prx.BinarizableArgMethod(1, portObj);
 
@@ -731,7 +731,7 @@ namespace Apache.Ignite.Core.Tests.Services
             var prx = GetProxy();
             
             var obj = new TestBinarizableClass { Prop = "PropValue" };
-            var portObj = IgniteBinary.ToBinary<IBinaryObject>(obj);
+            var portObj = Binary.ToBinary<IBinaryObject>(obj);
 
             var result = prx.BinarizableArgAndResultMethod(1, portObj);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index ae10159..2c7d787 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -134,6 +134,7 @@
     <Compile Include="IgniteConfiguration.cs" />
     <Compile Include="Ignition.cs" />
     <Compile Include="IIgnite.cs" />
+    <Compile Include="Impl\Binary\BinaryEnum.cs" />
     <Compile Include="Impl\Cache\CacheAffinityImpl.cs" />
     <Compile Include="Impl\Cache\CacheEntry.cs" />
     <Compile Include="Impl\Cache\CacheEntryFilterHolder.cs" />
@@ -266,7 +267,7 @@
     <Compile Include="Impl\Binary\BinaryReader.cs" />
     <Compile Include="Impl\Binary\BinaryReflectiveActions.cs" />
     <Compile Include="Impl\Binary\BinaryReflectiveSerializer.cs" />
-    <Compile Include="Impl\Binary\IgniteBinary.cs" />
+    <Compile Include="Impl\Binary\Binary.cs" />
     <Compile Include="Impl\Binary\Structure\BinaryStructureTracker.cs" />
     <Compile Include="Impl\Binary\BinarySurrogateTypeDescriptor.cs" />
     <Compile Include="Impl\Binary\BinarySystemHandlers.cs" />
@@ -316,7 +317,7 @@
     <Compile Include="Binary\IBinaryRawReader.cs" />
     <Compile Include="Binary\IBinaryRawWriter.cs" />
     <Compile Include="Binary\IBinaryReader.cs" />
-    <Compile Include="Binary\IIgniteBinary.cs" />
+    <Compile Include="Binary\IBinary.cs" />
     <Compile Include="Binary\IBinarySerializer.cs" />
     <Compile Include="Binary\IBinaryWriter.cs" />
     <Compile Include="Binary\BinaryConfiguration.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
index 967aa52..99f8572 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
@@ -48,6 +48,7 @@ namespace Apache.Ignite.Core.Binary
         public BinaryTypeConfiguration(Type type)
         {
             TypeName = type.AssemblyQualifiedName;
+            IsEnum = type.IsEnum;
         }
 
         /// <summary>
@@ -62,6 +63,7 @@ namespace Apache.Ignite.Core.Binary
             Serializer = cfg.Serializer;
             TypeName = cfg.TypeName;
             KeepDeserialized = cfg.KeepDeserialized;
+            IsEnum = cfg.IsEnum;
         }
 
         /// <summary>
@@ -101,6 +103,11 @@ namespace Apache.Ignite.Core.Binary
         public bool? KeepDeserialized { get; set; }
 
         /// <summary>
+        /// Gets or sets a value indicating whether this instance describes an enum type.
+        /// </summary>
+        public bool IsEnum { get; set; }
+
+        /// <summary>
         /// Returns a string that represents the current object.
         /// </summary>
         /// <returns>
@@ -108,9 +115,12 @@ namespace Apache.Ignite.Core.Binary
         /// </returns>
         public override string ToString()
         {
-            return typeof (BinaryTypeConfiguration).Name + " [TypeName=" + TypeName +
-                   ", NameMapper=" + NameMapper + ", IdMapper=" + IdMapper + ", Serializer=" + Serializer +
-                   ", AffinityKeyFieldName=" + AffinityKeyFieldName + ']';
+            return
+                string.Format(
+                    "{0} [TypeName={1}, NameMapper={2}, IdMapper={3}, Serializer={4}, AffinityKeyFieldName={5}, " +
+                    "KeepDeserialized={6}, IsEnum={7}]",
+                    typeof (BinaryTypeConfiguration).Name, TypeName, NameMapper, IdMapper, Serializer,
+                    AffinityKeyFieldName, KeepDeserialized, IsEnum);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinary.cs
new file mode 100644
index 0000000..a0fc17f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinary.cs
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Binary
+{
+    using System;
+    using System.Collections.Generic;
+
+    /// <summary>
+    /// Defines binary objects functionality. With binary objects you are able to:
+    /// <list type="bullet">
+    ///     <item>
+    ///         <description>Seamlessly interoperate between Java, .NET, and C++.</description>
+    ///     </item>
+    ///     <item>
+    ///         <description>Make any object binary with zero code change to your existing code.</description>
+    ///     </item>
+    ///     <item>
+    ///         <description>Nest binary objects within each other.</description>
+    ///     </item>
+    ///     <item>
+    ///         <description>Automatically handle <c>circular</c> or <c>null</c> references.</description>
+    ///     </item>
+    ///     <item>
+    ///         <description>Automatically convert collections and maps between Java, .NET, and C++.</description>
+    ///     </item>
+    ///     <item>
+    ///         <description>Optionally avoid deserialization of objects on the server side.</description>
+    ///     </item>
+    ///     <item>
+    ///         <description>Avoid need to have concrete class definitions on the server side.</description>
+    ///     </item>
+    ///     <item>
+    ///         <description>Dynamically change structure of the classes without having to restart the cluster.</description>
+    ///     </item>
+    ///     <item>
+    ///         <description>Index into binary objects for querying purposes.</description>
+    ///     </item>
+    /// </list>
+    /// </summary>
+    public interface IBinary
+    {
+        /// <summary>
+        /// Converts provided object to binary form.
+        /// <para />
+        /// Note that object's type needs to be configured in <see cref="BinaryConfiguration"/>.
+        /// </summary>
+        /// <param name="obj">Object to convert.</param>
+        /// <returns>Converted object.</returns>
+        T ToBinary<T>(object obj);
+
+        /// <summary>
+        /// Create builder for the given binary object type. Note that this
+        /// type must be specified in <see cref="BinaryConfiguration"/>.
+        /// </summary>
+        /// <param name="type"></param>
+        /// <returns>Builder.</returns>
+        IBinaryObjectBuilder GetBuilder(Type type);
+
+        /// <summary>
+        /// Create builder for the given binary object type name. Note that this
+        /// type name must be specified in <see cref="BinaryConfiguration"/>.
+        /// </summary>
+        /// <param name="typeName">Type name.</param>
+        /// <returns>Builder.</returns>
+        IBinaryObjectBuilder GetBuilder(string typeName);
+
+        /// <summary>
+        /// Create builder over existing binary object.
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns>Builder.</returns>
+        IBinaryObjectBuilder GetBuilder(IBinaryObject obj);
+
+        /// <summary>
+        /// Gets type id for the given type name.
+        /// </summary>
+        /// <param name="typeName">Type name.</param>
+        /// <returns>Type id.</returns>
+        int GetTypeId(string typeName);
+
+        /// <summary>
+        /// Gets metadata for all known types.
+        /// </summary>
+        /// <returns>Metadata.</returns>
+        ICollection<IBinaryType> GetBinaryTypes();
+
+        /// <summary>
+        /// Gets metadata for specified type id.
+        /// </summary>
+        /// <returns>Metadata.</returns>
+        IBinaryType GetBinaryType(int typeId);
+
+        /// <summary>
+        /// Gets metadata for specified type name.
+        /// </summary>
+        /// <returns>Metadata.</returns>
+        IBinaryType GetBinaryType(string typeName);
+
+        /// <summary>
+        /// Gets metadata for specified type.
+        /// </summary>
+        /// <returns>Metadata.</returns>
+        IBinaryType GetBinaryType(Type type);
+
+        /// <summary>
+        /// Converts enum to a binary form.
+        /// </summary>
+        /// <param name="typeName">Enum type name.</param>
+        /// <param name="value">Enum int value.</param>
+        /// <returns>Binary representation of the specified enum value.</returns>
+        IBinaryObject BuildEnum(string typeName, int value);
+
+        /// <summary>
+        /// Converts enum to a binary form.
+        /// </summary>
+        /// <param name="type">Enum type.</param>
+        /// <param name="value">Enum int value.</param>
+        /// <returns>Binary representation of the specified enum value.</returns>
+        IBinaryObject BuildEnum(Type type, int value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs
index bd60e28..c5aa80e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs
@@ -25,14 +25,6 @@ namespace Apache.Ignite.Core.Binary
     public interface IBinaryObject
     {
         /// <summary>
-        /// Gets binary object type ID.
-        /// </summary>
-        /// <value>
-        /// Type ID.
-        /// </value>
-        int TypeId { get; }
-
-        /// <summary>
         /// Gets object metadata.
         /// </summary>
         /// <returns>Metadata.</returns>
@@ -50,11 +42,26 @@ namespace Apache.Ignite.Core.Binary
         TF GetField<TF>(string fieldName);
 
         /// <summary>
+        /// Determines whether the field with specified name exists in this instance.
+        /// </summary>
+        /// <param name="fieldName">Name of the field.</param>
+        /// <returns>True if there is a field with specified name; false otherwise.</returns>
+        bool HasField(string fieldName);
+
+        /// <summary>
         /// Gets fully deserialized instance of binary object.
         /// </summary>
         /// <returns>
         /// Fully deserialized instance of binary object.
         /// </returns>
         T Deserialize<T>();
+
+        /// <summary>
+        /// Gets the value of underlying enum in int form.
+        /// </summary>
+        /// <value>
+        /// The value of underlying enum in int form.
+        /// </value>
+        int EnumValue { get; }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs
index 7b34e07..bec863f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs
@@ -48,5 +48,18 @@ namespace Apache.Ignite.Core.Binary
         /// </summary>
         /// <returns>Affinity key field name or null in case it is not provided.</returns>
         string AffinityKeyFieldName { get; }
+
+        /// <summary>
+        /// Gets a value indicating whether this type represents an enum.
+        /// </summary>
+        /// <value>   
+        /// <c>true</c> if this instance represents an enum; otherwise, <c>false</c>.
+        /// </value>
+        bool IsEnum { get; }
+
+        /// <summary>
+        /// Gets the type identifier.
+        /// </summary>
+        int TypeId { get; }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IIgniteBinary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IIgniteBinary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IIgniteBinary.cs
deleted file mode 100644
index 25ea981..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IIgniteBinary.cs
+++ /dev/null
@@ -1,120 +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.
- */
-
-namespace Apache.Ignite.Core.Binary
-{
-    using System;
-    using System.Collections.Generic;
-
-    /// <summary>
-    /// Defines binary objects functionality. With binary objects you are able to:
-    /// <list type="bullet">
-    ///     <item>
-    ///         <description>Seamlessly interoperate between Java, .NET, and C++.</description>
-    ///     </item>
-    ///     <item>
-    ///         <description>Make any object binary with zero code change to your existing code.</description>
-    ///     </item>
-    ///     <item>
-    ///         <description>Nest binary objects within each other.</description>
-    ///     </item>
-    ///     <item>
-    ///         <description>Automatically handle <c>circular</c> or <c>null</c> references.</description>
-    ///     </item>
-    ///     <item>
-    ///         <description>Automatically convert collections and maps between Java, .NET, and C++.</description>
-    ///     </item>
-    ///     <item>
-    ///         <description>Optionally avoid deserialization of objects on the server side.</description>
-    ///     </item>
-    ///     <item>
-    ///         <description>Avoid need to have concrete class definitions on the server side.</description>
-    ///     </item>
-    ///     <item>
-    ///         <description>Dynamically change structure of the classes without having to restart the cluster.</description>
-    ///     </item>
-    ///     <item>
-    ///         <description>Index into binary objects for querying purposes.</description>
-    ///     </item>
-    /// </list>
-    /// </summary>
-    public interface IIgniteBinary
-    {
-        /// <summary>
-        /// Converts provided object to binary form.
-        /// <para />
-        /// Note that object's type needs to be configured in <see cref="BinaryConfiguration"/>.
-        /// </summary>
-        /// <param name="obj">Object to convert.</param>
-        /// <returns>Converted object.</returns>
-        T ToBinary<T>(object obj);
-
-        /// <summary>
-        /// Create builder for the given binary object type. Note that this
-        /// type must be specified in <see cref="BinaryConfiguration"/>.
-        /// </summary>
-        /// <param name="type"></param>
-        /// <returns>Builder.</returns>
-        IBinaryObjectBuilder GetBuilder(Type type);
-
-        /// <summary>
-        /// Create builder for the given binary object type name. Note that this
-        /// type name must be specified in <see cref="BinaryConfiguration"/>.
-        /// </summary>
-        /// <param name="typeName">Type name.</param>
-        /// <returns>Builder.</returns>
-        IBinaryObjectBuilder GetBuilder(string typeName);
-
-        /// <summary>
-        /// Create builder over existing binary object.
-        /// </summary>
-        /// <param name="obj"></param>
-        /// <returns>Builder.</returns>
-        IBinaryObjectBuilder GetBuilder(IBinaryObject obj);
-
-        /// <summary>
-        /// Gets type id for the given type name.
-        /// </summary>
-        /// <param name="typeName">Type name.</param>
-        /// <returns>Type id.</returns>
-        int GetTypeId(string typeName);
-
-        /// <summary>
-        /// Gets metadata for all known types.
-        /// </summary>
-        /// <returns>Metadata.</returns>
-        ICollection<IBinaryType> GetBinaryTypes();
-
-        /// <summary>
-        /// Gets metadata for specified type id.
-        /// </summary>
-        /// <returns>Metadata.</returns>
-        IBinaryType GetBinaryType(int typeId);
-
-        /// <summary>
-        /// Gets metadata for specified type name.
-        /// </summary>
-        /// <returns>Metadata.</returns>
-        IBinaryType GetBinaryType(string typeName);
-
-        /// <summary>
-        /// Gets metadata for specified type.
-        /// </summary>
-        /// <returns>Metadata.</returns>
-        IBinaryType GetBinaryType(Type type);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
index b9d9555..08e5f6b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
@@ -111,11 +111,11 @@ namespace Apache.Ignite.Core
         IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName);
 
         /// <summary>
-        /// Gets an instance of <see cref="IIgniteBinary"/> interface.
+        /// Gets an instance of <see cref="IBinary"/> interface.
         /// </summary>
-        /// <returns>Instance of <see cref="IIgniteBinary"/> interface</returns>
+        /// <returns>Instance of <see cref="IBinary"/> interface</returns>
         [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Semantics.")]
-        IIgniteBinary GetBinary();
+        IBinary GetBinary();
 
         /// <summary>
         /// Gets affinity service to provide information about data partitioning and distribution.

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
new file mode 100644
index 0000000..43a4bb8
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
@@ -0,0 +1,216 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+    using System;
+    using System.Collections.Generic;
+    using System.IO;
+    using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Impl.Binary.IO;
+    using Apache.Ignite.Core.Impl.Binary.Metadata;
+    using Apache.Ignite.Core.Impl.Common;
+
+    /// <summary>
+    /// Binary implementation.
+    /// </summary>
+    internal class Binary : IBinary
+    {
+        /** Owning grid. */
+        private readonly Marshaller _marsh;
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="marsh">Marshaller.</param>
+        internal Binary(Marshaller marsh)
+        {
+            _marsh = marsh;
+        }
+
+        /** <inheritDoc /> */
+        public T ToBinary<T>(object obj)
+        {
+            if (obj is IBinaryObject)
+                return (T)obj;
+
+            IBinaryStream stream = new BinaryHeapStream(1024);
+
+            // Serialize.
+            BinaryWriter writer = _marsh.StartMarshal(stream);
+
+            try
+            {
+                writer.Write(obj);
+            }
+            finally
+            {
+                // Save metadata.
+                _marsh.FinishMarshal(writer);
+            }
+
+            // Deserialize.
+            stream.Seek(0, SeekOrigin.Begin);
+
+            return _marsh.Unmarshal<T>(stream, BinaryMode.ForceBinary);
+        }
+
+        /** <inheritDoc /> */
+        public IBinaryObjectBuilder GetBuilder(Type type)
+        {
+            IgniteArgumentCheck.NotNull(type, "type");
+
+            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(type);
+
+            if (desc == null)
+                throw new IgniteException("Type is not binary (add it to BinaryConfiguration): " + 
+                    type.FullName);
+
+            return Builder0(null, BinaryFromDescriptor(desc), desc);
+        }
+
+        /** <inheritDoc /> */
+        public IBinaryObjectBuilder GetBuilder(string typeName)
+        {
+            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
+
+            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(typeName);
+            
+            return Builder0(null, BinaryFromDescriptor(desc), desc);
+        }
+
+        /** <inheritDoc /> */
+        public IBinaryObjectBuilder GetBuilder(IBinaryObject obj)
+        {
+            IgniteArgumentCheck.NotNull(obj, "obj");
+
+            BinaryObject obj0 = obj as BinaryObject;
+
+            if (obj0 == null)
+                throw new ArgumentException("Unsupported object type: " + obj.GetType());
+
+            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, obj0.TypeId);
+            
+            return Builder0(null, obj0, desc);
+        }
+
+        /** <inheritDoc /> */
+        public int GetTypeId(string typeName)
+        {
+            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
+
+            return Marshaller.GetDescriptor(typeName).TypeId;
+        }
+
+        /** <inheritDoc /> */
+        public ICollection<IBinaryType> GetBinaryTypes()
+        {
+            return Marshaller.Ignite.ClusterGroup.GetBinaryTypes();
+        }
+
+        /** <inheritDoc /> */
+        public IBinaryType GetBinaryType(int typeId)
+        {
+            return Marshaller.GetBinaryType(typeId);
+        }
+
+        /** <inheritDoc /> */
+        public IBinaryType GetBinaryType(string typeName)
+        {
+            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
+
+            return GetBinaryType(GetTypeId(typeName));
+        }
+
+        /** <inheritDoc /> */
+        public IBinaryType GetBinaryType(Type type)
+        {
+            IgniteArgumentCheck.NotNull(type, "type");
+
+            var desc = Marshaller.GetDescriptor(type);
+
+            return desc == null ? null : Marshaller.GetBinaryType(desc.TypeId);
+        }
+
+        /** <inheritDoc /> */
+        public IBinaryObject BuildEnum(string typeName, int value)
+        {
+            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
+
+            var desc = Marshaller.GetDescriptor(typeName);
+
+            IgniteArgumentCheck.Ensure(desc.IsEnum, "typeName", "Type should be an Enum.");
+
+            _marsh.PutBinaryType(desc);
+
+            return new BinaryEnum(GetTypeId(typeName), value, Marshaller);
+        }
+
+        /** <inheritDoc /> */
+        public IBinaryObject BuildEnum(Type type, int value)
+        {
+            IgniteArgumentCheck.NotNull(type, "type");
+            IgniteArgumentCheck.Ensure(type.IsEnum, "type", "Type should be an Enum.");
+
+            return BuildEnum(type.Name, value);
+        }
+
+        /// <summary>
+        /// Marshaller.
+        /// </summary>
+        internal Marshaller Marshaller
+        {
+            get
+            {
+                return _marsh;
+            }
+        }
+
+        /// <summary>
+        /// Create empty binary object from descriptor.
+        /// </summary>
+        /// <param name="desc">Descriptor.</param>
+        /// <returns>Empty binary object.</returns>
+        private BinaryObject BinaryFromDescriptor(IBinaryTypeDescriptor desc)
+        {
+            var len = BinaryObjectHeader.Size;
+
+            var hdr = new BinaryObjectHeader(desc.TypeId, 0, len, 0, len,
+                desc.UserType ? BinaryObjectHeader.Flag.UserType : BinaryObjectHeader.Flag.None);
+
+            var stream = new BinaryHeapStream(len);
+
+            BinaryObjectHeader.Write(hdr, stream, 0);
+
+            return new BinaryObject(_marsh, stream.InternalArray, 0, hdr);
+        }
+
+        /// <summary>
+        /// Internal builder creation routine.
+        /// </summary>
+        /// <param name="parent">Parent builder.</param>
+        /// <param name="obj">binary object.</param>
+        /// <param name="desc">Type descriptor.</param>
+        /// <returns>Builder.</returns>
+        private BinaryObjectBuilder Builder0(BinaryObjectBuilder parent, BinaryObject obj, 
+            IBinaryTypeDescriptor desc)
+        {
+            return new BinaryObjectBuilder(this, parent, obj, desc);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryEnum.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryEnum.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryEnum.cs
new file mode 100644
index 0000000..97f44b0
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryEnum.cs
@@ -0,0 +1,134 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+    using System;
+    using System.Diagnostics;
+    using Apache.Ignite.Core.Binary;
+
+    /// <summary>
+    /// Represents a typed enum in binary form.
+    /// </summary>
+    internal class BinaryEnum : IBinaryObject, IEquatable<BinaryEnum>
+    {
+        /** Type id. */
+        private readonly int _typeId;
+
+        /** Value. */
+        private readonly int _enumValue;
+
+        /** Marshaller. */
+        private readonly Marshaller _marsh;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="BinaryEnum" /> class.
+        /// </summary>
+        /// <param name="typeId">The type identifier.</param>
+        /// <param name="enumValue">The value.</param>
+        /// <param name="marsh">The marshaller.</param>
+        public BinaryEnum(int typeId, int enumValue, Marshaller marsh)
+        {
+            Debug.Assert(marsh != null);
+
+            _typeId = typeId;
+            _enumValue = enumValue;
+            _marsh = marsh;
+        }
+
+        /** <inheritdoc /> */
+        public int TypeId
+        {
+            get { return _typeId; }
+        }
+
+        /** <inheritdoc /> */
+        public IBinaryType GetBinaryType()
+        {
+            return _marsh.GetBinaryType(_typeId);
+        }
+
+        /** <inheritdoc /> */
+        public TF GetField<TF>(string fieldName)
+        {
+            return default(TF);
+        }
+
+        /** <inheritdoc /> */
+        public bool HasField(string fieldName)
+        {
+            return false;
+        }
+
+        /** <inheritdoc /> */
+        public T Deserialize<T>()
+        {
+            return BinaryUtils.GetEnumValue<T>(_enumValue, _typeId, _marsh);
+        }
+
+        /** <inheritdoc /> */
+        public int EnumValue
+        {
+            get { return _enumValue; }
+        }
+
+        /** <inheritdoc /> */
+        public bool Equals(BinaryEnum other)
+        {
+            if (ReferenceEquals(null, other))
+                return false;
+
+            if (ReferenceEquals(this, other))
+                return true;
+
+            return _typeId == other._typeId && _enumValue == other._enumValue;
+        }
+
+        /** <inheritdoc /> */
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj))
+                return false;
+
+            if (ReferenceEquals(this, obj))
+                return true;
+
+            if (obj.GetType() != GetType())
+                return false;
+
+            return Equals((BinaryEnum) obj);
+        }
+
+        /** <inheritdoc /> */
+        public override int GetHashCode()
+        {
+            return _enumValue.GetHashCode();
+        }
+
+        /** <inheritdoc /> */
+        public static bool operator ==(BinaryEnum left, BinaryEnum right)
+        {
+            return Equals(left, right);
+        }
+
+        /** <inheritdoc /> */
+        public static bool operator !=(BinaryEnum left, BinaryEnum right)
+        {
+            return !Equals(left, right);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
index 9649595..3d2b34d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
@@ -63,6 +63,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** Type schema. */
         private readonly BinaryObjectSchema _schema = new BinaryObjectSchema();
 
+        /** Enum flag. */
+        private bool _isEnum;
+
         /// <summary>
         /// Constructor.
         /// </summary>
@@ -75,6 +78,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="serializer">Serializer.</param>
         /// <param name="keepDeserialized">Whether to cache deserialized value in IBinaryObject</param>
         /// <param name="affKeyFieldName">Affinity field key name.</param>
+        /// <param name="isEnum">Enum flag.</param>
         public BinaryFullTypeDescriptor(
             Type type, 
             int typeId, 
@@ -84,7 +88,8 @@ namespace Apache.Ignite.Core.Impl.Binary
             IBinaryIdMapper idMapper, 
             IBinarySerializer serializer, 
             bool keepDeserialized, 
-            string affKeyFieldName)
+            string affKeyFieldName,
+            bool isEnum)
         {
             _type = type;
             _typeId = typeId;
@@ -95,6 +100,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             _serializer = serializer;
             _keepDeserialized = keepDeserialized;
             _affKeyFieldName = affKeyFieldName;
+            _isEnum = isEnum;
         }
 
         /// <summary>
@@ -169,6 +175,12 @@ namespace Apache.Ignite.Core.Impl.Binary
             get { return _affKeyFieldName; }
         }
 
+        /** <inheritdoc/> */
+        public bool IsEnum
+        {
+            get { return _isEnum; }
+        }
+
         /** <inheritDoc /> */
         public BinaryStructure WriterTypeStructure
         {

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
index fd60da7..90607dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
@@ -17,14 +17,17 @@
 
 namespace Apache.Ignite.Core.Impl.Binary
 {
+    using System;
     using System.Collections;
     using System.Collections.Generic;
+    using System.Diagnostics;
     using System.IO;
     using System.Runtime.CompilerServices;
     using System.Text;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Impl.Binary.IO;
+    using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
     /// Binary object.
@@ -61,6 +64,10 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="header">The header.</param>
         public BinaryObject(Marshaller marsh, byte[] data, int offset, BinaryObjectHeader header)
         {
+            Debug.Assert(marsh != null);
+            Debug.Assert(data != null);
+            Debug.Assert(offset >= 0 && offset < data.Length);
+
             _marsh = marsh;
 
             _data = data;
@@ -78,11 +85,23 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public T GetField<T>(string fieldName)
         {
+            IgniteArgumentCheck.NotNullOrEmpty(fieldName, "fieldName");
+
             int pos;
 
             return TryGetFieldPosition(fieldName, out pos) ? GetField<T>(pos, null) : default(T);
         }
 
+        /** <inheritdoc /> */
+        public bool HasField(string fieldName)
+        {
+            IgniteArgumentCheck.NotNullOrEmpty(fieldName, "fieldName");
+
+            int pos;
+
+            return TryGetFieldPosition(fieldName, out pos);
+        }
+
         /// <summary>
         /// Gets field value on the given object.
         /// </summary>
@@ -104,6 +123,16 @@ namespace Apache.Ignite.Core.Impl.Binary
             return Deserialize<T>(BinaryMode.Deserialize);
         }
 
+        /** <inheritdoc /> */
+        public int EnumValue
+        {
+            get
+            {
+                throw new NotSupportedException("IBinaryObject.Value is only supported for enums. " +
+                    "Check IBinaryObject.IsEnum property before accessing Value.");
+            }
+        }
+
         /// <summary>
         /// Internal deserialization routine.
         /// </summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
index 97cc381..7ef6259 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
@@ -37,7 +37,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             new Dictionary<int, BinaryBuilderField>();
         
         /** Binary. */
-        private readonly IgniteBinary _igniteBinary;
+        private readonly Binary _binary;
 
         /** */
         private readonly BinaryObjectBuilder _parent;
@@ -79,18 +79,18 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Constructor.
         /// </summary>
-        /// <param name="igniteBinary">Binary.</param>
+        /// <param name="binary">Binary.</param>
         /// <param name="parent">Parent builder.</param>
         /// <param name="obj">Initial binary object.</param>
         /// <param name="desc">Type descriptor.</param>
-        public BinaryObjectBuilder(IgniteBinary igniteBinary, BinaryObjectBuilder parent, 
+        public BinaryObjectBuilder(Binary binary, BinaryObjectBuilder parent, 
             BinaryObject obj, IBinaryTypeDescriptor desc)
         {
-            Debug.Assert(igniteBinary != null);
+            Debug.Assert(binary != null);
             Debug.Assert(obj != null);
             Debug.Assert(desc != null);
 
-            _igniteBinary = igniteBinary;
+            _binary = binary;
             _parent = parent ?? this;
             _obj = obj;
             _desc = desc;
@@ -361,7 +361,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             BinaryHeapStream outStream = new BinaryHeapStream(estimatedCapacity);
 
-            BinaryWriter writer = _igniteBinary.Marshaller.StartMarshal(outStream);
+            BinaryWriter writer = _binary.Marshaller.StartMarshal(outStream);
 
             writer.SetBuilder(this);
 
@@ -374,10 +374,10 @@ namespace Apache.Ignite.Core.Impl.Binary
                 writer.Write(this);
                 
                 // Process metadata.
-                _igniteBinary.Marshaller.FinishMarshal(writer);
+                _binary.Marshaller.FinishMarshal(writer);
 
                 // Create binary object once metadata is processed.
-                return new BinaryObject(_igniteBinary.Marshaller, outStream.InternalArray, 0, 
+                return new BinaryObject(_binary.Marshaller, outStream.InternalArray, 0, 
                     BinaryObjectHeader.Read(outStream, 0));
             }
             finally
@@ -394,9 +394,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <returns>Child builder.</returns>
         public BinaryObjectBuilder Child(BinaryObject obj)
         {
-            var desc = _igniteBinary.Marshaller.GetDescriptor(true, obj.TypeId);
+            var desc = _binary.Marshaller.GetDescriptor(true, obj.TypeId);
 
-            return new BinaryObjectBuilder(_igniteBinary, null, obj, desc);
+            return new BinaryObjectBuilder(_binary, null, obj, desc);
         }
         
         /// <summary>
@@ -436,7 +436,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             var hdr = _obj.Data[pos];
 
-            var field = new BinaryBuilderField(typeof(T), val, hdr, GetWriteAction(hdr));
+            var field = new BinaryBuilderField(typeof(T), val, hdr, GetWriteAction(hdr, pos));
             
             _parent._cache[pos] = field;
 
@@ -447,8 +447,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// Gets the write action by header.
         /// </summary>
         /// <param name="header">The header.</param>
+        /// <param name="pos">Position.</param>
         /// <returns>Write action.</returns>
-        private static Action<BinaryWriter, object> GetWriteAction(byte header)
+        private Action<BinaryWriter, object> GetWriteAction(byte header, int pos)
         {
             // We need special actions for all cases where SetField(X) produces different result from SetSpecialField(X)
             // Arrays, Collections, Dates
@@ -466,9 +467,20 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                 case BinaryUtils.TypeArrayTimestamp:
                     return WriteTimestampArrayAction;
-            }
 
-            return null;
+                case BinaryUtils.TypeArrayEnum:
+                    using (var stream = new BinaryHeapStream(_obj.Data))
+                    {
+                        stream.Seek(pos, SeekOrigin.Begin + 1);
+
+                        var elementTypeId = stream.ReadInt();
+
+                        return (w, o) => w.WriteEnumArrayInternal((Array) o, elementTypeId);
+                    }
+
+                default:
+                    return null;
+            }
         }
 
         /// <summary>
@@ -510,7 +522,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             try
             {
                 // Prepare fields.
-                IBinaryTypeHandler metaHnd = _igniteBinary.Marshaller.GetBinaryTypeHandler(desc);
+                IBinaryTypeHandler metaHnd = _binary.Marshaller.GetBinaryTypeHandler(desc);
 
                 IDictionary<int, BinaryBuilderField> vals0;
 
@@ -546,7 +558,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                     IDictionary<string, int> meta = metaHnd.OnObjectWriteFinished();
 
                     if (meta != null)
-                        _parent._ctx.Writer.SaveMetadata(desc.TypeId, desc.TypeName, desc.AffinityKeyFieldName, meta);
+                        _parent._ctx.Writer.SaveMetadata(desc, meta);
                 }
             }
             finally

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 9aeb908..7b887a9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -399,13 +399,34 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public T ReadEnum<T>(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadEnum<T>, BinaryUtils.TypeEnum);
+            return SeekField(fieldName) ? ReadEnum<T>() : default(T);
         }
 
         /** <inheritdoc /> */
         public T ReadEnum<T>()
         {
-            return Read(BinaryUtils.ReadEnum<T>, BinaryUtils.TypeEnum);
+            var hdr = ReadByte();
+
+            switch (hdr)
+            {
+                case BinaryUtils.HdrNull:
+                    return default(T);
+
+                case BinaryUtils.TypeEnum:
+                    // Never read enums in binary mode when reading a field (we do not support half-binary objects)
+                    return ReadEnum0<T>(this, false);  
+
+                case BinaryUtils.HdrFull:
+                    // Unregistered enum written as serializable
+                    Stream.Seek(-1, SeekOrigin.Current);
+
+                    return ReadObject<T>(); 
+
+                default:
+                    throw new BinaryObjectException(
+                        string.Format("Invalid header on enum deserialization. Expected: {0} or {1} but was: {2}",
+                            BinaryUtils.TypeEnum, BinaryUtils.HdrFull, hdr));
+            }
         }
 
         /** <inheritdoc /> */
@@ -560,15 +581,16 @@ namespace Apache.Ignite.Core.Impl.Binary
                     res = ReadBinaryObject<T>(doDetach);
 
                     return true;
-            }
 
-            if (BinaryUtils.IsPredefinedType(hdr))
-            {
-                res = BinarySystemHandlers.ReadSystemType<T>(hdr, this);
+                case BinaryUtils.TypeEnum:
+                    res = ReadEnum0<T>(this, _mode != BinaryMode.Deserialize);
 
-                return true;
+                    return true;
             }
 
+            if (BinarySystemHandlers.TryReadSystemType(hdr, this, out res))
+                return true;
+
             throw new BinaryObjectException("Invalid header on deserialization [pos=" + pos + ", hdr=" + hdr + ']');
         }
 
@@ -961,5 +983,20 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             return IsNotNullHeader(expHdr) ? readFunc(Stream) : default(T);
         }
+
+        /// <summary>
+        /// Reads the enum.
+        /// </summary>
+        private static T ReadEnum0<T>(BinaryReader reader, bool keepBinary)
+        {
+            var enumType = reader.ReadInt();
+
+            var enumValue = reader.ReadInt();
+
+            if (!keepBinary)
+                return BinaryUtils.GetEnumValue<T>(enumValue, enumType, reader.Marshaller);
+
+            return TypeCaster<T>.Cast(new BinaryEnum(enumType, enumValue, reader.Marshaller));
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
index 247b40d..04028b5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
@@ -124,6 +124,12 @@ namespace Apache.Ignite.Core.Impl.Binary
             get { return null; }
         }
 
+        /** <inheritdoc/> */
+        public bool IsEnum
+        {
+            get { return false; }
+        }
+
         /** <inheritDoc /> */
         public BinaryStructure WriterTypeStructure
         {

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
index b49c29d..0af1e82 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
+    using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Common;
 
@@ -166,7 +167,6 @@ namespace Apache.Ignite.Core.Impl.Binary
             ReadHandlers[BinaryUtils.TypeMapEntry] = new BinarySystemReader(ReadMapEntry);
             
             // 16. Enum.
-            ReadHandlers[BinaryUtils.TypeEnum] = new BinarySystemReader<int>(BinaryUtils.ReadEnum<int>);
             ReadHandlers[BinaryUtils.TypeArrayEnum] = new BinarySystemReader(ReadEnumArray);
         }
 
@@ -212,6 +212,8 @@ namespace Apache.Ignite.Core.Impl.Binary
                 return WriteGuid;
             if (type == typeof (BinaryObject))
                 return WriteBinary;
+            if (type == typeof (BinaryEnum))
+                return WriteBinaryEnum;
             if (type == typeof (ArrayList))
                 return WriteArrayList;
             if (type == typeof(Hashtable))
@@ -257,11 +259,11 @@ namespace Apache.Ignite.Core.Impl.Binary
                 if (elemType == typeof(Guid?))
                     return WriteGuidArray;
                 // Enums.
-                if (elemType.IsEnum)
+                if (elemType.IsEnum || elemType == typeof(BinaryEnum))
                     return WriteEnumArray;
                 
                 // Object array.
-                if (elemType == typeof (object))
+                if (elemType == typeof (object) || elemType == typeof(IBinaryObject) || elemType == typeof(BinaryObject))
                     return WriteArray;
             }
 
@@ -329,13 +331,18 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Reads an object of predefined type.
         /// </summary>
-        public static T ReadSystemType<T>(byte typeId, BinaryReader ctx)
+        public static bool TryReadSystemType<T>(byte typeId, BinaryReader ctx, out T res)
         {
             var handler = ReadHandlers[typeId];
 
-            Debug.Assert(handler != null, "Cannot find predefined read handler: " + typeId);
-            
-            return handler.Read<T>(ctx);
+            if (handler == null)
+            {
+                res = default(T);
+                return false;
+            }
+
+            res = handler.Read<T>(ctx);
+            return true;
         }
         
         /// <summary>
@@ -629,9 +636,20 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </summary>
         private static void WriteEnum(BinaryWriter ctx, object obj)
         {
+            ctx.WriteEnum(obj);
+        }
+
+        /// <summary>
+        /// Write enum.
+        /// </summary>
+        private static void WriteBinaryEnum(BinaryWriter ctx, object obj)
+        {
+            var binEnum = (BinaryEnum) obj;
+
             ctx.Stream.WriteByte(BinaryUtils.TypeEnum);
 
-            BinaryUtils.WriteEnum(ctx, obj);
+            ctx.WriteInt(binEnum.TypeId);
+            ctx.WriteInt(binEnum.EnumValue);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 1aed03f..1917f01 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -23,7 +23,9 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
+    using System.Globalization;
     using System.IO;
+    using System.Linq;
     using System.Reflection;
     using System.Runtime.InteropServices;
     using System.Text;
@@ -1318,25 +1320,29 @@ namespace Apache.Ignite.Core.Impl.Binary
             }
 
             throw new BinaryObjectException("Only Int32 underlying type is supported for enums: " +
-                enumType.Name);
+                                            enumType.Name);
         }
 
         /// <summary>
-        /// Read enum.
+        /// Gets the enum value by type id and int representation.
         /// </summary>
-        /// <param name="stream">Stream.</param>
-        /// <returns>Enumeration.</returns>
-        public static T ReadEnum<T>(IBinaryStream stream)
+        /// <typeparam name="T">Result type.</typeparam>
+        /// <param name="value">The value.</param>
+        /// <param name="typeId">The type identifier.</param>
+        /// <param name="marsh">The marshaller.</param>
+        /// <returns>value in form of enum, if typeId is known; value in for of int, if typeId is -1.</returns>
+        public static T GetEnumValue<T>(int value, int typeId, Marshaller marsh)
         {
-            if (!typeof(T).IsEnum || Enum.GetUnderlyingType(typeof(T)) == TypInt)
-            {
-                stream.ReadInt();
+            if (typeId == ObjTypeId)
+                return TypeCaster<T>.Cast(value);
 
-                return TypeCaster<T>.Cast(stream.ReadInt());
-            }
+            // All enums are user types
+            var desc = marsh.GetDescriptor(true, typeId);
 
-            throw new BinaryObjectException("Only Int32 underlying type is supported for enums: " +
-                                        typeof (T).Name);
+            if (desc == null || desc.Type == null)
+                throw new BinaryObjectException("Unknown enum type id: " + typeId);
+
+            return (T)Enum.ToObject(desc.Type, value);
         }
 
         /**
@@ -1387,52 +1393,6 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /**
-         * <summary>Check whether this is predefined type.</summary>
-         * <param name="hdr">Header.</param>
-         * <returns>True is this is one of predefined types with special semantics.</returns>
-         */
-        public static bool IsPredefinedType(byte hdr)
-        {
-            switch (hdr)
-            {
-                case TypeByte:
-                case TypeShort:
-                case TypeInt:
-                case TypeLong:
-                case TypeFloat:
-                case TypeDouble:
-                case TypeChar:
-                case TypeBool:
-                case TypeDecimal:
-                case TypeString:
-                case TypeGuid:
-                case TypeTimestamp:
-                case TypeEnum:
-                case TypeArrayByte:
-                case TypeArrayShort:
-                case TypeArrayInt:
-                case TypeArrayLong:
-                case TypeArrayFloat:
-                case TypeArrayDouble:
-                case TypeArrayChar:
-                case TypeArrayBool:
-                case TypeArrayDecimal:
-                case TypeArrayString:
-                case TypeArrayGuid:
-                case TypeArrayTimestamp:
-                case TypeArrayEnum:
-                case TypeArray:
-                case TypeCollection:
-                case TypeDictionary:
-                case TypeMapEntry:
-                case TypeBinary:
-                    return true;
-                default:
-                    return false;
-            }
-        }
-
-        /**
          * <summary>Convert type name.</summary>
          * <param name="typeName">Type name.</param>
          * <param name="converter">Converter.</param>
@@ -1534,6 +1494,23 @@ namespace Apache.Ignite.Core.Impl.Binary
             return id;
         }
 
+        /// <summary>
+        /// Gets the name of the type.
+        /// </summary>
+        /// <param name="type">The type.</param>
+        /// <returns>
+        /// Simple type name for non-generic types; simple type name with appended generic arguments for generic types.
+        /// </returns>
+        public static string GetTypeName(Type type)
+        {
+            if (!type.IsGenericType)
+                return type.Name;
+
+            var args = type.GetGenericArguments().Select(GetTypeName).Aggregate((x, y) => x + "," + y);
+
+            return string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", type.Name, args);
+        }
+
         /**
          * <summary>Resolve field ID.</summary>
          * <param name="typeId">Type ID.</param>
@@ -1732,7 +1709,8 @@ namespace Apache.Ignite.Core.Impl.Binary
                             IdMapper = CreateInstance<IBinaryIdMapper>(reader),
                             Serializer = CreateInstance<IBinarySerializer>(reader),
                             AffinityKeyFieldName = reader.ReadString(),
-                            KeepDeserialized = reader.ReadObject<bool?>()
+                            KeepDeserialized = reader.ReadObject<bool?>(),
+                            IsEnum = reader.ReadBoolean()
                         });
                     }
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index c00dad6..189cd50 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -20,12 +20,12 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System;
     using System.Collections;
     using System.Collections.Generic;
+    using System.Diagnostics;
     using System.IO;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Binary.Metadata;
     using Apache.Ignite.Core.Impl.Binary.Structure;
-    using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
     /// Binary writer implementation.
@@ -45,7 +45,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         private BinaryHandleDictionary<object, long> _hnds;
 
         /** Metadatas collected during this write session. */
-        private IDictionary<int, IBinaryType> _metas;
+        private IDictionary<int, BinaryType> _metas;
 
         /** Current type ID. */
         private int _curTypeId;
@@ -803,8 +803,28 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="val">Enum value.</param>
         public void WriteEnum<T>(T val)
         {
-            _stream.WriteByte(BinaryUtils.TypeEnum);
-            BinaryUtils.WriteEnum(this, val);
+            if (val == null)
+                WriteNullField();
+            else
+            {
+                var desc = _marsh.GetDescriptor(val.GetType());
+
+                if (desc != null)
+                {
+                    var metaHnd = _marsh.GetBinaryTypeHandler(desc);
+
+                    _stream.WriteByte(BinaryUtils.TypeEnum);
+
+                    BinaryUtils.WriteEnum(this, val);
+
+                    SaveMetadata(desc, metaHnd.OnObjectWriteFinished());
+                }
+                else
+                {
+                    // Unregistered enum, write as serializable
+                    Write(new SerializableObjectHolder(val));
+                }
+            }
         }
 
         /// <summary>
@@ -817,10 +837,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             WriteFieldId(fieldName, BinaryUtils.TypeArrayEnum);
 
-            if (val == null)
-                WriteNullField();
-            else
-                WriteEnumArray0(val);
+            WriteEnumArray(val);
         }
 
         /// <summary>
@@ -830,24 +847,26 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="val">Enum array.</param>
         public void WriteEnumArray<T>(T[] val)
         {
-            if (val == null)
-                WriteNullRawField();
-            else
-                WriteEnumArray0(val);
+            WriteEnumArrayInternal(val, null);
         }
 
         /// <summary>
         /// Writes the enum array.
         /// </summary>
         /// <param name="val">The value.</param>
-        private void WriteEnumArray0<T>(T[] val)
+        /// <param name="elementTypeId">The element type id.</param>
+        public void WriteEnumArrayInternal(Array val, int? elementTypeId)
         {
-            _stream.WriteByte(BinaryUtils.TypeArrayEnum);
+            if (val == null)
+                WriteNullField();
+            else
+            {
+                _stream.WriteByte(BinaryUtils.TypeArrayEnum);
 
-            // typeof(T) can yield wrong results (string[] is object[], for example)
-            var elementType = val.GetType().GetElementType();  
+                var elTypeId = elementTypeId ?? BinaryUtils.GetEnumTypeId(val.GetType().GetElementType(), Marshaller);
 
-            BinaryUtils.WriteArray(val, this, BinaryUtils.GetEnumTypeId(elementType, Marshaller));
+                BinaryUtils.WriteArray(val, this, elTypeId);
+            }
         }
 
         /// <summary>
@@ -1051,12 +1070,20 @@ namespace Apache.Ignite.Core.Impl.Binary
                 return;
             }
 
+            // Handle enums.
+            if (type.IsEnum)
+            {
+                WriteEnum(obj);
+
+                return;
+            }
+
             // Handle special case for builder.
             if (WriteBuilderSpecials(obj))
                 return;
 
             // Suppose that we faced normal object and perform descriptor lookup.
-            IBinaryTypeDescriptor desc = type.IsEnum ? null : _marsh.GetDescriptor(type);
+            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(type);
 
             if (desc != null)
             {
@@ -1356,9 +1383,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// Gets collected metadatas.
         /// </summary>
         /// <returns>Collected metadatas (if any).</returns>
-        internal IDictionary<int, IBinaryType> GetBinaryTypes()
+        internal ICollection<BinaryType> GetBinaryTypes()
         {
-            return _metas;
+            return _metas == null ? null : _metas.Values;
         }
 
         /// <summary>
@@ -1399,37 +1426,38 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Saves metadata for this session.
         /// </summary>
-        /// <param name="typeId">Type ID.</param>
-        /// <param name="typeName">Type name.</param>
-        /// <param name="affKeyFieldName">Affinity key field name.</param>
+        /// <param name="desc">The descriptor.</param>
         /// <param name="fields">Fields metadata.</param>
-        internal void SaveMetadata(int typeId, string typeName, string affKeyFieldName, IDictionary<string, int> fields)
+        internal void SaveMetadata(IBinaryTypeDescriptor desc, IDictionary<string, int> fields)
         {
+            Debug.Assert(desc != null);
+
             if (_metas == null)
             {
-                BinaryType meta =
-                    new BinaryType(typeId, typeName, fields, affKeyFieldName);
-
-                _metas = new Dictionary<int, IBinaryType>(1);
-
-                _metas[typeId] = meta;
+                _metas = new Dictionary<int, BinaryType>(1)
+                {
+                    {desc.TypeId, new BinaryType(desc, fields)}
+                };
             }
             else
             {
-                IBinaryType meta;
+                BinaryType meta;
 
-                if (_metas.TryGetValue(typeId, out meta))
+                if (_metas.TryGetValue(desc.TypeId, out meta))
                 {
-                    IDictionary<string, int> existingFields = ((BinaryType)meta).FieldsMap();
-
-                    foreach (KeyValuePair<string, int> field in fields)
+                    if (fields != null)
                     {
-                        if (!existingFields.ContainsKey(field.Key))
-                            existingFields[field.Key] = field.Value;
+                        IDictionary<string, int> existingFields = meta.GetFieldsMap();
+
+                        foreach (KeyValuePair<string, int> field in fields)
+                        {
+                            if (!existingFields.ContainsKey(field.Key))
+                                existingFields[field.Key] = field.Value;
+                        }
                     }
                 }
                 else
-                    _metas[typeId] = new BinaryType(typeId, typeName, fields, affKeyFieldName);
+                    _metas[desc.TypeId] = new BinaryType(desc, fields);
             }
         }
     }


[04/50] [abbrv] ignite git commit: debugging slowdowns

Posted by ag...@apache.org.
debugging slowdowns


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

Branch: refs/heads/ignite-1282
Commit: f50f4094a037715af2d543d1a89101d05b0020f5
Parents: 722aacf
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Nov 26 17:50:16 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Nov 26 17:50:16 2015 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f50f4094/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index cd0c2a2..70adf28 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,6 +1,23 @@
 Apache Ignite Release Notes
 ===========================
 
+Apache Ignite In-Memory Data Fabric 1.5
+---------------------------------------
+* Massive performance improvements for cache operations and SQL.
+* Added new binary cache object marshalling implementation.
+* Added Ignite.NET In-Memory Data Fabric.
+* Added Ignite.C++ In-Memory Data Fabric.
+* Added IgniteSemaphore data structure.
+* Added MQTT Streamer.
+* Fixed failover for continuous queries.
+* Fixed compilation and runtime errors under OpnJDK and IBM JDK.
+* Fixed Integer.size limitation for cache.
+* Fixed and improved cache types configuration.
+* Fixed cache rebalancing.
+* Many stability and fault-tolerance fixes.
+
+Complete list of closed issues: https://issues.apache.org/jira/issues/?jql=project%20%3D%20IGNITE%20AND%20fixVersion%20%3D%201.5%20AND%20status%20%3D%20closed
+
 Apache Ignite In-Memory Data Fabric 1.4
 ---------------------------------------
 * Added SSL support to communication and discovery.


[07/50] [abbrv] ignite git commit: Ssl suite

Posted by ag...@apache.org.
Ssl suite


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

Branch: refs/heads/ignite-1282
Commit: 2f200400940c9ef1bec5b4490f2cb192fbc0fcfe
Parents: a0e414e
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Nov 26 19:23:35 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Nov 26 19:23:35 2015 +0300

----------------------------------------------------------------------
 .../spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java      | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2f200400/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
index 3324fcc..fe84c67 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
@@ -27,6 +27,7 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 /**
  *
  */
+//Can fail as described at https://issues.apache.org/jira/browse/IGNITE-1924
 public class IgniteCacheSslStartStopSelfTest extends IgniteCachePutRetryAbstractSelfTest {
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {


[10/50] [abbrv] ignite git commit: IGNITE-1537 Fixed near optimistic TX future to avoid early completion.

Posted by ag...@apache.org.
IGNITE-1537 Fixed near optimistic TX future to avoid early completion.


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

Branch: refs/heads/ignite-1282
Commit: de08cd554e75db0df06a5438da5012ebf6c7ad09
Parents: 895760e
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 08:40:16 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 08:40:16 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtTxPrepareFuture.java |  2 +-
 ...arOptimisticSerializableTxPrepareFuture.java | 92 ++++----------------
 .../near/GridNearOptimisticTxPrepareFuture.java | 57 ++++++------
 ...ridNearOptimisticTxPrepareFutureAdapter.java | 70 +++++++++++++++
 .../cache/local/GridLocalCacheEntry.java        |  6 ++
 .../transactions/IgniteTxLocalAdapter.java      |  2 +-
 .../util/future/GridCompoundFuture.java         |  2 +-
 7 files changed, 123 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/de08cd55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index c55bead..1d418ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -417,7 +417,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                 U.error(log, "Failed to get result value for cache entry: " + cached, e);
             }
             catch (GridCacheEntryRemovedException e) {
-                assert false : "Got entry removed exception while holding transactional lock on entry: " + e;
+                assert false : "Got entry removed exception while holding transactional lock on entry [e=" + e + ", cached=" + cached + ']';
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/de08cd55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
index 144070c..916c7ab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
@@ -39,12 +39,10 @@ import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTx
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxMapping;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
-import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -76,7 +74,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
 
     /** */
     @GridToStringExclude
-    private KeyLockFuture keyLockFut = new KeyLockFuture();
+    private KeyLockFuture keyLockFut;
 
     /** */
     @GridToStringExclude
@@ -134,7 +132,8 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
                     }
                 }
 
-                keyLockFut.onKeyLocked(entry.txKey());
+                if (keyLockFut != null)
+                    keyLockFut.onKeyLocked(entry.txKey());
 
                 return true;
             }
@@ -189,7 +188,8 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
 
         err.compareAndSet(null, e);
 
-        keyLockFut.onDone(e);
+        if (keyLockFut != null)
+            keyLockFut.onDone(e);
     }
 
     /** {@inheritDoc} */
@@ -210,7 +210,8 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
         if (err != null) {
             this.err.compareAndSet(null, err);
 
-            keyLockFut.onDone(err);
+            if (keyLockFut != null)
+                keyLockFut.onDone(err);
         }
 
         return onComplete();
@@ -335,10 +336,8 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
         for (IgniteTxEntry read : reads)
             map(read, topVer, mappings, remap, topLocked);
 
-        keyLockFut.onAllKeysAdded();
-
-        if (!remap)
-            add(keyLockFut);
+        if (keyLockFut != null)
+            keyLockFut.onAllKeysAdded();
 
         if (isDone()) {
             if (log.isDebugEnabled())
@@ -535,8 +534,15 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
             entry.cached(cacheCtx.local().entryEx(entry.key(), topVer));
 
         if (!remap && (cacheCtx.isNear() || cacheCtx.isLocal())) {
-            if (entry.explicitVersion() == null)
+            if (entry.explicitVersion() == null) {
+                if (keyLockFut == null) {
+                    keyLockFut = new KeyLockFuture();
+
+                    add(keyLockFut);
+                }
+
                 keyLockFut.addLockKey(entry.txKey());
+            }
         }
 
         IgniteBiTuple<ClusterNode, Boolean> key = F.t(primary, cacheCtx.isNear());
@@ -854,68 +860,4 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
             return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());
         }
     }
-
-    /**
-     * Keys lock future.
-     */
-    private class KeyLockFuture extends GridFutureAdapter<GridNearTxPrepareResponse> {
-        /** */
-        @GridToStringInclude
-        private Collection<IgniteTxKey> lockKeys = new GridConcurrentHashSet<>();
-
-        /** */
-        private volatile boolean allKeysAdded;
-
-        /**
-         * @param key Key to track for locking.
-         */
-        private void addLockKey(IgniteTxKey key) {
-            assert !allKeysAdded;
-
-            lockKeys.add(key);
-        }
-
-        /**
-         * @param key Locked keys.
-         */
-        private void onKeyLocked(IgniteTxKey key) {
-            lockKeys.remove(key);
-
-            checkLocks();
-        }
-
-        /**
-         * Moves future to the ready state.
-         */
-        private void onAllKeysAdded() {
-            allKeysAdded = true;
-
-            checkLocks();
-        }
-
-        /**
-         * @return {@code True} if all locks are owned.
-         */
-        private boolean checkLocks() {
-            boolean locked = lockKeys.isEmpty();
-
-            if (locked && allKeysAdded) {
-                if (log.isDebugEnabled())
-                    log.debug("All locks are acquired for near prepare future: " + this);
-
-                onDone((GridNearTxPrepareResponse)null);
-            }
-            else {
-                if (log.isDebugEnabled())
-                    log.debug("Still waiting for locks [fut=" + this + ", keys=" + lockKeys + ']');
-            }
-
-            return locked;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(KeyLockFuture.class, this, super.toString());
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/de08cd55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index e70e574..ca1d36c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -40,15 +40,15 @@ import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTx
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxMapping;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
-import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.P1;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -65,8 +65,8 @@ import static org.apache.ignite.transactions.TransactionState.PREPARING;
  */
 public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepareFutureAdapter {
     /** */
-    @GridToStringInclude
-    private Collection<IgniteTxKey> lockKeys = new GridConcurrentHashSet<>();
+    @GridToStringExclude
+    private KeyLockFuture keyLockFut;
 
     /**
      * @param cctx Context.
@@ -84,10 +84,8 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             log.debug("Transaction future received owner changed callback: " + entry);
 
         if ((entry.context().isNear() || entry.context().isLocal()) && owner != null && tx.hasWriteKey(entry.txKey())) {
-            lockKeys.remove(entry.txKey());
-
-            // This will check for locks.
-            onDone();
+            if (keyLockFut != null)
+                keyLockFut.onKeyLocked(entry.txKey());
 
             return true;
         }
@@ -151,24 +149,6 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
         }
     }
 
-    /**
-     * @return {@code True} if all locks are owned.
-     */
-    private boolean checkLocks() {
-        boolean locked = lockKeys.isEmpty();
-
-        if (locked) {
-            if (log.isDebugEnabled())
-                log.debug("All locks are acquired for near prepare future: " + this);
-        }
-        else {
-            if (log.isDebugEnabled())
-                log.debug("Still waiting for locks [fut=" + this + ", keys=" + lockKeys + ']');
-        }
-
-        return locked;
-    }
-
     /** {@inheritDoc} */
     @Override public void onResult(UUID nodeId, GridNearTxPrepareResponse res) {
         if (!isDone()) {
@@ -215,8 +195,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
 
     /** {@inheritDoc} */
     @Override public boolean onDone(IgniteInternalTx t, Throwable err) {
-        // If locks were not acquired yet, delay completion.
-        if (isDone() || (err == null && !checkLocks()))
+        if (isDone())
             return false;
 
         this.err.compareAndSet(null, err);
@@ -320,6 +299,9 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             return;
         }
 
+        if (keyLockFut != null)
+            keyLockFut.onAllKeysAdded();
+
         tx.addSingleEntryMapping(mapping, write);
 
         cctx.mvcc().recheckPendingLocks();
@@ -385,6 +367,9 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             return;
         }
 
+        if (keyLockFut != null)
+            keyLockFut.onAllKeysAdded();
+
         tx.addEntryMapping(mappings);
 
         cctx.mvcc().recheckPendingLocks();
@@ -543,8 +528,15 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             entry.cached(cacheCtx.local().entryEx(entry.key(), topVer));
 
         if (cacheCtx.isNear() || cacheCtx.isLocal()) {
-            if (entry.explicitVersion() == null)
-                lockKeys.add(entry.txKey());
+            if (entry.explicitVersion() == null) {
+                if (keyLockFut == null) {
+                    keyLockFut = new KeyLockFuture();
+
+                    add(keyLockFut);
+                }
+
+                keyLockFut.addLockKey(entry.txKey());
+            }
         }
 
         if (cur == null || !cur.node().id().equals(primary.id()) || cur.near() != cacheCtx.isNear()) {
@@ -594,10 +586,15 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
                     ", loc=" + ((MiniFuture)f).node().isLocal() +
                     ", done=" + f.isDone() + "]";
             }
+        }, new P1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
+            @Override public boolean apply(IgniteInternalFuture<GridNearTxPrepareResponse> fut) {
+                return isMini(fut);
+            }
         });
 
         return S.toString(GridNearOptimisticTxPrepareFuture.class, this,
             "innerFuts", futs,
+            "keyLockFut", keyLockFut,
             "tx", tx,
             "super", super.toString());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/de08cd55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java
index 6b7244a..5c7553f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java
@@ -17,14 +17,20 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
+import java.util.Collection;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.GridPlainRunnable;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.CI1;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -157,4 +163,68 @@ public abstract class GridNearOptimisticTxPrepareFutureAdapter extends GridNearT
      * @param topLocked {@code True} if thread already acquired lock preventing topology change.
      */
     protected abstract void prepare0(boolean remap, boolean topLocked);
+
+    /**
+     * Keys lock future.
+     */
+    protected static class KeyLockFuture extends GridFutureAdapter<GridNearTxPrepareResponse> {
+        /** */
+        @GridToStringInclude
+        private Collection<IgniteTxKey> lockKeys = new GridConcurrentHashSet<>();
+
+        /** */
+        private volatile boolean allKeysAdded;
+
+        /**
+         * @param key Key to track for locking.
+         */
+        protected void addLockKey(IgniteTxKey key) {
+            assert !allKeysAdded;
+
+            lockKeys.add(key);
+        }
+
+        /**
+         * @param key Locked keys.
+         */
+        protected void onKeyLocked(IgniteTxKey key) {
+            lockKeys.remove(key);
+
+            checkLocks();
+        }
+
+        /**
+         * Moves future to the ready state.
+         */
+        protected void onAllKeysAdded() {
+            allKeysAdded = true;
+
+            checkLocks();
+        }
+
+        /**
+         * @return {@code True} if all locks are owned.
+         */
+        private boolean checkLocks() {
+            boolean locked = lockKeys.isEmpty();
+
+            if (locked && allKeysAdded) {
+                if (log.isDebugEnabled())
+                    log.debug("All locks are acquired for near prepare future: " + this);
+
+                onDone((GridNearTxPrepareResponse)null);
+            }
+            else {
+                if (log.isDebugEnabled())
+                    log.debug("Still waiting for locks [fut=" + this + ", keys=" + lockKeys + ']');
+            }
+
+            return locked;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(KeyLockFuture.class, this, super.toString());
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/de08cd55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
index 0ceae20..76bfc46 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_LOCKED;
@@ -434,4 +435,9 @@ public class GridLocalCacheEntry extends GridCacheMapEntry {
     @Override protected void offHeapPointer(long valPtr) {
         this.valPtr = valPtr;
     }
+
+    /** {@inheritDoc} */
+    @Override public synchronized String toString() {
+        return S.toString(GridLocalCacheEntry.class, this, super.toString());
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/de08cd55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index b3ff3a6..f13cff4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -598,7 +598,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
      * @param entry Cache entry to check.
      */
     private void checkCommitLocks(GridCacheEntryEx entry) {
-        assert ownsLockUnsafe(entry) : "Lock is not owned for commit in PESSIMISTIC mode [entry=" + entry +
+        assert ownsLockUnsafe(entry) : "Lock is not owned for commit [entry=" + entry +
             ", tx=" + this + ']';
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/de08cd55/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
index cc296e6..4b2461e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
@@ -423,7 +423,7 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> {
 
         /** {@inheritDoc} */
         @Override public String toString() {
-            return "Compound future listener: " + GridCompoundFuture.this;
+            return "Compound future listener []";
         }
     }
 }


[41/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1282
Commit: 6312737a72b95efb417019ea13f9a811b9f3adf4
Parents: 9b01be3 56aeea3
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 16:54:42 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 16:54:42 2015 +0300

----------------------------------------------------------------------
 .../hibernate/CacheHibernatePersonStore.java    |   4 +-
 .../hibernate/CacheHibernateStoreExample.java   |   2 +-
 .../datagrid/store/hibernate/Person.hbm.xml     |   2 +-
 .../apache/ignite/examples/binary/Address.java  |  72 ---------
 .../apache/ignite/examples/binary/Employee.java |  93 -----------
 .../ignite/examples/binary/EmployeeKey.java     |  93 -----------
 .../ignite/examples/binary/Organization.java    |  93 -----------
 .../examples/binary/OrganizationType.java       |  32 ----
 ...ComputeClientBinaryTaskExecutionExample.java |   4 +-
 .../CacheClientBinaryPutGetExample.java         |   6 +-
 .../datagrid/CacheClientBinaryQueryExample.java |  22 +--
 .../examples/datagrid/CacheQueryExample.java    | 161 ++++---------------
 .../ignite/examples/datagrid/store/Person.java  | 154 ------------------
 .../store/auto/CacheAutoStoreExample.java       |   4 +-
 .../auto/CacheAutoStoreLoadDataExample.java     |   4 +-
 .../datagrid/store/auto/CacheConfig.java        |   6 +-
 .../store/dummy/CacheDummyPersonStore.java      |  12 +-
 .../store/dummy/CacheDummyStoreExample.java     |   4 +-
 .../store/jdbc/CacheJdbcPersonStore.java        |  18 +--
 .../store/jdbc/CacheJdbcStoreExample.java       |   4 +-
 .../store/spring/CacheSpringPersonStore.java    |  10 +-
 .../store/spring/CacheSpringStoreExample.java   |   4 +-
 .../ignite/examples/model/Organization.java     |  55 +++++++
 .../apache/ignite/examples/model/Person.java    | 120 ++++++++++++++
 .../ignite/examples/model/binary/Address.java   |  72 +++++++++
 .../ignite/examples/model/binary/Employee.java  |  93 +++++++++++
 .../examples/model/binary/EmployeeKey.java      |  93 +++++++++++
 .../examples/model/binary/Organization.java     |  93 +++++++++++
 .../examples/model/binary/OrganizationType.java |  32 ++++
 .../examples/ScalarCacheQueryExample.scala      |  66 ++------
 .../processors/query/h2/IgniteH2Indexing.java   |  24 ++-
 31 files changed, 667 insertions(+), 785 deletions(-)
----------------------------------------------------------------------



[34/50] [abbrv] ignite git commit: ignite-2013 GridCacheEvictionLockUnlockSelfTest.testPartitioned test fixed

Posted by ag...@apache.org.
ignite-2013 GridCacheEvictionLockUnlockSelfTest.testPartitioned test fixed


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

Branch: refs/heads/ignite-1282
Commit: 95ab2310d2db49baadceefe3e667a3e1c930c926
Parents: 1727df6
Author: agura <ag...@gridgain.com>
Authored: Thu Nov 26 21:54:34 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Nov 27 14:45:19 2015 +0300

----------------------------------------------------------------------
 .../cache/eviction/GridCacheEvictionLockUnlockSelfTest.java        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/95ab2310/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
index 11faca3..75f5c8f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
@@ -142,7 +142,7 @@ public class GridCacheEvictionLockUnlockSelfTest extends GridCommonAbstractTest
                 assertEquals(gridCnt, touchCnt.get());
 
                 for (int j = 0; j < gridCnt; j++)
-                    assertFalse(jcache(j).containsKey("key"));
+                    assertEquals(0, jcache(j).size());
             }
         }
         finally {


[39/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5


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

Branch: refs/heads/ignite-1282
Commit: 56aeea3d1f519229ad7ce80992a23bf367ef72c1
Parents: fc10b3e e519c2f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 16:48:28 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 16:48:28 2015 +0300

----------------------------------------------------------------------
 .../hibernate/CacheHibernatePersonStore.java    |   4 +-
 .../hibernate/CacheHibernateStoreExample.java   |   2 +-
 .../datagrid/store/hibernate/Person.hbm.xml     |   2 +-
 .../apache/ignite/examples/binary/Address.java  |  72 ---------
 .../apache/ignite/examples/binary/Employee.java |  93 -----------
 .../ignite/examples/binary/EmployeeKey.java     |  93 -----------
 .../ignite/examples/binary/Organization.java    |  93 -----------
 .../examples/binary/OrganizationType.java       |  32 ----
 ...ComputeClientBinaryTaskExecutionExample.java |   4 +-
 .../CacheClientBinaryPutGetExample.java         |   6 +-
 .../datagrid/CacheClientBinaryQueryExample.java |  22 +--
 .../examples/datagrid/CacheQueryExample.java    | 161 ++++---------------
 .../ignite/examples/datagrid/store/Person.java  | 154 ------------------
 .../store/auto/CacheAutoStoreExample.java       |   4 +-
 .../auto/CacheAutoStoreLoadDataExample.java     |   4 +-
 .../datagrid/store/auto/CacheConfig.java        |   6 +-
 .../store/dummy/CacheDummyPersonStore.java      |  12 +-
 .../store/dummy/CacheDummyStoreExample.java     |   4 +-
 .../store/jdbc/CacheJdbcPersonStore.java        |  18 +--
 .../store/jdbc/CacheJdbcStoreExample.java       |   4 +-
 .../store/spring/CacheSpringPersonStore.java    |  10 +-
 .../store/spring/CacheSpringStoreExample.java   |   4 +-
 .../ignite/examples/model/Organization.java     |  55 +++++++
 .../apache/ignite/examples/model/Person.java    | 120 ++++++++++++++
 .../ignite/examples/model/binary/Address.java   |  72 +++++++++
 .../ignite/examples/model/binary/Employee.java  |  93 +++++++++++
 .../examples/model/binary/EmployeeKey.java      |  93 +++++++++++
 .../examples/model/binary/Organization.java     |  93 +++++++++++
 .../examples/model/binary/OrganizationType.java |  32 ++++
 .../examples/ScalarCacheQueryExample.scala      |  66 ++------
 30 files changed, 651 insertions(+), 777 deletions(-)
----------------------------------------------------------------------



[20/50] [abbrv] ignite git commit: Fixed hang in data structures failover tests.

Posted by ag...@apache.org.
Fixed hang in data structures failover tests.


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

Branch: refs/heads/ignite-1282
Commit: 41fe46953af80304e05c76007df3c30b8d681742
Parents: e9f22ab
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 12:33:14 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 12:33:14 2015 +0300

----------------------------------------------------------------------
 .../CacheDataStructuresManager.java             | 45 ++++++++++++--------
 .../datastructures/DataStructuresProcessor.java | 20 +--------
 ...gniteAtomicLongChangingTopologySelfTest.java | 30 ++++++++++---
 3 files changed, 53 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/41fe4695/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
index 431be1e..ec787f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
@@ -383,7 +383,7 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
             if (create) {
                 hdr = new GridCacheSetHeader(IgniteUuid.randomUuid(), collocated);
 
-                GridCacheSetHeader old = retryPutIfAbsent(cache, key, hdr);
+                GridCacheSetHeader old = (GridCacheSetHeader)cache.getAndPutIfAbsent(key, hdr);
 
                 if (old != null)
                     hdr = old;
@@ -493,6 +493,12 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
 
                         continue;
                     }
+                    else if (!pingNodes(nodes)) {
+                        if (log.isDebugEnabled())
+                            log.debug("RemoveSetData job failed and set data node left, will retry: " + e);
+
+                        continue;
+                    }
                     else
                         throw e;
                 }
@@ -510,6 +516,12 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
 
                         continue;
                     }
+                    else if (!pingNodes(nodes)) {
+                        if (log.isDebugEnabled())
+                            log.debug("RemoveSetData job failed and set data node left, will retry: " + e);
+
+                        continue;
+                    }
                     else
                         throw e;
                 }
@@ -526,6 +538,20 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
     }
 
     /**
+     * @param nodes Nodes to ping.
+     * @return {@code True} if was able to ping all nodes.
+     * @throws IgniteCheckedException If failed/
+     */
+    private boolean pingNodes(Collection<ClusterNode> nodes) throws IgniteCheckedException {
+        for (ClusterNode node : nodes) {
+            if (!cctx.discovery().pingNode(node.id()))
+                return false;
+        }
+
+        return true;
+    }
+
+    /**
      * @param key Set item key.
      * @param rmv {@code True} if item was removed.
      */
@@ -562,23 +588,6 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
 
     /**
      * @param cache Cache.
-     * @param key Key.
-     * @param val Value.
-     * @throws IgniteCheckedException If failed.
-     * @return Previous value.
-     */
-    @SuppressWarnings("unchecked")
-    @Nullable private <T> T retryPutIfAbsent(final IgniteInternalCache cache, final Object key, final T val)
-        throws IgniteCheckedException {
-        return DataStructuresProcessor.retry(log, new Callable<T>() {
-            @Nullable @Override public T call() throws Exception {
-                return (T)cache.getAndPutIfAbsent(key, val);
-            }
-        });
-    }
-
-    /**
-     * @param cache Cache.
      * @param keys Keys to remove.
      * @throws IgniteCheckedException If failed.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/41fe4695/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index 23d64cf..998bd92 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -973,7 +973,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
         IgniteOutClosureX<GridCacheQueueHeader> rmv = new IgniteOutClosureX<GridCacheQueueHeader>() {
             @Override public GridCacheQueueHeader applyx() throws IgniteCheckedException {
-                return (GridCacheQueueHeader)retryRemove(cctx.cache(), new GridCacheQueueHeaderKey(name));
+                return (GridCacheQueueHeader)cctx.cache().getAndRemove(new GridCacheQueueHeaderKey(name));
             }
         };
 
@@ -1569,7 +1569,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
         IgniteOutClosureX<GridCacheSetHeader> rmv = new IgniteOutClosureX<GridCacheSetHeader>() {
             @Override public GridCacheSetHeader applyx() throws IgniteCheckedException {
-                return (GridCacheSetHeader)retryRemove(cctx.cache(), new GridCacheSetHeaderKey(name));
+                return (GridCacheSetHeader)cctx.cache().getAndRemove(new GridCacheSetHeaderKey(name));
             }
         };
 
@@ -1583,22 +1583,6 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * @param cache Cache.
-     * @param key Key to remove.
-     * @throws IgniteCheckedException If failed.
-     * @return Removed value.
-     */
-    @SuppressWarnings("unchecked")
-    @Nullable private <T> T retryRemove(final IgniteInternalCache cache, final Object key)
-        throws IgniteCheckedException {
-        return retry(log, new Callable<T>() {
-            @Nullable @Override public T call() throws Exception {
-                return (T)cache.getAndRemove(key);
-            }
-        });
-    }
-
-    /**
      * @param log Logger.
      * @param call Callable.
      * @return Callable result.

http://git-wip-us.apache.org/repos/asf/ignite/blob/41fe4695/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
index c00557d..a8d5801 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
@@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicReferenceArray;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteAtomicLong;
 import org.apache.ignite.IgniteQueue;
+import org.apache.ignite.IgniteSet;
 import org.apache.ignite.configuration.AtomicConfiguration;
 import org.apache.ignite.configuration.CollectionConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -56,7 +57,7 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
     /** Grid count. */
     private static final int GRID_CNT = 5;
 
-    /** Restart cound. */
+    /** Restart count. */
     private static final int RESTART_CNT = 15;
 
     /** Atomic long name. */
@@ -133,8 +134,6 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
      * @throws Exception If failed.
      */
     public void testClientAtomicLongCreateCloseFailover() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1732");
-
         testFailoverWithClient(new IgniteInClosure<Ignite>() {
             @Override public void apply(Ignite ignite) {
                 for (int i = 0; i < 100; i++) {
@@ -150,8 +149,6 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
      * @throws Exception If failed.
      */
     public void testClientQueueCreateCloseFailover() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1976");
-
         testFailoverWithClient(new IgniteInClosure<Ignite>() {
             @Override public void apply(Ignite ignite) {
                 for (int i = 0; i < 100; i++) {
@@ -170,6 +167,27 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testClientSetCreateCloseFailover() throws Exception {
+        testFailoverWithClient(new IgniteInClosure<Ignite>() {
+            @Override public void apply(Ignite ignite) {
+                for (int i = 0; i < 100; i++) {
+                    CollectionConfiguration colCfg = new CollectionConfiguration();
+
+                    colCfg.setBackups(1);
+                    colCfg.setCacheMode(PARTITIONED);
+                    colCfg.setAtomicityMode(i % 2 == 0 ? TRANSACTIONAL : ATOMIC);
+
+                    IgniteSet set = ignite.set("set-" + i, colCfg);
+
+                    set.close();
+                }
+            }
+        });
+    }
+
+    /**
      * @param c Test iteration closure.
      * @throws Exception If failed.
      */
@@ -188,7 +206,7 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
 
         IgniteInternalFuture<?> fut = restartThread(finished);
 
-        long stop = System.currentTimeMillis() + 30_000;
+        long stop = System.currentTimeMillis() + 60_000;
 
         try {
             int iter = 0;


[33/50] [abbrv] ignite git commit: ignite-2010 IgniteCacheCrossCacheTxFailoverTest.testCrossCachePessimisticTxFailoverOffheapSwap test fixed

Posted by ag...@apache.org.
ignite-2010 IgniteCacheCrossCacheTxFailoverTest.testCrossCachePessimisticTxFailoverOffheapSwap test fixed


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

Branch: refs/heads/ignite-1282
Commit: 1727df6a334b3cc879ca7bc9dd76e6f52f1e027a
Parents: 9c46fa9
Author: agura <ag...@gridgain.com>
Authored: Thu Nov 26 17:36:12 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Nov 27 14:44:05 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java   | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1727df6a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
index e46761b..0294dea 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -391,6 +392,11 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
             ignite0.destroyCache(CACHE1);
             ignite0.destroyCache(CACHE2);
 
+            AffinityTopologyVersion topVer = ignite0.context().cache().context().exchange().lastTopologyFuture().get();
+
+            for (Ignite ignite : G.allGrids())
+                ((IgniteKernal)ignite).context().cache().context().exchange().affinityReadyFuture(topVer).get();
+
             awaitPartitionMapExchange();
         }
     }


[06/50] [abbrv] ignite git commit: Ssl suite

Posted by ag...@apache.org.
Ssl suite


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

Branch: refs/heads/ignite-1282
Commit: a0e414eb1695e2c43d6f4f782ba4bee64682789c
Parents: ec81696
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Nov 26 19:01:14 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Nov 26 19:01:14 2015 +0300

----------------------------------------------------------------------
 .../IgniteCacheFailoverTestSuite3.java          |  6 ---
 .../IgniteCacheFailoverTestSuiteSsl.java        | 41 ++++++++++++++++++++
 2 files changed, 41 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a0e414eb/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
index 1f94f9e..4b04c05 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
@@ -21,8 +21,6 @@ import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryAtomicSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryTransactionalSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.spi.communication.tcp.IgniteCacheSslStartStopSelfTest;
 
 /**
  * Test suite.
@@ -39,10 +37,6 @@ public class IgniteCacheFailoverTestSuite3 extends TestSuite {
         suite.addTestSuite(IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.class);
         suite.addTestSuite(IgniteCachePutRetryTransactionalSelfTest.class);
 
-        // Disable SSL test with old JDK because of https://bugs.openjdk.java.net/browse/JDK-8013809.
-        if (!IgniteUtils.isHotSpot() || IgniteUtils.isJavaVersionAtLeast("1.7.0_65"))
-            suite.addTestSuite(IgniteCacheSslStartStopSelfTest.class);
-
         return suite;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/a0e414eb/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuiteSsl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuiteSsl.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuiteSsl.java
new file mode 100644
index 0000000..99a1463
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuiteSsl.java
@@ -0,0 +1,41 @@
+/*
+ *  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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.spi.communication.tcp.IgniteCacheSslStartStopSelfTest;
+
+/**
+ * Test suite.
+ */
+public class IgniteCacheFailoverTestSuiteSsl extends TestSuite {
+    /**
+     * @return Ignite Cache Failover test suite.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Cache Failover Test Suite SSL");
+
+        // Disable SSL test with old JDK because of https://bugs.openjdk.java.net/browse/JDK-8013809.
+        if (!IgniteUtils.isHotSpot() || IgniteUtils.isJavaVersionAtLeast("1.7.0_65"))
+            suite.addTestSuite(IgniteCacheSslStartStopSelfTest.class);
+
+        return suite;
+    }
+}


[17/50] [abbrv] ignite git commit: IGNITE-1195 Fixed hadoop build.

Posted by ag...@apache.org.
IGNITE-1195 Fixed hadoop build.


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

Branch: refs/heads/ignite-1282
Commit: bde1d1db3592f74e9e46ca6af57b55adc8b96c1f
Parents: e9f22ab
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Nov 27 12:18:16 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Nov 27 12:18:16 2015 +0300

----------------------------------------------------------------------
 modules/yarn/pom.xml                                     |  6 +++---
 .../ignite/yarn/IgniteApplicationMasterSelfTest.java     | 11 +++++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bde1d1db/modules/yarn/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yarn/pom.xml b/modules/yarn/pom.xml
index 2b758dc..d1f6390 100644
--- a/modules/yarn/pom.xml
+++ b/modules/yarn/pom.xml
@@ -35,20 +35,20 @@
     <url>http://ignite.apache.org</url>
 
     <properties>
-        <hadoop.version>2.7.0</hadoop.version>
+        <hadoop-yarn.version>2.7.0</hadoop-yarn.version>
     </properties>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-yarn-client</artifactId>
-            <version>${hadoop.version}</version>
+            <version>${hadoop-yarn.version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-common</artifactId>
-            <version>${hadoop.version}</version>
+            <version>${hadoop-yarn.version}</version>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/bde1d1db/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java b/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
index 2173701..97f6a12 100644
--- a/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
+++ b/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
@@ -382,8 +382,15 @@ public class IgniteApplicationMasterSelfTest extends TestCase {
             return 0;
         }
 
-        /** {@inheritDoc} */
-        @Override public void updateBlacklist(List blacklistAdditions, List blacklistRemovals) {
+        /**
+         * Update application's blacklist with addition or removal resources.
+         *
+         * @param blacklistAdditions list of resources which should be added to the
+         *        application blacklist
+         * @param blacklistRemovals list of resources which should be removed from the
+         *        application blacklist
+         */
+        public void updateBlacklist(List blacklistAdditions, List blacklistRemovals) {
             // No-op.
         }
     }


[45/50] [abbrv] ignite git commit: marshaller perf suggestion fixed

Posted by ag...@apache.org.
marshaller perf suggestion fixed


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

Branch: refs/heads/ignite-1282
Commit: 0c03b916a4608e35993eeff276e2e12638930d52
Parents: fb5d54a
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Nov 27 20:27:29 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Nov 27 20:27:29 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/internal/IgniteKernal.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0c03b916/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 305769b..68d48c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -53,21 +53,21 @@ import org.apache.ignite.IgniteAtomicLong;
 import org.apache.ignite.IgniteAtomicReference;
 import org.apache.ignite.IgniteAtomicSequence;
 import org.apache.ignite.IgniteAtomicStamped;
+import org.apache.ignite.IgniteBinary;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteClientDisconnectedException;
 import org.apache.ignite.IgniteCompute;
 import org.apache.ignite.IgniteCountDownLatch;
-import org.apache.ignite.IgniteSemaphore;
 import org.apache.ignite.IgniteDataStreamer;
 import org.apache.ignite.IgniteEvents;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteFileSystem;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.IgniteBinary;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteScheduler;
+import org.apache.ignite.IgniteSemaphore;
 import org.apache.ignite.IgniteServices;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.IgniteSystemProperties;
@@ -96,6 +96,8 @@ import org.apache.ignite.internal.managers.failover.GridFailoverManager;
 import org.apache.ignite.internal.managers.indexing.GridIndexingManager;
 import org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager;
 import org.apache.ignite.internal.managers.swapspace.GridSwapSpaceManager;
+import org.apache.ignite.internal.portable.BinaryEnumCache;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
 import org.apache.ignite.internal.processors.GridProcessor;
 import org.apache.ignite.internal.processors.affinity.GridAffinityProcessor;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
@@ -133,7 +135,6 @@ import org.apache.ignite.internal.processors.service.GridServiceProcessor;
 import org.apache.ignite.internal.processors.session.GridTaskSessionProcessor;
 import org.apache.ignite.internal.processors.task.GridTaskProcessor;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
-import org.apache.ignite.internal.portable.BinaryEnumCache;
 import org.apache.ignite.internal.util.GridTimerTask;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -158,7 +159,6 @@ import org.apache.ignite.lifecycle.LifecycleBean;
 import org.apache.ignite.lifecycle.LifecycleEventType;
 import org.apache.ignite.marshaller.MarshallerExclusions;
 import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.internal.portable.BinaryMarshaller;
 import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
 import org.apache.ignite.mxbean.IgniteMXBean;
 import org.apache.ignite.mxbean.ThreadPoolMXBean;
@@ -1192,9 +1192,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         if (cfg.getIncludeEventTypes() != null && cfg.getIncludeEventTypes().length != 0)
             perf.add("Disable grid events (remove 'includeEventTypes' from configuration)");
 
-        if (OptimizedMarshaller.available() && !(cfg.getMarshaller() instanceof OptimizedMarshaller))
-            perf.add("Enable optimized marshaller (set 'marshaller' to " +
-                OptimizedMarshaller.class.getSimpleName() + ')');
+        if (BinaryMarshaller.available() && !(cfg.getMarshaller() instanceof BinaryMarshaller))
+            perf.add("Enable binary marshaller (set 'marshaller' to " +
+                BinaryMarshaller.class.getSimpleName() + ')');
     }
 
     /**


[22/50] [abbrv] ignite git commit: IGNITE-1956: Added binary enums support.

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
index 99af56d..e50279c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
@@ -30,74 +30,52 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Type.
         /// </summary>
-        Type Type
-        {
-            get;
-        }
+        Type Type { get; }
 
         /// <summary>
         /// Type ID.
         /// </summary>
-        int TypeId
-        {
-            get;
-        }
+        int TypeId { get; }
 
         /// <summary>
         /// Type name.
         /// </summary>
-        string TypeName
-        {
-            get;
-        }
+        string TypeName { get; }
 
         /// <summary>
         /// User type flag.
         /// </summary>
-        bool UserType
-        {
-            get;
-        }
+        bool UserType { get; }
 
         /// <summary>
         /// Whether to cache deserialized value in IBinaryObject
         /// </summary>
-        bool KeepDeserialized
-        {
-            get;
-        }
+        bool KeepDeserialized { get; }
 
         /// <summary>
         /// Name converter.
         /// </summary>
-        IBinaryNameMapper NameMapper
-        {
-            get;
-        }
+        IBinaryNameMapper NameMapper { get; }
 
         /// <summary>
         /// Mapper.
         /// </summary>
-        IBinaryIdMapper IdMapper
-        {
-            get;
-        }
+        IBinaryIdMapper IdMapper { get; }
 
         /// <summary>
         /// Serializer.
         /// </summary>
-        IBinarySerializer Serializer
-        {
-            get;
-        }
+        IBinarySerializer Serializer { get; }
 
         /// <summary>
         /// Affinity key field name.
         /// </summary>
-        string AffinityKeyFieldName
-        {
-            get;
-        }
+        string AffinityKeyFieldName { get; }
+
+        /// <summary>
+        /// Gets a value indicating whether this descriptor represents an enum type.
+        /// </summary>
+        bool IsEnum { get; }
 
         /// <summary>
         /// Write type structure.

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs
deleted file mode 100644
index ecc6807..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs
+++ /dev/null
@@ -1,192 +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.
- */
-
-namespace Apache.Ignite.Core.Impl.Binary
-{
-    using System;
-    using System.Collections.Generic;
-    using System.IO;
-    using Apache.Ignite.Core.Binary;
-    using Apache.Ignite.Core.Common;
-    using Apache.Ignite.Core.Impl.Binary.IO;
-    using Apache.Ignite.Core.Impl.Common;
-
-    /// <summary>
-    /// Binary implementation.
-    /// </summary>
-    internal class IgniteBinary : IIgniteBinary
-    {
-        /** Owning grid. */
-        private readonly Marshaller _marsh;
-
-        /// <summary>
-        /// Constructor.
-        /// </summary>
-        /// <param name="marsh">Marshaller.</param>
-        internal IgniteBinary(Marshaller marsh)
-        {
-            _marsh = marsh;
-        }
-
-        /** <inheritDoc /> */
-        public T ToBinary<T>(object obj)
-        {
-            if (obj is IBinaryObject)
-                return (T)obj;
-
-            IBinaryStream stream = new BinaryHeapStream(1024);
-
-            // Serialize.
-            BinaryWriter writer = _marsh.StartMarshal(stream);
-
-            try
-            {
-                writer.Write(obj);
-            }
-            finally
-            {
-                // Save metadata.
-                _marsh.FinishMarshal(writer);
-            }
-
-            // Deserialize.
-            stream.Seek(0, SeekOrigin.Begin);
-
-            return _marsh.Unmarshal<T>(stream, BinaryMode.ForceBinary);
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryObjectBuilder GetBuilder(Type type)
-        {
-            IgniteArgumentCheck.NotNull(type, "type");
-
-            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(type);
-
-            if (desc == null)
-                throw new IgniteException("Type is not binary (add it to BinaryConfiguration): " + 
-                    type.FullName);
-
-            return Builder0(null, BinaryFromDescriptor(desc), desc);
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryObjectBuilder GetBuilder(string typeName)
-        {
-            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
-            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(typeName);
-            
-            return Builder0(null, BinaryFromDescriptor(desc), desc);
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryObjectBuilder GetBuilder(IBinaryObject obj)
-        {
-            IgniteArgumentCheck.NotNull(obj, "obj");
-
-            BinaryObject obj0 = obj as BinaryObject;
-
-            if (obj0 == null)
-                throw new ArgumentException("Unsupported object type: " + obj.GetType());
-
-            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, obj0.TypeId);
-            
-            return Builder0(null, obj0, desc);
-        }
-
-        /** <inheritDoc /> */
-        public int GetTypeId(string typeName)
-        {
-            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
-            return Marshaller.GetDescriptor(typeName).TypeId;
-        }
-
-        /** <inheritDoc /> */
-        public ICollection<IBinaryType> GetBinaryTypes()
-        {
-            return Marshaller.Ignite.ClusterGroup.GetBinaryTypes();
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryType GetBinaryType(int typeId)
-        {
-            return Marshaller.GetBinaryType(typeId);
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryType GetBinaryType(string typeName)
-        {
-            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
-            return GetBinaryType(GetTypeId(typeName));
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryType GetBinaryType(Type type)
-        {
-            IgniteArgumentCheck.NotNull(type, "type");
-
-            var desc = Marshaller.GetDescriptor(type);
-
-            return desc == null ? null : Marshaller.GetBinaryType(desc.TypeId);
-        }
-
-        /// <summary>
-        /// Marshaller.
-        /// </summary>
-        internal Marshaller Marshaller
-        {
-            get
-            {
-                return _marsh;
-            }
-        }
-
-        /// <summary>
-        /// Create empty binary object from descriptor.
-        /// </summary>
-        /// <param name="desc">Descriptor.</param>
-        /// <returns>Empty binary object.</returns>
-        private BinaryObject BinaryFromDescriptor(IBinaryTypeDescriptor desc)
-        {
-            var len = BinaryObjectHeader.Size;
-
-            var hdr = new BinaryObjectHeader(desc.TypeId, 0, len, 0, len,
-                desc.UserType ? BinaryObjectHeader.Flag.UserType : BinaryObjectHeader.Flag.None);
-
-            var stream = new BinaryHeapStream(len);
-
-            BinaryObjectHeader.Write(hdr, stream, 0);
-
-            return new BinaryObject(_marsh, stream.InternalArray, 0, hdr);
-        }
-
-        /// <summary>
-        /// Internal builder creation routine.
-        /// </summary>
-        /// <param name="parent">Parent builder.</param>
-        /// <param name="obj">binary object.</param>
-        /// <param name="desc">Type descriptor.</param>
-        /// <returns>Builder.</returns>
-        private BinaryObjectBuilder Builder0(BinaryObjectBuilder parent, BinaryObject obj, 
-            IBinaryTypeDescriptor desc)
-        {
-            return new BinaryObjectBuilder(this, parent, obj, desc);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index 251610e..457830f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -19,7 +19,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 {
     using System;
     using System.Collections.Generic;
-    using System.Globalization;
+    using System.Diagnostics;
     using System.Linq;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Binary.IO;
@@ -149,14 +149,14 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </summary>
         /// <param name="writer">Writer.</param>
         /// <returns>Dictionary with metadata.</returns>
-        public void FinishMarshal(IBinaryWriter writer)
+        public void FinishMarshal(BinaryWriter writer)
         {
-            var meta = ((BinaryWriter) writer).GetBinaryTypes();
+            var metas = writer.GetBinaryTypes();
 
             var ignite = Ignite;
 
-            if (ignite != null && meta != null && meta.Count > 0)
-                ignite.PutBinaryTypes(meta);
+            if (ignite != null && metas != null && metas.Count > 0)
+                ignite.PutBinaryTypes(metas);
         }
 
         /// <summary>
@@ -266,7 +266,22 @@ namespace Apache.Ignite.Core.Impl.Binary
                     return meta;
             }
 
-            return BinaryType.EmptyMeta;
+            return BinaryType.Empty;
+        }
+
+        /// <summary>
+        /// Puts the binary type metadata to Ignite.
+        /// </summary>
+        /// <param name="desc">Descriptor.</param>
+        /// <param name="fields">Fields.</param>
+        public void PutBinaryType(IBinaryTypeDescriptor desc, IDictionary<string, int> fields = null)
+        {
+            Debug.Assert(desc != null);
+
+            GetBinaryTypeHandler(desc);  // ensure that handler exists
+
+            if (Ignite != null)
+                Ignite.PutBinaryTypes(new[] {new BinaryType(desc, fields)});
         }
 
         /// <summary>
@@ -287,7 +302,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                         IDictionary<int, BinaryTypeHolder> metas0 =
                             new Dictionary<int, BinaryTypeHolder>(_metas);
 
-                        holder = new BinaryTypeHolder(desc.TypeId, desc.TypeName, desc.AffinityKeyFieldName);
+                        holder = new BinaryTypeHolder(desc.TypeId, desc.TypeName, desc.AffinityKeyFieldName, desc.IsEnum);
 
                         metas0[desc.TypeId] = holder;
 
@@ -298,7 +313,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             if (holder != null)
             {
-                ICollection<int> ids = holder.FieldIds();
+                ICollection<int> ids = holder.GetFieldIds();
 
                 bool newType = ids.Count == 0 && !holder.Saved();
 
@@ -312,23 +327,20 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// Callback invoked when metadata has been sent to the server and acknowledged by it.
         /// </summary>
         /// <param name="newMetas">Binary types.</param>
-        public void OnBinaryTypesSent(IDictionary<int, IBinaryType> newMetas)
+        public void OnBinaryTypesSent(IEnumerable<BinaryType> newMetas)
         {
-            foreach (KeyValuePair<int, IBinaryType> metaEntry in newMetas)
+            foreach (var meta in newMetas)
             {
-                BinaryType meta = (BinaryType) metaEntry.Value;
-
-                IDictionary<int, Tuple<string, int>> mergeInfo =
-                    new Dictionary<int, Tuple<string, int>>(meta.FieldsMap().Count);
+                var mergeInfo = new Dictionary<int, Tuple<string, int>>(meta.GetFieldsMap().Count);
 
-                foreach (KeyValuePair<string, int> fieldMeta in meta.FieldsMap())
+                foreach (KeyValuePair<string, int> fieldMeta in meta.GetFieldsMap())
                 {
-                    int fieldId = BinaryUtils.FieldId(metaEntry.Key, fieldMeta.Key, null, null);
+                    int fieldId = BinaryUtils.FieldId(meta.TypeId, fieldMeta.Key, null, null);
 
                     mergeInfo[fieldId] = new Tuple<string, int>(fieldMeta.Key, fieldMeta.Value);
                 }
 
-                _metas[metaEntry.Key].Merge(mergeInfo);
+                _metas[meta.TypeId].Merge(mergeInfo);
             }
         }
         
@@ -396,7 +408,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             if (type != null)
             {
                 // Type is found.
-                var typeName = GetTypeName(type);
+                var typeName = BinaryUtils.GetTypeName(type);
 
                 int typeId = BinaryUtils.TypeId(typeName, nameMapper, idMapper);
 
@@ -408,8 +420,15 @@ namespace Apache.Ignite.Core.Impl.Binary
                 if (refSerializer != null)
                     refSerializer.Register(type, typeId, nameMapper, idMapper);
 
+                if (typeCfg.IsEnum != type.IsEnum)
+                    throw new BinaryObjectException(
+                        string.Format(
+                            "Invalid IsEnum flag in binary type configuration. " +
+                            "Configuration value: IsEnum={0}, actual type: IsEnum={1}",
+                            typeCfg.IsEnum, type.IsEnum));
+
                 AddType(type, typeId, typeName, true, keepDeserialized, nameMapper, idMapper, serializer,
-                    typeCfg.AffinityKeyFieldName);
+                    typeCfg.AffinityKeyFieldName, type.IsEnum);
             }
             else
             {
@@ -419,7 +438,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                 int typeId = BinaryUtils.TypeId(typeName, nameMapper, idMapper);
 
                 AddType(null, typeId, typeName, true, keepDeserialized, nameMapper, idMapper, null,
-                    typeCfg.AffinityKeyFieldName);
+                    typeCfg.AffinityKeyFieldName, typeCfg.IsEnum);
             }
         }
 
@@ -434,7 +453,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                 ? BinarizableSerializer.Instance 
                 : null;
         }
-        
+
         /// <summary>
         /// Add type.
         /// </summary>
@@ -447,9 +466,10 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="idMapper">ID mapper.</param>
         /// <param name="serializer">Serializer.</param>
         /// <param name="affKeyFieldName">Affinity key field name.</param>
+        /// <param name="isEnum">Enum flag.</param>
         private void AddType(Type type, int typeId, string typeName, bool userType, 
             bool keepDeserialized, IBinaryNameMapper nameMapper, IBinaryIdMapper idMapper,
-            IBinarySerializer serializer, string affKeyFieldName)
+            IBinarySerializer serializer, string affKeyFieldName, bool isEnum)
         {
             long typeKey = BinaryUtils.TypeKey(userType, typeId);
 
@@ -470,9 +490,8 @@ namespace Apache.Ignite.Core.Impl.Binary
             if (userType && _typeNameToDesc.ContainsKey(typeName))
                 throw new BinaryObjectException("Conflicting type name: " + typeName);
 
-            IBinaryTypeDescriptor descriptor =
-                new BinaryFullTypeDescriptor(type, typeId, typeName, userType, nameMapper, idMapper, serializer,
-                    keepDeserialized, affKeyFieldName);
+            var descriptor = new BinaryFullTypeDescriptor(type, typeId, typeName, userType, nameMapper, idMapper, 
+                serializer, keepDeserialized, affKeyFieldName, isEnum);
 
             if (type != null)
                 _typeToDesc[type] = descriptor;
@@ -492,7 +511,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             var serializer = new BinarySystemTypeSerializer<T>(ctor);
 
-            AddType(type, typeId, GetTypeName(type), false, false, null, null, serializer, null);
+            AddType(type, typeId, BinaryUtils.GetTypeName(type), false, false, null, null, serializer, null, false);
         }
 
         /// <summary>
@@ -516,22 +535,5 @@ namespace Apache.Ignite.Core.Impl.Binary
             AddSystemType(BinaryUtils.TypeMessageListenerHolder, w => new MessageListenerHolder(w));
             AddSystemType(BinaryUtils.TypeStreamReceiverHolder, w => new StreamReceiverHolder(w));
         }
-
-        /// <summary>
-        /// Gets the name of the type.
-        /// </summary>
-        /// <param name="type">The type.</param>
-        /// <returns>
-        /// Simple type name for non-generic types; simple type name with appended generic arguments for generic types.
-        /// </returns>
-        private static string GetTypeName(Type type)
-        {
-            if (!type.IsGenericType)
-                return type.Name;
-
-            var args = type.GetGenericArguments().Select(GetTypeName).Aggregate((x, y) => x + "," + y);
-
-            return string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", type.Name, args);
-        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
index 3e9a28d..476e651 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
@@ -27,9 +27,8 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
     internal class BinaryType : IBinaryType
     {
         /** Empty metadata. */
-        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
-        public static readonly BinaryType EmptyMeta =
-            new BinaryType(BinaryUtils.TypeObject, BinaryTypeNames.TypeNameObject, null, null);
+        public static readonly BinaryType Empty =
+            new BinaryType(BinaryUtils.TypeObject, BinaryTypeNames.TypeNameObject, null, null, false);
 
         /** Empty dictionary. */
         private static readonly IDictionary<string, int> EmptyDict = new Dictionary<string, int>();
@@ -37,82 +36,74 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /** Empty list. */
         private static readonly ICollection<string> EmptyList = new List<string>().AsReadOnly();
 
+        /** Type name map. */
+        private static readonly string[] TypeNames = new string[byte.MaxValue];
+
         /** Fields. */
         private readonly IDictionary<string, int> _fields;
 
+        /** Enum flag. */
+        private readonly bool _isEnum;
+
+        /** Type id. */
+        private readonly int _typeId;
+
+        /** Type name. */
+        private readonly string _typeName;
+
+        /** Aff key field name. */
+        private readonly string _affinityKeyFieldName;
+
+        /// <summary>
+        /// Initializes the <see cref="BinaryType"/> class.
+        /// </summary>
+        static BinaryType()
+        {
+            TypeNames[BinaryUtils.TypeBool] = BinaryTypeNames.TypeNameBool;
+            TypeNames[BinaryUtils.TypeByte] = BinaryTypeNames.TypeNameByte;
+            TypeNames[BinaryUtils.TypeShort] = BinaryTypeNames.TypeNameShort;
+            TypeNames[BinaryUtils.TypeChar] = BinaryTypeNames.TypeNameChar;
+            TypeNames[BinaryUtils.TypeInt] = BinaryTypeNames.TypeNameInt;
+            TypeNames[BinaryUtils.TypeLong] = BinaryTypeNames.TypeNameLong;
+            TypeNames[BinaryUtils.TypeFloat] = BinaryTypeNames.TypeNameFloat;
+            TypeNames[BinaryUtils.TypeDouble] = BinaryTypeNames.TypeNameDouble;
+            TypeNames[BinaryUtils.TypeDecimal] = BinaryTypeNames.TypeNameDecimal;
+            TypeNames[BinaryUtils.TypeString] = BinaryTypeNames.TypeNameString;
+            TypeNames[BinaryUtils.TypeGuid] = BinaryTypeNames.TypeNameGuid;
+            TypeNames[BinaryUtils.TypeTimestamp] = BinaryTypeNames.TypeNameTimestamp;
+            TypeNames[BinaryUtils.TypeEnum] = BinaryTypeNames.TypeNameEnum;
+            TypeNames[BinaryUtils.TypeObject] = BinaryTypeNames.TypeNameObject;
+            TypeNames[BinaryUtils.TypeArrayBool] = BinaryTypeNames.TypeNameArrayBool;
+            TypeNames[BinaryUtils.TypeArrayByte] = BinaryTypeNames.TypeNameArrayByte;
+            TypeNames[BinaryUtils.TypeArrayShort] = BinaryTypeNames.TypeNameArrayShort;
+            TypeNames[BinaryUtils.TypeArrayChar] = BinaryTypeNames.TypeNameArrayChar;
+            TypeNames[BinaryUtils.TypeArrayInt] = BinaryTypeNames.TypeNameArrayInt;
+            TypeNames[BinaryUtils.TypeArrayLong] = BinaryTypeNames.TypeNameArrayLong;
+            TypeNames[BinaryUtils.TypeArrayFloat] = BinaryTypeNames.TypeNameArrayFloat;
+            TypeNames[BinaryUtils.TypeArrayDouble] = BinaryTypeNames.TypeNameArrayDouble;
+            TypeNames[BinaryUtils.TypeArrayDecimal] = BinaryTypeNames.TypeNameArrayDecimal;
+            TypeNames[BinaryUtils.TypeArrayString] = BinaryTypeNames.TypeNameArrayString;
+            TypeNames[BinaryUtils.TypeArrayGuid] = BinaryTypeNames.TypeNameArrayGuid;
+            TypeNames[BinaryUtils.TypeArrayTimestamp] = BinaryTypeNames.TypeNameArrayTimestamp;
+            TypeNames[BinaryUtils.TypeArrayEnum] = BinaryTypeNames.TypeNameArrayEnum;
+            TypeNames[BinaryUtils.TypeArray] = BinaryTypeNames.TypeNameArrayObject;
+            TypeNames[BinaryUtils.TypeCollection] = BinaryTypeNames.TypeNameCollection;
+            TypeNames[BinaryUtils.TypeDictionary] = BinaryTypeNames.TypeNameMap;
+        }
+
         /// <summary>
         /// Get type name by type ID.
         /// </summary>
         /// <param name="typeId">Type ID.</param>
         /// <returns>Type name.</returns>
-        private static string ConvertTypeName(int typeId)
+        private static string GetTypeName(int typeId)
         {
-            switch (typeId)
-            {
-                case BinaryUtils.TypeBool:
-                    return BinaryTypeNames.TypeNameBool;
-                case BinaryUtils.TypeByte:
-                    return BinaryTypeNames.TypeNameByte;
-                case BinaryUtils.TypeShort:
-                    return BinaryTypeNames.TypeNameShort;
-                case BinaryUtils.TypeChar:
-                    return BinaryTypeNames.TypeNameChar;
-                case BinaryUtils.TypeInt:
-                    return BinaryTypeNames.TypeNameInt;
-                case BinaryUtils.TypeLong:
-                    return BinaryTypeNames.TypeNameLong;
-                case BinaryUtils.TypeFloat:
-                    return BinaryTypeNames.TypeNameFloat;
-                case BinaryUtils.TypeDouble:
-                    return BinaryTypeNames.TypeNameDouble;
-                case BinaryUtils.TypeDecimal:
-                    return BinaryTypeNames.TypeNameDecimal;
-                case BinaryUtils.TypeString:
-                    return BinaryTypeNames.TypeNameString;
-                case BinaryUtils.TypeGuid:
-                    return BinaryTypeNames.TypeNameGuid;
-                case BinaryUtils.TypeTimestamp:
-                    return BinaryTypeNames.TypeNameTimestamp;
-                case BinaryUtils.TypeEnum:
-                    return BinaryTypeNames.TypeNameEnum;
-                case BinaryUtils.TypeBinary:
-                case BinaryUtils.TypeObject:
-                    return BinaryTypeNames.TypeNameObject;
-                case BinaryUtils.TypeArrayBool:
-                    return BinaryTypeNames.TypeNameArrayBool;
-                case BinaryUtils.TypeArrayByte:
-                    return BinaryTypeNames.TypeNameArrayByte;
-                case BinaryUtils.TypeArrayShort:
-                    return BinaryTypeNames.TypeNameArrayShort;
-                case BinaryUtils.TypeArrayChar:
-                    return BinaryTypeNames.TypeNameArrayChar;
-                case BinaryUtils.TypeArrayInt:
-                    return BinaryTypeNames.TypeNameArrayInt;
-                case BinaryUtils.TypeArrayLong:
-                    return BinaryTypeNames.TypeNameArrayLong;
-                case BinaryUtils.TypeArrayFloat:
-                    return BinaryTypeNames.TypeNameArrayFloat;
-                case BinaryUtils.TypeArrayDouble:
-                    return BinaryTypeNames.TypeNameArrayDouble;
-                case BinaryUtils.TypeArrayDecimal:
-                    return BinaryTypeNames.TypeNameArrayDecimal;
-                case BinaryUtils.TypeArrayString:
-                    return BinaryTypeNames.TypeNameArrayString;
-                case BinaryUtils.TypeArrayGuid:
-                    return BinaryTypeNames.TypeNameArrayGuid;
-                case BinaryUtils.TypeArrayTimestamp:
-                    return BinaryTypeNames.TypeNameArrayTimestamp;
-                case BinaryUtils.TypeArrayEnum:
-                    return BinaryTypeNames.TypeNameArrayEnum;
-                case BinaryUtils.TypeArray:
-                    return BinaryTypeNames.TypeNameArrayObject;
-                case BinaryUtils.TypeCollection:
-                    return BinaryTypeNames.TypeNameCollection;
-                case BinaryUtils.TypeDictionary:
-                    return BinaryTypeNames.TypeNameMap;
-                default:
-                    throw new BinaryObjectException("Invalid type ID: " + typeId);
-            }
+            var typeName = (typeId >= 0 && typeId < TypeNames.Length) ? TypeNames[typeId] : null;
+
+            if (typeName != null)
+                return typeName;
+
+            throw new BinaryObjectException("Invalid type ID: " + typeId);
         }
 
         /// <summary>
@@ -121,10 +112,22 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /// <param name="reader">The reader.</param>
         public BinaryType(IBinaryRawReader reader)
         {
-            TypeId = reader.ReadInt();
-            TypeName = reader.ReadString();
-            AffinityKeyFieldName = reader.ReadString();
+            _typeId = reader.ReadInt();
+            _typeName = reader.ReadString();
+            _affinityKeyFieldName = reader.ReadString();
             _fields = reader.ReadDictionaryAsGeneric<string, int>();
+            _isEnum = reader.ReadBoolean();
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="BinaryType"/> class.
+        /// </summary>
+        /// <param name="desc">Descriptor.</param>
+        /// <param name="fields">Fields.</param>
+        public BinaryType(IBinaryTypeDescriptor desc, IDictionary<string, int> fields = null) 
+            : this (desc.TypeId, desc.TypeName, fields, desc.AffinityKeyFieldName, desc.IsEnum)
+        {
+            // No-op.
         }
 
         /// <summary>
@@ -134,25 +137,33 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /// <param name="typeName">Type name.</param>
         /// <param name="fields">Fields.</param>
         /// <param name="affKeyFieldName">Affinity key field name.</param>
+        /// <param name="isEnum">Enum flag.</param>
         public BinaryType(int typeId, string typeName, IDictionary<string, int> fields,
-            string affKeyFieldName)
+            string affKeyFieldName, bool isEnum)
         {
-            TypeId = typeId;
-            TypeName = typeName;
-            AffinityKeyFieldName = affKeyFieldName;
+            _typeId = typeId;
+            _typeName = typeName;
+            _affinityKeyFieldName = affKeyFieldName;
             _fields = fields;
+            _isEnum = isEnum;
         }
 
         /// <summary>
         /// Type ID.
         /// </summary>
         /// <returns></returns>
-        public int TypeId { get; private set; }
+        public int TypeId
+        {
+            get { return _typeId; }
+        }
 
         /// <summary>
         /// Gets type name.
         /// </summary>
-        public string TypeName { get; private set; }
+        public string TypeName
+        {
+            get { return _typeName; }
+        }
 
         /// <summary>
         /// Gets field names for that type.
@@ -177,7 +188,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
 
                 _fields.TryGetValue(fieldName, out typeId);
 
-                return ConvertTypeName(typeId);
+                return GetTypeName(typeId);
             }
             
             return null;
@@ -186,13 +197,22 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /// <summary>
         /// Gets optional affinity key field name.
         /// </summary>
-        public string AffinityKeyFieldName { get; private set; }
+        public string AffinityKeyFieldName
+        {
+            get { return _affinityKeyFieldName; }
+        }
+
+        /** <inheritdoc /> */
+        public bool IsEnum
+        {
+            get { return _isEnum; }
+        }
 
         /// <summary>
         /// Gets fields map.
         /// </summary>
         /// <returns>Fields map.</returns>
-        public IDictionary<string, int> FieldsMap()
+        public IDictionary<string, int> GetFieldsMap()
         {
             return _fields ?? EmptyDict;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
index 524cda9..53ad77e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
@@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
 {
     using System;
     using System.Collections.Generic;
-    using Apache.Ignite.Core.Binary;
 
     /// <summary>
     /// Metadata for particular type.
@@ -35,11 +34,11 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /** Affinity key field name. */
         private readonly string _affKeyFieldName;
 
-        /** Empty metadata when nothig is know about object fields yet. */
-        private readonly IBinaryType _emptyMeta;
+        /** Enum flag. */
+        private readonly bool _isEnum;
 
         /** Collection of know field IDs. */
-        private volatile ICollection<int> _ids;
+        private volatile HashSet<int> _ids;
 
         /** Last known unmodifiable metadata which is given to the user. */
         private volatile BinaryType _meta;
@@ -47,19 +46,19 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /** Saved flag (set if type metadata was saved at least once). */
         private volatile bool _saved;
 
+
         /// <summary>
         /// Constructor.
         /// </summary>
         /// <param name="typeId">Type ID.</param>
         /// <param name="typeName">Type name.</param>
         /// <param name="affKeyFieldName">Affinity key field name.</param>
-        public BinaryTypeHolder(int typeId, string typeName, string affKeyFieldName)
+        public BinaryTypeHolder(int typeId, string typeName, string affKeyFieldName, bool isEnum)
         {
             _typeId = typeId;
             _typeName = typeName;
             _affKeyFieldName = affKeyFieldName;
-
-            _emptyMeta = new BinaryType(typeId, typeName, null, affKeyFieldName);
+            _isEnum = isEnum;
         }
 
         /// <summary>
@@ -72,21 +71,12 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         }
 
         /// <summary>
-        /// Get current type metadata.
-        /// </summary>
-        /// <value>Type metadata.</value>
-        public IBinaryType BinaryType
-        {
-            get { return _meta ?? _emptyMeta; }
-        }
-
-        /// <summary>
         /// Currently cached field IDs.
         /// </summary>
         /// <returns>Cached field IDs.</returns>
-        public ICollection<int> FieldIds()
+        public ICollection<int> GetFieldIds()
         {
-            ICollection<int> ids0 = _ids;
+            var ids0 = _ids;
 
             if (_ids == null)
             {
@@ -120,13 +110,13 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
             lock (this)
             {
                 // 1. Create copies of the old meta.
-                ICollection<int> ids0 = _ids;
+                var ids0 = _ids;
                 BinaryType meta0 = _meta;
 
-                ICollection<int> newIds = ids0 != null ? new HashSet<int>(ids0) : new HashSet<int>();
+                var newIds = ids0 != null ? new HashSet<int>(ids0) : new HashSet<int>();
 
                 IDictionary<string, int> newFields = meta0 != null ?
-                    new Dictionary<string, int>(meta0.FieldsMap()) : new Dictionary<string, int>(newMap.Count);
+                    new Dictionary<string, int>(meta0.GetFieldsMap()) : new Dictionary<string, int>(newMap.Count);
 
                 // 2. Add new fields.
                 foreach (KeyValuePair<int, Tuple<string, int>> newEntry in newMap)
@@ -139,7 +129,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
                 }
 
                 // 3. Assign new meta. Order is important here: meta must be assigned before field IDs.
-                _meta = new BinaryType(_typeId, _typeName, newFields, _affKeyFieldName);
+                _meta = new BinaryType(_typeId, _typeName, newFields, _affKeyFieldName, _isEnum);
                 _ids = newIds;
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
index 37d980e..af1b050 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
@@ -111,7 +111,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
                     var meta = metaHnd.OnObjectWriteFinished();
 
                     if (meta != null)
-                        writer.SaveMetadata(_desc.TypeId, _desc.TypeName, _desc.AffinityKeyFieldName, meta);
+                        writer.SaveMetadata(_desc, meta);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index ded671a..2fcada3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -31,6 +31,7 @@ namespace Apache.Ignite.Core.Impl
     using Apache.Ignite.Core.DataStructures;
     using Apache.Ignite.Core.Events;
     using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.Metadata;
     using Apache.Ignite.Core.Impl.Cache;
     using Apache.Ignite.Core.Impl.Cluster;
     using Apache.Ignite.Core.Impl.Common;
@@ -66,7 +67,7 @@ namespace Apache.Ignite.Core.Impl
         private readonly ClusterGroupImpl _prj;
 
         /** Binary. */
-        private readonly IgniteBinary _igniteBinary;
+        private readonly Binary.Binary _binary;
 
         /** Cached proxy. */
         private readonly IgniteProxy _proxy;
@@ -117,7 +118,7 @@ namespace Apache.Ignite.Core.Impl
 
             _prj = new ClusterGroupImpl(proc, UU.ProcessorProjection(proc), marsh, this, null);
 
-            _igniteBinary = new IgniteBinary(marsh);
+            _binary = new Binary.Binary(marsh);
 
             _proxy = new IgniteProxy(this);
 
@@ -394,9 +395,9 @@ namespace Apache.Ignite.Core.Impl
         }
 
         /** <inheritdoc /> */
-        public IIgniteBinary GetBinary()
+        public IBinary GetBinary()
         {
-            return _igniteBinary;
+            return _binary;
         }
 
         /** <inheritdoc /> */
@@ -472,7 +473,7 @@ namespace Apache.Ignite.Core.Impl
         /// Put metadata to Grid.
         /// </summary>
         /// <param name="metas">Metadata.</param>
-        internal void PutBinaryTypes(IDictionary<int, IBinaryType> metas)
+        internal void PutBinaryTypes(ICollection<BinaryType> metas)
         {
             _prj.PutBinaryTypes(metas);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
index 113f700..36aac1a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
@@ -275,7 +275,7 @@ namespace Apache.Ignite.Core.Impl
         }
 
         /** <inheritdoc /> */
-        public IIgniteBinary GetBinary()
+        public IBinary GetBinary()
         {
             return _ignite.GetBinary();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
index 115f30d..4a4f93b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@ -23,7 +23,6 @@ namespace Apache.Ignite.Core.Impl
     using System.Diagnostics.CodeAnalysis;
     using System.IO;
     using System.Threading.Tasks;
-    using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Binary;
     using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Binary.Metadata;
@@ -581,7 +580,7 @@ namespace Apache.Ignite.Core.Impl
         /// Put binary types to Grid.
         /// </summary>
         /// <param name="types">Binary types.</param>
-        internal void PutBinaryTypes(IDictionary<int, IBinaryType> types)
+        internal void PutBinaryTypes(ICollection<BinaryType> types)
         {
             DoOutOp(OpMeta, stream =>
             {
@@ -589,15 +588,15 @@ namespace Apache.Ignite.Core.Impl
 
                 metaWriter.WriteInt(types.Count);
 
-                foreach (var meta in types.Values)
+                foreach (var meta in types)
                 {
-                    BinaryType meta0 = (BinaryType)meta;
+                    BinaryType meta0 = meta;
 
                     metaWriter.WriteInt(meta0.TypeId);
                     metaWriter.WriteString(meta0.TypeName);
                     metaWriter.WriteString(meta0.AffinityKeyFieldName);
 
-                    IDictionary<string, int> fields = meta0.FieldsMap();
+                    IDictionary<string, int> fields = meta0.GetFieldsMap();
 
                     metaWriter.WriteInt(fields.Count);
 
@@ -606,6 +605,8 @@ namespace Apache.Ignite.Core.Impl
                         metaWriter.WriteString(field.Key);
                         metaWriter.WriteInt(field.Value);
                     }
+
+                    metaWriter.WriteBoolean(meta.IsEnum);
                 }
 
                 _marsh.FinishMarshal(metaWriter);

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
index a27bffe..0bc7172 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
@@ -67,8 +67,8 @@ namespace Apache.Ignite.Core.Impl.Transactions
             {
                 var reader = marsh.StartUnmarshal(stream).GetRawReader();
 
-                concurrency = reader.ReadEnum<TransactionConcurrency>();
-                isolation = reader.ReadEnum<TransactionIsolation>();
+                concurrency = (TransactionConcurrency) reader.ReadInt();
+                isolation = (TransactionIsolation) reader.ReadInt();
                 timeout = TimeSpan.FromMilliseconds(reader.ReadLong());
             });
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/examples/Config/example-cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Config/example-cache-query.xml b/modules/platforms/dotnet/examples/Config/example-cache-query.xml
index a3b854b..5bc9399 100644
--- a/modules/platforms/dotnet/examples/Config/example-cache-query.xml
+++ b/modules/platforms/dotnet/examples/Config/example-cache-query.xml
@@ -38,7 +38,14 @@
                                 <value>Apache.Ignite.ExamplesDll.Binary.Employee</value>
                                 <value>Apache.Ignite.ExamplesDll.Binary.EmployeeKey</value>
                                 <value>Apache.Ignite.ExamplesDll.Binary.Organization</value>
-                                <value>Apache.Ignite.ExamplesDll.Binary.OrganizationType</value>
+                            </list>
+                        </property>
+                        <property name="typesConfiguration">
+                            <list>
+                                <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryTypeConfiguration">
+                                    <property name="typeName" value="Apache.Ignite.ExamplesDll.Binary.OrganizationType" />
+                                    <property name="enum" value="true" />
+                                </bean>
                             </list>
                         </property>
                     </bean>

http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/examples/Config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Config/example-cache.xml b/modules/platforms/dotnet/examples/Config/example-cache.xml
index 21a6a76..949f3a4 100644
--- a/modules/platforms/dotnet/examples/Config/example-cache.xml
+++ b/modules/platforms/dotnet/examples/Config/example-cache.xml
@@ -37,7 +37,14 @@
                                 <value>Apache.Ignite.ExamplesDll.Binary.Employee</value>
                                 <value>Apache.Ignite.ExamplesDll.Binary.EmployeeKey</value>
                                 <value>Apache.Ignite.ExamplesDll.Binary.Organization</value>
-                                <value>Apache.Ignite.ExamplesDll.Binary.OrganizationType</value>
+                            </list>
+                        </property>
+                        <property name="typesConfiguration">
+                            <list>
+                                <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryTypeConfiguration">
+                                    <property name="typeName" value="Apache.Ignite.ExamplesDll.Binary.OrganizationType" />
+                                    <property name="enum" value="true" />
+                                </bean>
                             </list>
                         </property>
                     </bean>


[43/50] [abbrv] ignite git commit: Fixing binary objects tests.

Posted by ag...@apache.org.
Fixing binary objects tests.


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

Branch: refs/heads/ignite-1282
Commit: 292de51c75dfd696459ef6569ee49beb8e7b10ec
Parents: f3cb64e
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Nov 27 18:34:56 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Nov 27 18:34:56 2015 +0300

----------------------------------------------------------------------
 .../ignite/cache/CacheKeyConfiguration.java     |  19 ++
 .../internal/portable/BinaryObjectExImpl.java   |   5 +-
 .../portable/PortableClassDescriptor.java       |   3 +-
 .../processors/cache/CacheLazyEntry.java        |   2 +-
 .../processors/cache/GridCacheAdapter.java      |   2 +-
 .../processors/cache/GridCacheContext.java      |  12 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   4 +-
 .../distributed/near/GridNearGetFuture.java     |   4 +-
 .../GridCacheInternalKeyImpl.java               |   2 +-
 .../portable/BinaryMarshallerSelfTest.java      |  64 ++++++
 ...niteCacheCopyOnReadDisabledAbstractTest.java |   2 +
 .../dht/GridCacheDhtInternalEntrySelfTest.java  | 203 -------------------
 .../near/GridCacheNearTxForceKeyTest.java       |   2 +-
 ...achePartitionedPreloadLifecycleSelfTest.java |  71 ++++---
 .../testsuites/IgniteCacheTestSuite2.java       |   2 -
 15 files changed, 147 insertions(+), 250 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
index 767b44c..f117847 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
@@ -18,6 +18,8 @@
 package org.apache.ignite.cache;
 
 import java.io.Serializable;
+import java.lang.reflect.Field;
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
@@ -41,6 +43,23 @@ public class CacheKeyConfiguration implements Serializable {
     }
 
     /**
+     * @param keyCls Key class.
+     */
+    public CacheKeyConfiguration(Class keyCls) {
+        typeName = keyCls.getName();
+
+        for (; keyCls != Object.class && keyCls != null; keyCls = keyCls.getSuperclass()) {
+            for (Field f : keyCls.getDeclaredFields()) {
+                if (f.getAnnotation(AffinityKeyMapped.class) != null) {
+                    affKeyFieldName = f.getName();
+
+                    return;
+                }
+            }
+        }
+    }
+
+    /**
      * Creates cache key configuration with given type name and affinity field name.
      *
      * @param typeName Type name.

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
index 2ea71ec..a32329a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
@@ -164,6 +164,7 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
      */
     private String toString(BinaryReaderHandles ctx, IdentityHashMap<BinaryObject, Integer> handles) {
         int idHash = System.identityHashCode(this);
+        int hash = hashCode();
 
         BinaryType meta;
 
@@ -175,14 +176,14 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
         }
 
         if (meta == null)
-            return BinaryObject.class.getSimpleName() +  " [hash=" + idHash + ", typeId=" + typeId() + ']';
+            return BinaryObject.class.getSimpleName() +  " [idHash=" + idHash + ", hash=" + hash + ", typeId=" + typeId() + ']';
 
         handles.put(this, idHash);
 
         SB buf = new SB(meta.typeName());
 
         if (meta.fieldNames() != null) {
-            buf.a(" [hash=").a(idHash);
+            buf.a(" [idHash=").a(idHash).a(", hash=").a(hash);
 
             for (String name : meta.fieldNames()) {
                 Object val = field(ctx, name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/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 dba15f5..984f7c9 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
@@ -249,7 +249,8 @@ public class PortableClassDescriptor {
                             String name = f.getName();
 
                             if (!names.add(name))
-                                throw new BinaryObjectException("Duplicate field name: " + name);
+                                throw new BinaryObjectException("Duplicate field name [fieldName=" + name +
+                                    ", cls=" + cls.getName() + ']');
 
                             int fieldId = idMapper.fieldId(typeId, name);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
index 47ad30c..2b9efa3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
@@ -103,7 +103,7 @@ public class CacheLazyEntry<K, V> implements Cache.Entry<K, V> {
     /** {@inheritDoc} */
     @Override public V getValue() {
         if (val == null)
-            val = (V)cctx.unwrapPortableIfNeeded(valObj, keepPortable);
+            val = (V)cctx.unwrapPortableIfNeeded(valObj, keepPortable, false);
 
         return val;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 00f65f9..b5b8690 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -799,7 +799,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             else
                 cacheVal = localCachePeek0(cacheKey, modes.heap, modes.offheap, modes.swap, plc);
 
-            Object val = ctx.unwrapPortableIfNeeded(cacheVal, ctx.keepPortable());
+            Object val = ctx.unwrapPortableIfNeeded(cacheVal, ctx.keepPortable(), false);
 
             return (V)val;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 73d966a..6e5f958 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1743,12 +1743,22 @@ public class GridCacheContext<K, V> implements Externalizable {
      * @param keepPortable Keep portable flag.
      * @return Unwrapped object.
      */
-    @SuppressWarnings("IfMayBeConditional")
     public Object unwrapPortableIfNeeded(Object o, boolean keepPortable) {
         return cacheObjCtx.unwrapPortableIfNeeded(o, keepPortable);
     }
 
     /**
+     * Unwraps object for binary.
+     *
+     * @param o Object to unwrap.
+     * @param keepPortable Keep portable flag.
+     * @return Unwrapped object.
+     */
+    public Object unwrapPortableIfNeeded(Object o, boolean keepPortable, boolean cpy) {
+        return cacheObjCtx.unwrapPortableIfNeeded(o, keepPortable, cpy);
+    }
+
+    /**
      * @return Cache object context.
      */
     public CacheObjectContext cacheObjectContext() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 028f477..8fe1b3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -781,7 +781,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
                         if (invokeRes.result() != null)
                             res = CacheInvokeResult.fromResult((T)ctx.unwrapPortableIfNeeded(invokeRes.result(),
-                                keepBinary));
+                                keepBinary, false));
                     }
 
                     return res;
@@ -834,7 +834,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
                                 if (invokeRes.result() != null)
                                     res = CacheInvokeResult.fromResult((T)ctx.unwrapPortableIfNeeded(invokeRes.result(),
-                                        keepBinary));
+                                        keepBinary, false));
                             }
 
                             return res;

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index 2ea31d5..3f61b2f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -542,9 +542,9 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
                             add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0)));
                         }
                         else {
-                            K key0 = (K)cctx.unwrapPortableIfNeeded(key, !deserializePortable);
+                            K key0 = (K)cctx.unwrapPortableIfNeeded(key, !deserializePortable, false);
                             V val0 = !skipVals ? 
-                                (V)cctx.unwrapPortableIfNeeded(v, !deserializePortable) : 
+                                (V)cctx.unwrapPortableIfNeeded(v, !deserializePortable, false) :
                                 (V)Boolean.TRUE;
 
                             add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0)));

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
index ff07754..6031f5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
@@ -34,6 +34,7 @@ public class GridCacheInternalKeyImpl implements GridCacheInternalKey, Externali
     private static final long serialVersionUID = 0L;
 
     /** Name of cache data structure. */
+    @AffinityKeyMapped
     private String name;
 
     /**
@@ -55,7 +56,6 @@ public class GridCacheInternalKeyImpl implements GridCacheInternalKey, Externali
     }
 
     /** {@inheritDoc} */
-    @AffinityKeyMapped
     @Override public String name() {
         return name;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index 9f7822c..ad0dcf2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -17,6 +17,10 @@
 
 package org.apache.ignite.internal.portable;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import junit.framework.Assert;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.binary.BinaryIdMapper;
@@ -364,6 +368,23 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
+    public void testExternalizableHashCode() throws Exception {
+        SimpleExternalizable sim1 = new SimpleExternalizable("Simple");
+        SimpleExternalizable sim2 = new SimpleExternalizable("Simple");
+
+        BinaryMarshaller marsh = binaryMarshaller();
+
+        BinaryObjectImpl sim1Binary = marshal(sim1, marsh);
+        BinaryObjectImpl sim2Binary = marshal(sim2, marsh);
+
+        assertEquals(sim1.hashCode(), sim2.hashCode());
+        assertEquals(sim1.hashCode(), sim1Binary.hashCode());
+        assertEquals(sim2.hashCode(), sim2Binary.hashCode());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testMapEntry() throws Exception {
         Map.Entry<Integer, String> e = new GridMapEntry<>(1, "str1");
 
@@ -3621,6 +3642,49 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
     /**
      *
      */
+    public static class SimpleExternalizable implements Externalizable {
+        /** */
+        private String field;
+
+        /**
+         * @param field Field.
+         */
+        public SimpleExternalizable(String field) {
+            this.field = field;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            U.writeString(out, field);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            field = U.readString(in);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            SimpleExternalizable that = (SimpleExternalizable)o;
+
+            return field.equals(that.field);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return field.hashCode();
+        }
+    }
+
+    /**
+     *
+     */
     private static class ParentPortable {
         /** */
         public String s;

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
index 1c08c0e..a3b362b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
@@ -57,6 +57,8 @@ public abstract class IgniteCacheCopyOnReadDisabledAbstractTest extends GridCach
 
             TestValue val0 = cache.get(key);
 
+            assertSame(val0, cache.get(key));
+
             assertNotSame(val, val0); // Original user value is always copied.
 
             assertSame(val0, cache.localPeek(key));

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java
deleted file mode 100644
index 0f4fe5d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAlwaysEvictionPolicy;
-import org.apache.ignite.internal.processors.datastructures.GridCacheInternalKeyImpl;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
-
-/**
- * Tests for internal DHT entry.
- */
-public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** Grid count. */
-    private static final int GRID_CNT = 2;
-
-    /** Atomic long name. */
-    private static final String ATOMIC_LONG_NAME = "test.atomic.long";
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi spi = new TcpDiscoverySpi();
-
-        spi.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(spi);
-
-        CacheConfiguration cacheCfg = defaultCacheConfiguration();
-
-        cacheCfg.setCacheMode(PARTITIONED);
-        cacheCfg.setRebalanceMode(SYNC);
-        cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 2));
-        cacheCfg.setBackups(0);
-        cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-
-        NearCacheConfiguration nearCfg = new NearCacheConfiguration();
-        nearCfg.setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy());
-        cacheCfg.setNearConfiguration(nearCfg);
-
-        cacheCfg.setAtomicityMode(TRANSACTIONAL);
-
-        cfg.setCacheConfiguration(cacheCfg);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGridsMultiThreaded(GRID_CNT);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** @throws Exception If failed. */
-    public void testInternalKeyReaders() throws Exception {
-        IgniteBiTuple<ClusterNode, ClusterNode> nodes = getNodes(ATOMIC_LONG_NAME);
-
-        ClusterNode primary = nodes.get1();
-        ClusterNode other = nodes.get2();
-
-        // Create on non-primary node.
-        grid(other).cache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 1);
-
-        check(primary, other, true);
-
-        // Update on primary.
-        grid(primary).cache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 2);
-
-        // Check on non-primary.
-        assertEquals(2, grid(other).cache(null).get(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME)));
-
-        check(primary, other, true);
-
-        // Remove.
-        assert grid(other).cache(null).remove(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME));
-
-        check(primary, other, false);
-    }
-
-    /**
-     * @param primary Primary node.
-     * @param other Non-primary node.
-     * @param exists Whether entry is expected to exist.
-     * @throws Exception In case of error.
-     */
-    private void check(ClusterNode primary, ClusterNode other, boolean exists) throws Exception {
-        if (exists) {
-            // Check primary node has entry in DHT cache.
-            assert peekNear(primary) == null;
-            assert peekDht(primary) != null;
-
-            // Check non-primary node has entry in near cache.
-            assert peekNear(other) != null;
-            assert peekDht(other) == null;
-
-            // Check primary node has reader for non-primary node.
-            assert peekDhtEntry(primary).readers().contains(other.id());
-        }
-        else {
-            assert peekGlobal(primary) == null;
-            assert peekGlobal(other) == null;
-        }
-    }
-
-    /**
-     * @param node Node.
-     * @return Atomic long value.
-     */
-    private Object peekGlobal(ClusterNode node) {
-        return grid(node).cache(null).localPeek(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), CachePeekMode.ONHEAP);
-    }
-
-    /**
-     * @param node Node.
-     * @return Atomic long value.
-     */
-    private Object peekNear(ClusterNode node) {
-        return grid(node).cache(null).localPeek(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), CachePeekMode.NEAR);
-    }
-
-    /**
-     * @param node Node.
-     * @return Atomic long value.
-     */
-    private Object peekDht(ClusterNode node) {
-        return grid(node).cache(null).localPeek(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), CachePeekMode.BACKUP,
-            CachePeekMode.PRIMARY);
-    }
-
-    /**
-     * @param node Node.
-     * @return DHT entry.
-     */
-    private GridDhtCacheEntry peekDhtEntry(ClusterNode node) {
-        return (GridDhtCacheEntry)dht(grid(node).cache(null)).peekEx(
-            new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME));
-    }
-
-    /**
-     * @param key Key.
-     * @return Pair {primary node, some other node}.
-     */
-    private IgniteBiTuple<ClusterNode, ClusterNode> getNodes(String key) {
-        Affinity<Object> aff = grid(0).affinity(null);
-
-        ClusterNode primary = aff.mapKeyToNode(key);
-
-        assert primary != null;
-
-        Collection<ClusterNode> nodes = new ArrayList<>(grid(0).cluster().nodes());
-
-        nodes.remove(primary);
-
-        ClusterNode other = F.first(nodes);
-
-        assert other != null;
-
-        assert !F.eqNodes(primary, other);
-
-        return F.t(primary, other);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
index 348597e..84886d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
@@ -70,7 +70,7 @@ public class GridCacheNearTxForceKeyTest extends GridCommonAbstractTest {
 
         Ignite ignite1 = startGrid(1);
 
-        final Integer key = 2;
+        final Integer key = primaryKey(ignite1.cache(null));
 
         assertNull(cache.getAndPut(key, key));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
index ca4f24e..e434b49 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
@@ -182,39 +182,7 @@ public class GridCachePartitionedPreloadLifecycleSelfTest extends GridCachePrelo
 
                 CacheQuery<Map.Entry<Object, MyValue>> qry = c2.context().queries().createScanQuery(null, null, false);
 
-                int totalCnt = F.sumInt(qry.execute(new IgniteReducer<Map.Entry<Object, MyValue>, Integer>() {
-                    @IgniteInstanceResource
-                    private Ignite grid;
-
-                    private int cnt;
-
-                    @Override public boolean collect(Map.Entry<Object, MyValue> e) {
-                        Object key = e.getKey();
-
-                        assertNotNull(e.getValue());
-
-                        try {
-                            Object v1 = e.getValue();
-                            Object v2 = grid.cache("one").get(key);
-
-                            assertNotNull(v2);
-                            assertEquals(v1, v2);
-                        }
-                        catch (CacheException e1) {
-                            e1.printStackTrace();
-
-                            assert false;
-                        }
-
-                        cnt++;
-
-                        return true;
-                    }
-
-                    @Override public Integer reduce() {
-                        return cnt;
-                    }
-                }).get());
+                int totalCnt = F.sumInt(qry.execute(new EntryIntegerIgniteReducer()).get());
 
                 info("Total entry count [grid=" + j + ", totalCnt=" + totalCnt + ']');
 
@@ -278,4 +246,41 @@ public class GridCachePartitionedPreloadLifecycleSelfTest extends GridCachePrelo
     public void testScanQuery4() throws Exception {
         checkScanQuery(keys(false, 500));
     }
+
+    /**
+     *
+     */
+    private static class EntryIntegerIgniteReducer implements IgniteReducer<Map.Entry<Object, MyValue>, Integer> {
+        @IgniteInstanceResource
+        private Ignite grid;
+
+        private int cnt;
+
+        @Override public boolean collect(Map.Entry<Object, MyValue> e) {
+            Object key = e.getKey();
+
+            assertNotNull(e.getValue());
+
+            try {
+                Object v1 = e.getValue();
+                Object v2 = grid.cache("one").get(key);
+
+                assertNotNull(v2);
+                assertEquals(v1, v2);
+            }
+            catch (CacheException e1) {
+                e1.printStackTrace();
+
+                assert false;
+            }
+
+            cnt++;
+
+            return true;
+        }
+
+        @Override public Integer reduce() {
+            return cnt;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index 5138dac..74b688f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -53,7 +53,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtE
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtEvictionSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtEvictionsDisabledSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtExpiredEntriesPreloadSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtInternalEntrySelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtMappingSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtPreloadBigDataSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtPreloadDelayedSelfTest;
@@ -188,7 +187,6 @@ public class IgniteCacheTestSuite2 extends TestSuite {
         suite.addTest(new TestSuite(GridCachePartitionedTxTimeoutSelfTest.class));
         suite.addTest(new TestSuite(GridCacheFinishPartitionsSelfTest.class));
         suite.addTest(new TestSuite(GridCacheDhtEntrySelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtInternalEntrySelfTest.class));
         suite.addTest(new TestSuite(GridCacheDhtMappingSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedTxMultiThreadedSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedNearDisabledTxMultiThreadedSelfTest.class));


[42/50] [abbrv] ignite git commit: ignite-2020 GridProjectionLocalJobMultipleArgumentsSelfTest fixed

Posted by ag...@apache.org.
ignite-2020 GridProjectionLocalJobMultipleArgumentsSelfTest fixed


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

Branch: refs/heads/ignite-1282
Commit: f3cb64e375ff97a35b25ec0687b7d599f212afbd
Parents: 6312737
Author: agura <ag...@gridgain.com>
Authored: Fri Nov 27 17:26:20 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Nov 27 17:39:46 2015 +0300

----------------------------------------------------------------------
 .../GridProjectionLocalJobMultipleArgumentsSelfTest.java | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f3cb64e3/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
index 58ff1fb..356e002 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
@@ -43,7 +43,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** */
-    private static Collection<Integer> ids;
+    private static Collection<Object> ids;
 
     /** */
     private static AtomicInteger res;
@@ -90,7 +90,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
         for (int i : F.asList(1, 2, 3)) {
             res.add(grid().compute().affinityCall(null, i, new IgniteCallable<Integer>() {
                 @Override public Integer call() {
-                    ids.add(System.identityHashCode(this));
+                    ids.add(this);
 
                     return 10;
                 }
@@ -108,7 +108,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
         for (int i : F.asList(1, 2, 3)) {
             grid().compute().affinityRun(null, i, new IgniteRunnable() {
                 @Override public void run() {
-                    ids.add(System.identityHashCode(this));
+                    ids.add(this);
 
                     res.addAndGet(10);
                 }
@@ -125,8 +125,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
     public void testCall() throws Exception {
         Collection<Integer> res = grid().compute().apply(new C1<Integer, Integer>() {
             @Override public Integer apply(Integer arg) {
-
-                ids.add(System.identityHashCode(this));
+                ids.add(this);
 
                 return 10 + arg;
             }
@@ -144,7 +143,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
 
         Collection<Integer> res = grid().compute().apply(new C1<Integer, Integer>() {
             @Override public Integer apply(Integer arg) {
-                ids.add(System.identityHashCode(this));
+                ids.add(this);
 
                 return 10 + arg;
             }


[02/50] [abbrv] ignite git commit: debugging slowdowns

Posted by ag...@apache.org.
debugging slowdowns


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

Branch: refs/heads/ignite-1282
Commit: 5407ea692ce1a74604f9314e70c6888c384e8ae9
Parents: 1eaa8c9
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Nov 26 16:16:52 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Nov 26 16:16:52 2015 +0300

----------------------------------------------------------------------
 .../cache/distributed/dht/GridPartitionedSingleGetFuture.java   | 5 +----
 .../processors/cache/distributed/near/GridNearGetRequest.java   | 3 ++-
 2 files changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5407ea69/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index f6b99d1..99cf210 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed.dht;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -275,9 +274,7 @@ public class GridPartitionedSingleGetFuture extends GridFutureAdapter<Object> im
                     cctx.deploymentEnabled());
             }
             else {
-                LinkedHashMap<KeyCacheObject, Boolean> map = U.newLinkedHashMap(1);
-
-                map.put(key, false);
+                Map<KeyCacheObject, Boolean> map = Collections.singletonMap(key, false);
 
                 req = new GridNearGetRequest(
                     cctx.cacheId(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/5407ea69/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 6d60298..0c2451e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.UUID;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.GridDirectCollection;
@@ -122,7 +123,7 @@ public class GridNearGetRequest extends GridCacheMessage implements GridCacheDep
         IgniteUuid futId,
         IgniteUuid miniId,
         GridCacheVersion ver,
-        LinkedHashMap<KeyCacheObject, Boolean> keys,
+        Map<KeyCacheObject, Boolean> keys,
         boolean readThrough,
         @NotNull AffinityTopologyVersion topVer,
         UUID subjId,