You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/02/18 14:29:55 UTC

[01/13] ignite git commit: ignite-2669 Changed BinaryUtils.isBinaryType to always convert enums to BinaryObject

Repository: ignite
Updated Branches:
  refs/heads/ignite-1786 7229e511b -> aa373596a


ignite-2669 Changed BinaryUtils.isBinaryType to always convert enums to BinaryObject


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

Branch: refs/heads/ignite-1786
Commit: 8be62f0281bfe1af27d1e47b1125461644e3c898
Parents: 8562b00
Author: sboikov <sb...@gridgain.com>
Authored: Wed Feb 17 14:57:27 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Feb 17 14:57:27 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryUtils.java     |   5 +-
 .../cache/CacheEntryPredicateContainsValue.java |   8 +-
 .../binary/CacheObjectBinaryProcessorImpl.java  |  10 +-
 .../cache/CacheEnumOperationsAbstractTest.java  | 307 +++++++++++++++++++
 .../CacheEnumOperationsSingleNodeTest.java      |  28 ++
 .../cache/CacheEnumOperationsTest.java          |  28 ++
 .../testsuites/IgniteCacheTestSuite2.java       |   4 +
 7 files changed, 379 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8be62f02/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index 8b5d780..1b53ffd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -584,10 +584,7 @@ public class BinaryUtils {
     public static boolean isBinaryType(Class<?> cls) {
         assert cls != null;
 
-        return BinaryObject.class.isAssignableFrom(cls) ||
-            BINARY_CLS.contains(cls) ||
-            cls.isEnum() ||
-            (cls.isArray() && cls.getComponentType().isEnum());
+        return BinaryObject.class.isAssignableFrom(cls) || BINARY_CLS.contains(cls);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8be62f02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
index e89fff4..3db8ae8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
@@ -58,8 +58,12 @@ public class CacheEntryPredicateContainsValue extends CacheEntryPredicateAdapter
     @Override public boolean apply(GridCacheEntryEx e) {
         CacheObject val = peekVisibleValue(e);
 
-        return F.eq(this.val.value(e.context().cacheObjectContext(), false),
-            CU.value(val, e.context(), false));
+        GridCacheContext cctx = e.context();
+
+        Object thisVal = CU.value(this.val, cctx, false);
+        Object cacheVal = CU.value(val, cctx, false);
+
+        return F.eq(thisVal, cacheVal);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8be62f02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 5a72a40..e0da8d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -514,7 +514,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
         Object obj0 = binaryMarsh.unmarshal(arr, null);
 
         // Possible if a class has writeObject method.
-        if (obj0 instanceof BinaryObject)
+        if (obj0 instanceof BinaryObjectImpl)
             ((BinaryObjectImpl)obj0).detachAllowed(true);
 
         return obj0;
@@ -782,8 +782,8 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
         if (((CacheObjectBinaryContext)ctx).binaryEnabled()) {
             obj = toBinary(obj);
 
-            if (obj instanceof BinaryObject)
-                return (BinaryObjectImpl)obj;
+            if (obj instanceof KeyCacheObject)
+                return (KeyCacheObject)obj;
         }
 
         return toCacheKeyObject0(obj, userObj);
@@ -800,8 +800,8 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
 
         obj = toBinary(obj);
 
-        if (obj instanceof BinaryObject)
-            return (BinaryObjectImpl)obj;
+        if (obj instanceof CacheObject)
+            return (CacheObject)obj;
 
         return toCacheObject0(obj, userObj);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8be62f02/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
new file mode 100644
index 0000000..3957e46
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
@@ -0,0 +1,307 @@
+/*
+ * 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 javax.cache.processor.EntryProcessor;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+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.CacheAtomicWriteOrderMode.PRIMARY;
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_TIERED;
+import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_VALUES;
+import static org.apache.ignite.cache.CacheMemoryMode.ONHEAP_TIERED;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public abstract class CacheEnumOperationsAbstractTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private boolean client;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+        cfg.setClientMode(client);
+
+        return cfg;
+    }
+
+    /**
+     * @return Number of nodes.
+     */
+    protected abstract boolean singleNode();
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        if (!singleNode()) {
+            startGridsMultiThreaded(4);
+
+            client = true;
+
+            startGridsMultiThreaded(4, 2);
+        }
+        else
+            startGrid(0);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+
+        super.afterTestsStopped();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAtomic() throws Exception {
+        CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED, 1, ATOMIC, ONHEAP_TIERED);
+
+        enumOperations(ccfg);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAtomicOffheapValues() throws Exception {
+        CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED, 1, ATOMIC, OFFHEAP_VALUES);
+
+        enumOperations(ccfg);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAtomicOffheapTiered() throws Exception {
+        CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED, 1, ATOMIC, OFFHEAP_TIERED);
+
+        enumOperations(ccfg);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTx() throws Exception {
+        CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED, 1, ATOMIC, ONHEAP_TIERED);
+
+        enumOperations(ccfg);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTxOffheapValues() throws Exception {
+        CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED, 1, ATOMIC, OFFHEAP_VALUES);
+
+        enumOperations(ccfg);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTxOffheapTiered() throws Exception {
+        CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED, 1, ATOMIC, OFFHEAP_TIERED);
+
+        enumOperations(ccfg);
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     */
+    private void enumOperations(CacheConfiguration<Object, Object> ccfg) {
+        ignite(0).createCache(ccfg);
+
+        try {
+            int key = 0;
+
+            int nodes;
+
+            if (!singleNode()) {
+                nodes = 6;
+
+                ignite(nodes - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
+            }
+            else
+                nodes = 1;
+
+            for (int i = 0; i < nodes; i++) {
+                IgniteCache<Object, Object> cache = ignite(i).cache(ccfg.getName());
+
+                for (int j = 0; j < 100; j++)
+                    enumOperations(cache, key++);
+            }
+        }
+        finally {
+            ignite(0).destroyCache(ccfg.getName());
+        }
+    }
+
+    /**
+     * @param cache Cache.
+     * @param key Key.
+     */
+    private void enumOperations(IgniteCache<Object, Object> cache, int key) {
+        assertNull(cache.get(key));
+
+        assertFalse(cache.replace(key, TestEnum.VAL1));
+
+        assertTrue(cache.putIfAbsent(key, TestEnum.VAL1));
+
+        assertEquals(TestEnum.VAL1, cache.get(key));
+
+        assertFalse(cache.putIfAbsent(key, TestEnum.VAL2));
+
+        assertEquals(TestEnum.VAL1, cache.get(key));
+
+        assertTrue(cache.replace(key, TestEnum.VAL2));
+
+        assertEquals(TestEnum.VAL2, cache.get(key));
+
+        assertFalse(cache.replace(key, TestEnum.VAL1, TestEnum.VAL3));
+
+        assertEquals(TestEnum.VAL2, cache.get(key));
+
+        assertTrue(cache.replace(key, TestEnum.VAL2, TestEnum.VAL3));
+
+        assertEquals(TestEnum.VAL3, cache.get(key));
+
+        assertEquals(TestEnum.VAL3, cache.getAndPut(key, TestEnum.VAL1));
+
+        assertEquals(TestEnum.VAL1, cache.get(key));
+
+        assertEquals(TestEnum.VAL1, cache.invoke(key, new EnumProcessor(TestEnum.VAL2, TestEnum.VAL1)));
+
+        assertEquals(TestEnum.VAL2, cache.get(key));
+
+        assertEquals(TestEnum.VAL2, cache.getAndReplace(key, TestEnum.VAL3));
+
+        assertEquals(TestEnum.VAL3, cache.get(key));
+
+        assertEquals(TestEnum.VAL3, cache.getAndPutIfAbsent(key, TestEnum.VAL1));
+
+        assertEquals(TestEnum.VAL3, cache.get(key));
+
+        cache.put(key, TestEnum.VAL1);
+
+        assertEquals(TestEnum.VAL1, cache.get(key));
+
+        assertEquals(TestEnum.VAL1, cache.getAndRemove(key));
+
+        assertNull(cache.get(key));
+
+        assertFalse(cache.replace(key, TestEnum.VAL2, TestEnum.VAL3));
+
+        assertNull(cache.getAndPutIfAbsent(key, TestEnum.VAL1));
+
+        assertEquals(TestEnum.VAL1, cache.get(key));
+    }
+
+    /**
+     *
+     * @param cacheMode Cache mode.
+     * @param backups Number of backups.
+     * @param atomicityMode Cache atomicity mode.
+     * @param memoryMode Cache memory mode.
+     * @return Cache configuration.
+     */
+    private CacheConfiguration<Object, Object> cacheConfiguration(
+        CacheMode cacheMode,
+        int backups,
+        CacheAtomicityMode atomicityMode,
+        CacheMemoryMode memoryMode) {
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+
+        ccfg.setAtomicityMode(atomicityMode);
+        ccfg.setCacheMode(cacheMode);
+        ccfg.setMemoryMode(memoryMode);
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+        ccfg.setAtomicWriteOrderMode(PRIMARY);
+
+        if (memoryMode == OFFHEAP_TIERED)
+            ccfg.setOffHeapMaxMemory(0);
+
+        if (cacheMode == PARTITIONED)
+            ccfg.setBackups(backups);
+
+        return ccfg;
+    }
+
+    /**
+     *
+     */
+    public enum TestEnum {
+        /** */
+        VAL1,
+        /** */
+        VAL2,
+        /** */
+        VAL3
+    }
+
+    /**
+     *
+     */
+    static class EnumProcessor implements EntryProcessor<Object, Object, Object> {
+        /** */
+        private TestEnum newVal;
+
+        /** */
+        private TestEnum expOldVal;
+
+        /**
+         * @param newVal New value.
+         * @param expOldVal Expected old value.
+         */
+        public EnumProcessor(TestEnum newVal, TestEnum expOldVal) {
+            this.newVal = newVal;
+            this.expOldVal = expOldVal;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object process(MutableEntry<Object, Object> entry, Object... args) {
+            TestEnum val = (TestEnum)entry.getValue();
+
+            assertEquals(expOldVal, val);
+
+            entry.setValue(newVal);
+
+            return val;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8be62f02/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsSingleNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsSingleNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsSingleNodeTest.java
new file mode 100644
index 0000000..baaaac3
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsSingleNodeTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ *
+ */
+public class CacheEnumOperationsSingleNodeTest extends CacheEnumOperationsAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected boolean singleNode() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8be62f02/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsTest.java
new file mode 100644
index 0000000..8e4964f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ *
+ */
+public class CacheEnumOperationsTest extends CacheEnumOperationsAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected boolean singleNode() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8be62f02/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 d83b272..3e8d66a 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
@@ -24,6 +24,8 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionBac
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionExcludeNeighborsSelfTest;
 import org.apache.ignite.internal.processors.cache.CacheConfigurationLeakTest;
 import org.apache.ignite.internal.processors.cache.CacheDhtLocalPartitionAfterRemoveSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheEnumOperationsSingleNodeTest;
+import org.apache.ignite.internal.processors.cache.CacheEnumOperationsTest;
 import org.apache.ignite.internal.processors.cache.CrossCacheTxRandomOperationsTest;
 import org.apache.ignite.internal.processors.cache.GridCacheAtomicMessageCountSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheFinishPartitionsSelfTest;
@@ -250,6 +252,8 @@ public class IgniteCacheTestSuite2 extends TestSuite {
         suite.addTest(new TestSuite(CacheLockReleaseNodeLeaveTest.class));
         suite.addTest(new TestSuite(NearCacheSyncUpdateTest.class));
         suite.addTest(new TestSuite(CacheConfigurationLeakTest.class));
+        suite.addTest(new TestSuite(CacheEnumOperationsSingleNodeTest.class));
+        suite.addTest(new TestSuite(CacheEnumOperationsTest.class));
 
         return suite;
     }


[10/13] ignite git commit: ignite-2669 Register BinaryEnumObjectImpl as predefined type.

Posted by vo...@apache.org.
ignite-2669 Register BinaryEnumObjectImpl as predefined type.


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

Branch: refs/heads/ignite-1786
Commit: 21f22d3db84a731de54db9530a04244321766c57
Parents: 7d5f77e
Author: sboikov <sb...@gridgain.com>
Authored: Thu Feb 18 08:06:32 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Feb 18 08:06:32 2016 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/internal/binary/BinaryContext.java  | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/21f22d3d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index cf19bdf..4df9ba2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -218,6 +218,7 @@ public class BinaryContext {
         registerPredefinedType(BinaryObjectOffheapImpl.class, 0);
         registerPredefinedType(BinaryMetadataKey.class, 0);
         registerPredefinedType(BinaryMetadata.class, 0);
+        registerPredefinedType(BinaryEnumObjectImpl.class, 0);
 
         // IDs range [200..1000] is used by Ignite internal APIs.
     }


[08/13] ignite git commit: Test investigation fix.

Posted by vo...@apache.org.
Test investigation fix.


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

Branch: refs/heads/ignite-1786
Commit: 2ad4b5cfc7d8f5d3fcf7f0233129078237129beb
Parents: d2e6535
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Feb 17 19:08:06 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Feb 17 19:08:06 2016 +0300

----------------------------------------------------------------------
 .../cache/distributed/dht/preloader/GridDhtPartitionDemander.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad4b5cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index 9634b0b..1354d96 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -975,7 +975,8 @@ public class GridDhtPartitionDemander {
                 if (parts != null) {
                     boolean rmvd = parts.remove(p);
 
-                    assert rmvd;
+                    assert rmvd : "Partition already done [cache=" + cctx.name() + ", fromNode=" + nodeId +
+                        ", part=" + p + ", left=" + parts + "]";
 
                     if (parts.isEmpty()) {
                         U.log(log, "Completed " + ((remaining.size() == 1 ? "(final) " : "") +


[11/13] ignite git commit: IGNITE-2647: Cache is undeployed even when BinaryMarshaller is used. Fixed.

Posted by vo...@apache.org.
IGNITE-2647: Cache is undeployed even when BinaryMarshaller is used. Fixed.


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

Branch: refs/heads/ignite-1786
Commit: 2bb449954666d838fb1296df18235b15dfe7975a
Parents: 21f22d3
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Feb 18 09:28:10 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Thu Feb 18 09:28:10 2016 +0300

----------------------------------------------------------------------
 .../cache/GridCacheDeploymentManager.java       |  8 +-
 .../processors/cache/GridCacheProcessor.java    |  4 +-
 .../cache/GridCacheDeploymentSelfTest.java      | 78 +++++++++++++++++++-
 3 files changed, 85 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2bb44995/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
index d7f7521..97d58dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
@@ -29,6 +29,7 @@ import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.binary.BinaryInvalidTypeException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.DeploymentMode;
 import org.apache.ignite.events.DiscoveryEvent;
@@ -342,6 +343,11 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
         catch (GridCacheEntryRemovedException ignore) {
             return false;
         }
+        catch (BinaryInvalidTypeException ignore) {
+            log.error("An attempt to undeploy cache with binary objects.", ignore);
+
+            return false;
+        }
         catch (IgniteCheckedException | IgniteException ignore) {
             // Peek can throw runtime exception if unmarshalling failed.
             return true;
@@ -1004,4 +1010,4 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
             return S.toString(CachedDeploymentInfo.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/2bb44995/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index db9298f..d485d41 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -3287,8 +3287,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     public void onUndeployed(ClassLoader ldr) {
         if (!ctx.isStopping()) {
             for (GridCacheAdapter<?, ?> cache : caches.values()) {
-                // Do not notify system caches.
-                if (cache.context().userCache())
+                // Do not notify system caches and caches for which deployment is disabled.
+                if (cache.context().userCache() && cache.context().deploymentEnabled())
                     cache.onUndeploy(ldr);
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2bb44995/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
index db6c882..c3c2d47 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
@@ -112,6 +112,16 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
         return cfg;
     }
 
+    /**
+     * Checks whether a cache should be undeployed in SHARED or CONTINUOUS modes.
+     *
+     * @param g Ignite node.
+     * @return {@code true} if the cache has to be undeployed, {@code false} otherwise.
+     */
+    protected boolean isCacheUndeployed(Ignite g) {
+        return !(g.configuration().getMarshaller() instanceof BinaryMarshaller);
+    }
+
     /** @throws Exception If failed. */
     @SuppressWarnings("unchecked")
     public void testDeployment() throws Exception {
@@ -210,8 +220,7 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
 
             assertEquals(0, g1.cache(null).localSize());
 
-            assertEquals(g2.configuration().getMarshaller() instanceof BinaryMarshaller ? 1 : 0,
-                g2.cache(null).localSize());
+            assertEquals(isCacheUndeployed(g1) ? 0 : 1, g2.cache(null).localSize());
 
             startGrid(3);
         }
@@ -423,6 +432,71 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testCacheUndeploymentSharedMode() throws Exception {
+        testCacheUndeployment(SHARED);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCacheUndeploymentContMode() throws Exception {
+        testCacheUndeployment(CONTINUOUS);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void testCacheUndeployment(DeploymentMode depMode) throws Exception {
+        ClassLoader ldr = getExternalClassLoader();
+
+        Class valCls = ldr.loadClass(TEST_VALUE_1);
+        Class taskCls = ldr.loadClass(TEST_TASK_2);
+
+        try {
+            this.depMode = depMode;
+
+            Ignite g0 = startGrid(0);
+            Ignite g1 = startGrid(1);
+
+            for (int i = 0; i < 20; i++)
+                g0.cache(null).put(i, valCls.newInstance());
+
+            assert g0.cache(null).localSize(CachePeekMode.ALL) > 0 : "Cache is empty";
+            assert g1.cache(null).localSize(CachePeekMode.ALL) > 0 : "Cache is empty";
+
+            g0.compute(g0.cluster().forRemotes()).execute(taskCls, g1.cluster().localNode());
+
+            stopGrid(0);
+
+            if (depMode == SHARED && isCacheUndeployed(g1)) {
+                for (int i = 0; i < 10; i++) {
+                    if (g1.cache(null).localSize(CachePeekMode.ALL) == 0)
+                        break;
+
+                    Thread.sleep(500);
+                }
+
+                assertEquals(0, g1.cache(null).localSize(CachePeekMode.ALL));
+            }
+            else {
+                for (int i = 0; i < 4; i++) {
+                    if (g1.cache(null).localSize(CachePeekMode.ALL) == 0)
+                        break;
+
+                    Thread.sleep(500);
+                }
+
+                assert g1.cache(null).localSize(CachePeekMode.ALL) > 0 : "Cache undeployed unexpectadly";
+            }
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
      * Looks for next key starting from {@code start} for which primary node is {@code primary} and backup is {@code
      * backup}.
      *


[12/13] ignite git commit: ignite-2590 Unmarshal offheap entry value when key is enlisted in tx for single 'remove'.

Posted by vo...@apache.org.
ignite-2590 Unmarshal offheap entry value when key is enlisted in tx for single 'remove'.


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

Branch: refs/heads/ignite-1786
Commit: 9b5dcfe3feba6e3b8d39480b7387bbe6adf04c36
Parents: 2bb4499
Author: sboikov <sb...@gridgain.com>
Authored: Thu Feb 18 15:18:38 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Feb 18 15:18:38 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/transactions/IgniteTxLocalAdapter.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9b5dcfe3/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 a999358..f35e2e4 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
@@ -2542,7 +2542,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
                                 T2<CacheObject, GridCacheVersion> res = primaryLocal(entry) ?
                                     entry.innerGetVersioned(this,
                                         /*swap*/false,
-                                        /*unmarshal*/retval,
+                                        /*unmarshal*/retval || needVal,
                                         /*metrics*/retval,
                                         /*events*/retval,
                                         CU.subjectId(this, cctx),
@@ -2561,7 +2561,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
                                     /*swap*/false,
                                     /*read-through*/false,
                                     /*fail-fast*/false,
-                                    /*unmarshal*/retval,
+                                    /*unmarshal*/retval || needVal,
                                     /*metrics*/retval,
                                     /*events*/retval,
                                     /*temporary*/false,


[06/13] ignite git commit: IGNITE-2641: Now "SELECT [alias].*" is possible. This closes #486.

Posted by vo...@apache.org.
IGNITE-2641: Now "SELECT [alias].*" is possible. This closes #486.


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

Branch: refs/heads/ignite-1786
Commit: a2f66b986fdb1876c1aa0ece51d1d44b3934d262
Parents: 9cb175f
Author: dkarachentsev <dk...@gridgain.com>
Authored: Wed Feb 17 16:47:44 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 17 16:47:44 2016 +0300

----------------------------------------------------------------------
 .../processors/query/h2/IgniteH2Indexing.java   | 95 +++++++++++---------
 .../h2/GridIndexingSpiAbstractSelfTest.java     | 38 +++++++-
 2 files changed, 91 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a2f66b98/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 be72888..288c2b3 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
@@ -17,42 +17,6 @@
 
 package org.apache.ignite.internal.processors.query.h2;
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.math.BigDecimal;
-import java.sql.Connection;
-import java.sql.Date;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-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;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
@@ -151,6 +115,43 @@ import org.h2.value.ValueUuid;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 
+import javax.cache.Cache;
+import javax.cache.CacheException;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+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 static org.apache.ignite.IgniteSystemProperties.IGNITE_H2_DEBUG_CONSOLE;
 import static org.apache.ignite.IgniteSystemProperties.getString;
 import static org.apache.ignite.internal.processors.query.GridQueryIndexType.FULLTEXT;
@@ -917,7 +918,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 
     /**
      * Executes regular query.
-     * Note that SQL query can not refer to table alias, so use full table name instead.
      *
      * @param spaceName Space name.
      * @param qry Query.
@@ -1112,16 +1112,29 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         String from = " ";
 
         qry = qry.trim();
+
         String upper = qry.toUpperCase();
 
         if (upper.startsWith("SELECT")) {
             qry = qry.substring(6).trim();
 
-            if (!qry.startsWith("*"))
-                throw new IgniteCheckedException("Only queries starting with 'SELECT *' are supported or " +
-                    "use SqlFieldsQuery instead: " + qry0);
+            final int star = qry.indexOf('*');
+
+            if (star == 0)
+                qry = qry.substring(1).trim();
+            else if (star > 0) {
+                if (F.eq('.', qry.charAt(star - 1))) {
+                    t = qry.substring(0, star - 1);
+
+                    qry = qry.substring(star + 1).trim();
+                }
+                else
+                    throw new IgniteCheckedException("Invalid query (missing alias before asterisk): " + qry0);
+            }
+            else
+                throw new IgniteCheckedException("Only queries starting with 'SELECT *' and 'SELECT alias.*' " +
+                    "are supported (rewrite your query or use SqlFieldsQuery instead): " + qry0);
 
-            qry = qry.substring(1).trim();
             upper = qry.toUpperCase();
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/a2f66b98/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index dc572e2..0da71c8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -25,7 +25,6 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.Callable;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -227,6 +226,25 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
         assertFalse(spi.query(typeAB.space(), "select * from A.B", Collections.emptySet(), typeAB, null).hasNext());
         assertFalse(spi.query(typeBA.space(), "select * from B.A", Collections.emptySet(), typeBA, null).hasNext());
 
+        assertFalse(spi.query(typeBA.space(), "select * from B.A, A.B, A.A",
+            Collections.emptySet(), typeBA, null).hasNext());
+
+        try {
+            spi.query(typeBA.space(), "select aa.*, ab.*, ba.* from A.A aa, A.B ab, B.A ba",
+                Collections.emptySet(), typeBA, null).hasNext();
+
+            fail("Enumerations of aliases in select block must be prohibited");
+        }
+        catch (IgniteCheckedException e) {
+            // all fine
+        }
+
+        assertFalse(spi.query(typeAB.space(), "select ab.* from A.B ab",
+            Collections.emptySet(), typeAB, null).hasNext());
+
+        assertFalse(spi.query(typeBA.space(), "select   ba.*   from B.A  as ba",
+            Collections.emptySet(), typeBA, null).hasNext());
+
         // Nothing to remove.
         spi.remove("A", key(1), aa(1, "", 10));
         spi.remove("B", key(1), ba(1, "", 10, true));
@@ -287,6 +305,15 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
         assertEquals(aa(2, "Valera", 19).value(null, false), value(res.next()));
         assertFalse(res.hasNext());
 
+        res = spi.query(typeAA.space(), "select aa.* from a aa order by aa.age",
+            Collections.emptySet(), typeAA, null);
+
+        assertTrue(res.hasNext());
+        assertEquals(aa(3, "Borya", 18).value(null, false), value(res.next()));
+        assertTrue(res.hasNext());
+        assertEquals(aa(2, "Valera", 19).value(null, false), value(res.next()));
+        assertFalse(res.hasNext());
+
         res = spi.query(typeAB.space(), "from b order by name", Collections.emptySet(), typeAB, null);
 
         assertTrue(res.hasNext());
@@ -295,6 +322,15 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
         assertEquals(ab(4, "Vitalya", 20, "Very Good guy").value(null, false), value(res.next()));
         assertFalse(res.hasNext());
 
+        res = spi.query(typeAB.space(), "select bb.* from b as bb order by bb.name",
+            Collections.emptySet(), typeAB, null);
+
+        assertTrue(res.hasNext());
+        assertEquals(ab(1, "Vasya", 20, "Some text about Vasya goes here.").value(null, false), value(res.next()));
+        assertTrue(res.hasNext());
+        assertEquals(ab(4, "Vitalya", 20, "Very Good guy").value(null, false), value(res.next()));
+        assertFalse(res.hasNext());
+
         res = spi.query(typeBA.space(), "from a", Collections.emptySet(), typeBA, null);
 
         assertTrue(res.hasNext());


[13/13] ignite git commit: Merge branch 'master' into ignite-1786

Posted by vo...@apache.org.
Merge branch 'master' into ignite-1786


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

Branch: refs/heads/ignite-1786
Commit: aa373596a27649a4715bbc937f5cd7e35d272a9f
Parents: 7229e51 9b5dcfe
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 18 16:29:31 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 18 16:29:31 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/MarshallerContextImpl.java  |   3 +-
 .../ignite/internal/binary/BinaryContext.java   |   1 +
 .../ignite/internal/binary/BinaryUtils.java     |   5 +-
 .../cache/CacheEntryPredicateContainsValue.java |   8 +-
 .../cache/GridCacheDeploymentManager.java       |   8 +-
 .../processors/cache/GridCacheProcessor.java    |   4 +-
 .../binary/CacheObjectBinaryProcessorImpl.java  |  13 +-
 .../CacheDataStructuresManager.java             |   4 +-
 .../dht/preloader/GridDhtPartitionDemander.java |   3 +-
 .../continuous/CacheContinuousQueryHandler.java |  21 +-
 .../continuous/CacheContinuousQueryManager.java |  18 +-
 .../transactions/IgniteTxLocalAdapter.java      |   4 +-
 .../datastructures/DataStructuresProcessor.java |   1 +
 .../platform/PlatformProcessorImpl.java         |  17 +-
 .../callback/PlatformCallbackGateway.java       |  30 ++
 .../callback/PlatformCallbackUtils.java         |  15 +
 .../service/GridServiceProcessor.java           | 101 +++++-
 .../processors/service/GridServiceProxy.java    |  22 +-
 .../cache/CacheEnumOperationsAbstractTest.java  | 307 +++++++++++++++++++
 .../CacheEnumOperationsSingleNodeTest.java      |  28 ++
 .../cache/CacheEnumOperationsTest.java          |  28 ++
 .../cache/GridCacheDeploymentSelfTest.java      |  78 ++++-
 .../GridServiceSerializationSelfTest.java       | 149 +++++++++
 .../testsuites/IgniteCacheTestSuite2.java       |   4 +
 .../testsuites/IgniteKernalSelfTestSuite.java   |   2 +
 .../hadoop/jobtracker/HadoopJobTracker.java     |   5 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  95 +++---
 .../h2/GridIndexingSpiAbstractSelfTest.java     |  38 ++-
 .../cpp/common/include/ignite/common/exports.h  |   6 +-
 .../cpp/common/include/ignite/common/java.h     |  21 +-
 modules/platforms/cpp/common/src/exports.cpp    |   6 +-
 modules/platforms/cpp/common/src/java.cpp       |  28 +-
 .../Apache.Ignite.Core.Tests.csproj             |   2 +
 .../Process/IgniteProcess.cs                    |  16 +
 .../ProcessExtensions.cs                        |  78 +++++
 .../Apache.Ignite.Core.Tests/ReconnectTest.cs   |  96 ++++++
 .../Apache.Ignite.Core.csproj                   |   1 +
 .../Apache.Ignite.Core/Cluster/ICluster.cs      |  14 +
 .../Common/ClientDisconnectedException.cs       |  97 ++++++
 .../Impl/Binary/BinaryUtils.cs                  |   2 +-
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |   2 +-
 .../Impl/Compute/ComputeTaskHolder.cs           |   2 +-
 .../Apache.Ignite.Core/Impl/ExceptionUtils.cs   | 110 ++++---
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |  32 +-
 .../Apache.Ignite.Core/Impl/IgniteProxy.cs      |   7 +
 .../Impl/Unmanaged/UnmanagedCallbackHandlers.cs |   3 +
 .../Impl/Unmanaged/UnmanagedCallbacks.cs        |  32 +-
 pom.xml                                         |   2 +-
 48 files changed, 1390 insertions(+), 179 deletions(-)
----------------------------------------------------------------------



[02/13] ignite git commit: IGNITE-2672

Posted by vo...@apache.org.
IGNITE-2672


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

Branch: refs/heads/ignite-1786
Commit: f0f9ef65cab7231d026b8ea126e5e247515993d0
Parents: 60b6f09
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Feb 17 15:07:52 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Feb 17 15:07:52 2016 +0300

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f0f9ef65/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bead3ae..ccfd471 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,7 +84,6 @@
         <module>modules/osgi-paxlogging</module>
         <module>modules/osgi-karaf</module>
         <module>modules/osgi</module>
-		<module>modules/benchmarks</module>
     </modules>
 
     <profiles>
@@ -430,6 +429,7 @@
         <profile>
             <id>benchmarks</id>
             <modules>
+                <module>modules/benchmarks</module>
                 <module>modules/yardstick</module>
             </modules>
         </profile>


[04/13] ignite git commit: IGNITE-2156 .Net: Added ClientDisconnectedException to API. This closes #397.

Posted by vo...@apache.org.
IGNITE-2156 .Net: Added ClientDisconnectedException to API. This closes #397.


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

Branch: refs/heads/ignite-1786
Commit: acaeafb84ca46a402ccb75d59620d197a7c549fe
Parents: 8562b00
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 17 16:11:36 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 17 16:11:36 2016 +0300

----------------------------------------------------------------------
 .../platform/PlatformProcessorImpl.java         |  17 ++-
 .../callback/PlatformCallbackGateway.java       |  30 +++++
 .../callback/PlatformCallbackUtils.java         |  15 +++
 .../cpp/common/include/ignite/common/java.h     |   9 ++
 modules/platforms/cpp/common/src/java.cpp       |  16 ++-
 .../Apache.Ignite.Core.Tests.csproj             |   2 +
 .../Process/IgniteProcess.cs                    |  16 +++
 .../ProcessExtensions.cs                        |  78 +++++++++++++
 .../Apache.Ignite.Core.Tests/ReconnectTest.cs   |  96 ++++++++++++++++
 .../Apache.Ignite.Core.csproj                   |   1 +
 .../Apache.Ignite.Core/Cluster/ICluster.cs      |  14 +++
 .../Common/ClientDisconnectedException.cs       |  97 ++++++++++++++++
 .../Impl/Binary/BinaryUtils.cs                  |   2 +-
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |   2 +-
 .../Impl/Compute/ComputeTaskHolder.cs           |   2 +-
 .../Apache.Ignite.Core/Impl/ExceptionUtils.cs   | 110 +++++++++++--------
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |  32 +++++-
 .../Apache.Ignite.Core/Impl/IgniteProxy.cs      |   7 ++
 .../Impl/Unmanaged/UnmanagedCallbackHandlers.cs |   3 +
 .../Impl/Unmanaged/UnmanagedCallbacks.cs        |  32 +++++-
 20 files changed, 524 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
index d0e0a63..76967ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
@@ -27,7 +27,9 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.PlatformConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteComputeImpl;
-import org.apache.ignite.internal.binary.*;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.binary.BinaryRawWriterEx;
 import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
 import org.apache.ignite.internal.processors.GridProcessorAdapter;
 import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
@@ -53,6 +55,7 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformConfiguratio
 import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Collection;
@@ -379,6 +382,18 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
     }
 
     /** {@inheritDoc} */
+    @Override public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException {
+        platformCtx.gateway().onClientDisconnected();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException {
+        platformCtx.gateway().onClientReconnected(clusterRestarted);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
     @Override public void getIgniteConfiguration(long memPtr) {
         PlatformOutputStream stream = platformCtx.memory().get(memPtr).output();
         BinaryRawWriterEx writer = platformCtx.writer(stream);

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
index 47862a2..5093773 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackGateway.java
@@ -911,6 +911,36 @@ public class PlatformCallbackGateway {
     }
 
     /**
+     * Notifies platform about client disconnect.
+     */
+    public void onClientDisconnected() {
+        enter();
+
+        try {
+            PlatformCallbackUtils.onClientDisconnected(envPtr);
+        }
+        finally {
+            leave();
+        }
+    }
+
+    /**
+     * Notifies platform about client reconnect.
+     *
+     * @param clusterRestarted Cluster restarted flag.
+     */
+    public void onClientReconnected(boolean clusterRestarted) {
+        enter();
+
+        try {
+            PlatformCallbackUtils.onClientReconnected(envPtr, clusterRestarted);
+        }
+        finally {
+            leave();
+        }
+    }
+
+    /**
      * Kernal stop callback.
      */
     public void onStop() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
index 3112e0f..f7d6586 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils.java
@@ -481,6 +481,21 @@ public class PlatformCallbackUtils {
     static native long extensionCallbackInLongLongOutLong(long envPtr, int typ, long arg1, long arg2);
 
     /**
+     * Notifies platform about client disconnect.
+     *
+     * @param envPtr Environment pointer.
+     */
+    static native void onClientDisconnected(long envPtr);
+
+    /**
+     * Notifies platform about client reconnect.
+     *
+     * @param envPtr Environment pointer.
+     * @param clusterRestarted Cluster restarted flag.
+     */
+    static native void onClientReconnected(long envPtr, boolean clusterRestarted);
+
+    /**
      * Private constructor.
      */
     private PlatformCallbackUtils() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/cpp/common/include/ignite/common/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/java.h b/modules/platforms/cpp/common/include/ignite/common/java.h
index 8f5823e..ed47bc3 100644
--- a/modules/platforms/cpp/common/include/ignite/common/java.h
+++ b/modules/platforms/cpp/common/include/ignite/common/java.h
@@ -103,6 +103,9 @@ namespace ignite
             typedef long long(JNICALL *ExtensionCallbackInLongOutLongHandler)(void* target, int typ, long long arg1);
             typedef long long(JNICALL *ExtensionCallbackInLongLongOutLongHandler)(void* target, int typ, long long arg1, long long arg2);
 
+            typedef void(JNICALL *OnClientDisconnectedHandler)(void* target);
+            typedef void(JNICALL *OnClientReconnectedHandler)(void* target, unsigned char clusterRestarted);
+
             /**
              * JNI handlers holder.
              */
@@ -177,6 +180,9 @@ namespace ignite
 
                 ExtensionCallbackInLongOutLongHandler extensionCallbackInLongOutLong;
                 ExtensionCallbackInLongLongOutLongHandler extensionCallbackInLongLongOutLong;
+
+                OnClientDisconnectedHandler onClientDisconnected;
+                OnClientReconnectedHandler onClientReconnected;
             };
 
             /**
@@ -727,6 +733,9 @@ namespace ignite
 
             JNIEXPORT jlong JNICALL JniExtensionCallbackInLongOutLong(JNIEnv *env, jclass cls, jlong envPtr, jint typ, jlong arg1);
             JNIEXPORT jlong JNICALL JniExtensionCallbackInLongLongOutLong(JNIEnv *env, jclass cls, jlong envPtr, jint typ, jlong arg1, jlong arg2);
+
+            JNIEXPORT void JNICALL JniOnClientDisconnected(JNIEnv *env, jclass cls, jlong envPtr);
+            JNIEXPORT void JNICALL JniOnClientReconnected(JNIEnv *env, jclass cls, jlong envPtr, jboolean clusterRestarted);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/cpp/common/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/java.cpp b/modules/platforms/cpp/common/src/java.cpp
index d6f7ef0..8fc2293 100644
--- a/modules/platforms/cpp/common/src/java.cpp
+++ b/modules/platforms/cpp/common/src/java.cpp
@@ -352,6 +352,9 @@ namespace ignite
             JniMethod M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_OUT_LONG = JniMethod("extensionCallbackInLongOutLong", "(JIJ)J", true);
             JniMethod M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_LONG_OUT_LONG = JniMethod("extensionCallbackInLongLongOutLong", "(JIJJ)J", true);
 
+            JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_DISCONNECTED = JniMethod("onClientDisconnected", "(J)V", true);
+            JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_RECONNECTED = JniMethod("onClientReconnected", "(JZ)V", true);
+
             const char* C_PLATFORM_UTILS = "org/apache/ignite/internal/processors/platform/utils/PlatformUtils";
             JniMethod M_PLATFORM_UTILS_REALLOC = JniMethod("reallocate", "(JI)V", true);
             JniMethod M_PLATFORM_UTILS_ERR_DATA = JniMethod("errorData", "(Ljava/lang/Throwable;)[B", true);
@@ -808,7 +811,7 @@ namespace ignite
 
             void RegisterNatives(JNIEnv* env) {
                 {
-					JNINativeMethod methods[52];
+					JNINativeMethod methods[54];
 
                     int idx = 0;
 
@@ -882,6 +885,9 @@ namespace ignite
                     AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_OUT_LONG, reinterpret_cast<void*>(JniExtensionCallbackInLongOutLong));
                     AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_LONG_OUT_LONG, reinterpret_cast<void*>(JniExtensionCallbackInLongLongOutLong));
 
+                    AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_DISCONNECTED, reinterpret_cast<void*>(JniOnClientDisconnected));
+                    AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_RECONNECTED, reinterpret_cast<void*>(JniOnClientReconnected));
+
                     jint res = env->RegisterNatives(FindClass(env, C_PLATFORM_CALLBACK_UTILS), methods, idx);
 
                     if (res != JNI_OK)
@@ -2716,6 +2722,14 @@ namespace ignite
             JNIEXPORT jlong JNICALL JniExtensionCallbackInLongLongOutLong(JNIEnv *env, jclass cls, jlong envPtr, jint typ, jlong arg1, jlong arg2) {
                 IGNITE_SAFE_FUNC(env, envPtr, ExtensionCallbackInLongLongOutLongHandler, extensionCallbackInLongLongOutLong, typ, arg1, arg2);
             }
+            
+            JNIEXPORT void JNICALL JniOnClientDisconnected(JNIEnv *env, jclass cls, jlong envPtr) {
+                IGNITE_SAFE_PROC_NO_ARG(env, envPtr, OnClientDisconnectedHandler, onClientDisconnected);
+            }
+
+            JNIEXPORT void JNICALL JniOnClientReconnected(JNIEnv *env, jclass cls, jlong envPtr, jboolean clusterRestarted) {
+                IGNITE_SAFE_PROC(env, envPtr, OnClientReconnectedHandler, onClientReconnected, clusterRestarted);
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index fb14ed5..6f0e630 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -129,6 +129,8 @@
     <Compile Include="MessagingTest.cs" />
     <Compile Include="BinaryConfigurationTest.cs" />
     <Compile Include="Binary\BinaryStructureTest.cs" />
+    <Compile Include="ProcessExtensions.cs" />
+    <Compile Include="ReconnectTest.cs" />
     <Compile Include="SerializationTest.cs" />
     <Compile Include="IgniteStartStopTest.cs" />
     <Compile Include="TestUtils.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs
index 4853d93..85464e9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Process/IgniteProcess.cs
@@ -225,6 +225,22 @@ namespace Apache.Ignite.Core.Tests.Process
         }
 
         /// <summary>
+        /// Suspends the process.
+        /// </summary>
+        public void Suspend()
+        {
+            _proc.Suspend();
+        }
+
+        /// <summary>
+        /// Resumes the process.
+        /// </summary>
+        public void Resume()
+        {
+            _proc.Resume();
+        }
+
+        /// <summary>
         /// Join process.
         /// </summary>
         /// <returns>Exit code.</returns>

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProcessExtensions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProcessExtensions.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProcessExtensions.cs
new file mode 100644
index 0000000..b4c0a27
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProcessExtensions.cs
@@ -0,0 +1,78 @@
+/*
+ * 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.Tests
+{
+    using System;
+    using System.Diagnostics;
+    using System.Linq;
+    using System.Runtime.InteropServices;
+
+    /// <summary>
+    /// Process extensions.
+    /// </summary>
+    public static class ProcessExtensions
+    {
+        /** */
+        private const int ThreadAccessSuspendResume = 0x2;
+
+        /** */
+        [DllImport("kernel32.dll")]
+        private static extern IntPtr OpenThread(int dwDesiredAccess, bool bInheritHandle, uint dwThreadId);
+
+        /** */
+        [DllImport("kernel32.dll")]
+        private static extern uint SuspendThread(IntPtr hThread);
+
+        /** */
+        [DllImport("kernel32.dll")]
+        private static extern int ResumeThread(IntPtr hThread);
+
+        /// <summary>
+        /// Suspends the specified process.
+        /// </summary>
+        /// <param name="process">The process.</param>
+        public static void Suspend(this System.Diagnostics.Process process)
+        {
+            foreach (var thread in process.Threads.Cast<ProcessThread>())
+            {
+                var pOpenThread = OpenThread(ThreadAccessSuspendResume, false, (uint)thread.Id);
+
+                if (pOpenThread == IntPtr.Zero)
+                    break;
+
+                SuspendThread(pOpenThread);
+            }
+        }
+        /// <summary>
+        /// Resumes the specified process.
+        /// </summary>
+        /// <param name="process">The process.</param>
+        public static void Resume(this System.Diagnostics.Process process)
+        {
+            foreach (var thread in process.Threads.Cast<ProcessThread>())
+            {
+                var pOpenThread = OpenThread(ThreadAccessSuspendResume, false, (uint)thread.Id);
+
+                if (pOpenThread == IntPtr.Zero)
+                    break;
+
+                ResumeThread(pOpenThread);
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ReconnectTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ReconnectTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ReconnectTest.cs
new file mode 100644
index 0000000..5cb0a4f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ReconnectTest.cs
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+#pragma warning disable 618  // Deprecated SpringConfigUrl
+namespace Apache.Ignite.Core.Tests
+{
+    using Apache.Ignite.Core.Cache;
+    using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Tests.Process;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Client reconnect tests.
+    /// </summary>
+    public class ReconnectTest
+    {
+        /// <summary>
+        /// Tests the disconnected exception.
+        /// </summary>
+        [Test]
+        public void TestDisconnectedException()
+        {
+            var cfg = new IgniteConfiguration
+            {
+                SpringConfigUrl = "config\\compute\\compute-grid1.xml",
+                JvmClasspath = TestUtils.CreateTestClasspath(),
+                JvmOptions = TestUtils.TestJavaOptions()
+            };
+
+            var proc = StartServerProcess(cfg);
+
+            Ignition.ClientMode = true;
+
+            using (var ignite = Ignition.Start(cfg))
+            {
+                Assert.IsTrue(ignite.GetCluster().ClientReconnectTask.IsCompleted);
+
+                var cache = ignite.GetCache<int, int>(null);
+
+                cache[1] = 1;
+
+                // Suspend external process to cause disconnect
+                proc.Suspend();
+
+                var ex = Assert.Throws<CacheException>(() => cache.Get(1));
+
+                var inner = (ClientDisconnectedException) ex.InnerException;
+
+                var clientReconnectTask = inner.ClientReconnectTask;
+
+                Assert.AreEqual(ignite.GetCluster().ClientReconnectTask, clientReconnectTask);
+
+                // Resume process to reconnect
+                proc.Resume();
+
+                clientReconnectTask.Wait();
+
+                Assert.AreEqual(1, cache[1]);
+            }
+        }
+
+        /// <summary>
+        /// Starts the server process.
+        /// </summary>
+        private static IgniteProcess StartServerProcess(IgniteConfiguration cfg)
+        {
+            return new IgniteProcess(
+                "-springConfigUrl=" + cfg.SpringConfigUrl, "-J-ea", "-J-Xcheck:jni", "-J-Xms512m", "-J-Xmx512m",
+                "-J-DIGNITE_QUIET=false");
+        }
+
+        /// <summary>
+        /// Fixture tear down.
+        /// </summary>
+        [TestFixtureTearDown]
+        public void FixtureTearDown()
+        {
+            IgniteProcess.KillAll();
+            Ignition.ClientMode = false;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/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 d0ef352..661040b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -109,6 +109,7 @@
     <Compile Include="Common\IFactory.cs" />
     <Compile Include="Cache\Store\ICacheStoreSession.cs" />
     <Compile Include="Cache\Store\Package-Info.cs" />
+    <Compile Include="Common\ClientDisconnectedException.cs" />
     <Compile Include="Cluster\ClusterGroupEmptyException.cs" />
     <Compile Include="Cluster\ClusterTopologyException.cs" />
     <Compile Include="Cluster\ICluster.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
index e50970b..812a644 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Cluster
     using System;
     using System.Collections.Generic;
     using System.Diagnostics.CodeAnalysis;
+    using System.Threading.Tasks;
     using Apache.Ignite.Core.Common;
 
     /// <summary>
@@ -75,5 +76,18 @@ namespace Apache.Ignite.Core.Cluster
         /// Resets local I/O, job, and task execution metrics.
         /// </summary>
         void ResetMetrics();
+
+        /// <summary>
+        /// Gets the reconnect task, which will transition to Completed state 
+        /// when local client node reconnects to the cluster. 
+        /// <para />
+        /// Result of the task indicates whether cluster has been restarted.
+        /// <para />
+        /// If local node is not in client mode or is not disconnected, returns completed task.
+        /// </summary>
+        /// <value>
+        /// The reconnect task.
+        /// </value>
+        Task<bool> ClientReconnectTask { get; } 
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core/Common/ClientDisconnectedException.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Common/ClientDisconnectedException.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Common/ClientDisconnectedException.cs
new file mode 100644
index 0000000..8843a0b
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Common/ClientDisconnectedException.cs
@@ -0,0 +1,97 @@
+/*
+ * 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.Common
+{
+    using System;
+    using System.Diagnostics.CodeAnalysis;
+    using System.Runtime.Serialization;
+    using System.Threading.Tasks;
+
+    /// <summary>
+    /// Indicates that client-mode local node has been disconnected from the cluster.
+    /// </summary>
+    [SuppressMessage("Microsoft.Usage", "CA2240:ImplementISerializableCorrectly", 
+        Justification = "No need to implement GetObjectData because there are no custom fields.")]
+    [Serializable]
+    public sealed class ClientDisconnectedException : IgniteException
+    {
+        /// <summary>
+        /// The client reconnect task.
+        /// </summary>
+        private readonly Task<bool> _clientReconnectTask;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ClientDisconnectedException"/> class.
+        /// </summary>
+        public ClientDisconnectedException()
+        {
+            // No-op.
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ClientDisconnectedException"/> class.
+        /// </summary>
+        /// <param name="message">The message that describes the error.</param>
+        public ClientDisconnectedException(string message) : base(message)
+        {
+            // No-op.
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ClientDisconnectedException"/> class.
+        /// </summary>
+        /// <param name="message">The message.</param>
+        /// <param name="cause">The cause.</param>
+        public ClientDisconnectedException(string message, Exception cause) : base(message, cause)
+        {
+            // No-op.
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ClientDisconnectedException" /> class.
+        /// </summary>
+        /// <param name="message">The message.</param>
+        /// <param name="cause">The cause.</param>
+        /// <param name="clientReconnectTask">The client reconnect task.</param>
+        public ClientDisconnectedException(string message, Exception cause, Task<bool> clientReconnectTask) : base(message, cause)
+        {
+            _clientReconnectTask = clientReconnectTask;
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ClientDisconnectedException"/> class.
+        /// </summary>
+        /// <param name="info">Serialization information.</param>
+        /// <param name="ctx">Streaming context.</param>
+        private ClientDisconnectedException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
+        {
+            // No-op.
+        }
+
+        /// <summary>
+        /// Gets the client reconnect task, if present.
+        /// </summary>
+        /// <value>
+        /// The client reconnect task, or null.
+        /// </value>
+        public Task<bool> ClientReconnectTask
+        {
+            get { return _clientReconnectTask; }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/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 9066bd1..b73a6c4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -1658,7 +1658,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             err = reader.ReadBoolean()
                 ? reader.ReadObject<object>()
-                : ExceptionUtils.GetException(reader.ReadString(), reader.ReadString());
+                : ExceptionUtils.GetException(reader.Marshaller.Ignite, reader.ReadString(), reader.ReadString());
 
             return null;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index d1296ec..1296596 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -1170,7 +1170,7 @@ namespace Apache.Ignite.Core.Impl.Cache
 
             var msg = Unmarshal<string>(inStream);
                 
-            return new CacheEntryProcessorException(ExceptionUtils.GetException(clsName, msg));
+            return new CacheEntryProcessorException(ExceptionUtils.GetException(_ignite, clsName, msg));
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
index e992245..a7988c5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
@@ -391,7 +391,7 @@ namespace Apache.Ignite.Core.Impl.Compute
             {
                 err = reader.ReadBoolean()
                     ? reader.ReadObject<BinaryObject>().Deserialize<Exception>()
-                    : ExceptionUtils.GetException(reader.ReadString(), reader.ReadString());
+                    : ExceptionUtils.GetException(_compute.Marshaller.Ignite, reader.ReadString(), reader.ReadString());
             }
             catch (Exception e)
             {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
index 4d2e458..695f156 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Impl
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
     using System.Security;
+    using System.Text.RegularExpressions;
     using System.Threading;
     using Apache.Ignite.Core.Cache;
     using Apache.Ignite.Core.Cache.Store;
@@ -44,102 +45,119 @@ namespace Apache.Ignite.Core.Impl
 
         /** InteropCachePartialUpdateException. */
         private const string ClsCachePartialUpdateErr = "org.apache.ignite.internal.processors.platform.cache.PlatformCachePartialUpdateException";
-        
+
         /** Map with predefined exceptions. */
         private static readonly IDictionary<string, ExceptionFactoryDelegate> Exs = new Dictionary<string, ExceptionFactoryDelegate>();
 
         /** Exception factory delegate. */
-        private delegate Exception ExceptionFactoryDelegate(string msg);
-        
+        private delegate Exception ExceptionFactoryDelegate(IIgnite ignite, string msg, Exception innerEx);
+
+        /** Inner class regex. */
+        private static readonly Regex InnerClassRegex = new Regex(@"class ([^\s]+): (.*)", RegexOptions.Compiled);
+
         /// <summary>
         /// Static initializer.
         /// </summary>
-        [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", 
+        [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline",
             Justification = "Readability")]
         static ExceptionUtils()
         {
             // Common Java exceptions mapped to common .Net exceptions.
-            Exs["java.lang.IllegalArgumentException"] = m => new ArgumentException(m);
-            Exs["java.lang.IllegalStateException"] = m => new InvalidOperationException(m);
-            Exs["java.lang.UnsupportedOperationException"] = m => new NotImplementedException(m);
-            Exs["java.lang.InterruptedException"] = m => new ThreadInterruptedException(m);
-            
+            Exs["java.lang.IllegalArgumentException"] = (i, m, e) => new ArgumentException(m, e);
+            Exs["java.lang.IllegalStateException"] = (i, m, e) => new InvalidOperationException(m, e);
+            Exs["java.lang.UnsupportedOperationException"] = (i, m, e) => new NotImplementedException(m, e);
+            Exs["java.lang.InterruptedException"] = (i, m, e) => new ThreadInterruptedException(m, e);
+
             // Generic Ignite exceptions.
-            Exs["org.apache.ignite.IgniteException"] = m => new IgniteException(m);
-            Exs["org.apache.ignite.IgniteCheckedException"] = m => new IgniteException(m);
+            Exs["org.apache.ignite.IgniteException"] = (i, m, e) => new IgniteException(m, e);
+            Exs["org.apache.ignite.IgniteCheckedException"] = (i, m, e) => new IgniteException(m, e);
+            Exs["org.apache.ignite.IgniteClientDisconnectedException"] = (i, m, e) => new ClientDisconnectedException(m, e, i.GetCluster().ClientReconnectTask);
+            Exs["org.apache.ignite.internal.IgniteClientDisconnectedCheckedException"] = (i, m, e) => new ClientDisconnectedException(m, e, i.GetCluster().ClientReconnectTask);
 
             // Cluster exceptions.
-            Exs["org.apache.ignite.cluster.ClusterGroupEmptyException"] = m => new ClusterGroupEmptyException(m);
-            Exs["org.apache.ignite.cluster.ClusterTopologyException"] = m => new ClusterTopologyException(m);
+            Exs["org.apache.ignite.cluster.ClusterGroupEmptyException"] = (i, m, e) => new ClusterGroupEmptyException(m, e);
+            Exs["org.apache.ignite.cluster.ClusterTopologyException"] = (i, m, e) => new ClusterTopologyException(m, e);
 
             // Compute exceptions.
-            Exs["org.apache.ignite.compute.ComputeExecutionRejectedException"] = m => new ComputeExecutionRejectedException(m);
-            Exs["org.apache.ignite.compute.ComputeJobFailoverException"] = m => new ComputeJobFailoverException(m);
-            Exs["org.apache.ignite.compute.ComputeTaskCancelledException"] = m => new ComputeTaskCancelledException(m);
-            Exs["org.apache.ignite.compute.ComputeTaskTimeoutException"] = m => new ComputeTaskTimeoutException(m);
-            Exs["org.apache.ignite.compute.ComputeUserUndeclaredException"] = m => new ComputeUserUndeclaredException(m);
+            Exs["org.apache.ignite.compute.ComputeExecutionRejectedException"] = (i, m, e) => new ComputeExecutionRejectedException(m, e);
+            Exs["org.apache.ignite.compute.ComputeJobFailoverException"] = (i, m, e) => new ComputeJobFailoverException(m, e);
+            Exs["org.apache.ignite.compute.ComputeTaskCancelledException"] = (i, m, e) => new ComputeTaskCancelledException(m, e);
+            Exs["org.apache.ignite.compute.ComputeTaskTimeoutException"] = (i, m, e) => new ComputeTaskTimeoutException(m, e);
+            Exs["org.apache.ignite.compute.ComputeUserUndeclaredException"] = (i, m, e) => new ComputeUserUndeclaredException(m, e);
 
             // Cache exceptions.
-            Exs["javax.cache.CacheException"] = m => new CacheException(m);
-            Exs["javax.cache.integration.CacheLoaderException"] = m => new CacheStoreException(m);
-            Exs["javax.cache.integration.CacheWriterException"] = m => new CacheStoreException(m);
-            Exs["javax.cache.processor.EntryProcessorException"] = m => new CacheEntryProcessorException(m);
-            Exs["org.apache.ignite.cache.CacheAtomicUpdateTimeoutException"] = m => new CacheAtomicUpdateTimeoutException(m);
-            
+            Exs["javax.cache.CacheException"] = (i, m, e) => new CacheException(m, e);
+            Exs["javax.cache.integration.CacheLoaderException"] = (i, m, e) => new CacheStoreException(m, e);
+            Exs["javax.cache.integration.CacheWriterException"] = (i, m, e) => new CacheStoreException(m, e);
+            Exs["javax.cache.processor.EntryProcessorException"] = (i, m, e) => new CacheEntryProcessorException(m, e);
+            Exs["org.apache.ignite.cache.CacheAtomicUpdateTimeoutException"] = (i, m, e) => new CacheAtomicUpdateTimeoutException(m, e);
+
             // Transaction exceptions.
-            Exs["org.apache.ignite.transactions.TransactionOptimisticException"] = m => new TransactionOptimisticException(m);
-            Exs["org.apache.ignite.transactions.TransactionTimeoutException"] = m => new TransactionTimeoutException(m);
-            Exs["org.apache.ignite.transactions.TransactionRollbackException"] = m => new TransactionRollbackException(m);
-            Exs["org.apache.ignite.transactions.TransactionHeuristicException"] = m => new TransactionHeuristicException(m);
+            Exs["org.apache.ignite.transactions.TransactionOptimisticException"] = (i, m, e) => new TransactionOptimisticException(m, e);
+            Exs["org.apache.ignite.transactions.TransactionTimeoutException"] = (i, m, e) => new TransactionTimeoutException(m, e);
+            Exs["org.apache.ignite.transactions.TransactionRollbackException"] = (i, m, e) => new TransactionRollbackException(m, e);
+            Exs["org.apache.ignite.transactions.TransactionHeuristicException"] = (i, m, e) => new TransactionHeuristicException(m, e);
 
             // Security exceptions.
-            Exs["org.apache.ignite.IgniteAuthenticationException"] = m => new SecurityException(m);
-            Exs["org.apache.ignite.plugin.security.GridSecurityException"] = m => new SecurityException(m);
+            Exs["org.apache.ignite.IgniteAuthenticationException"] = (i, m, e) => new SecurityException(m, e);
+            Exs["org.apache.ignite.plugin.security.GridSecurityException"] = (i, m, e) => new SecurityException(m, e);
 
             // Future exceptions
-            Exs["org.apache.ignite.lang.IgniteFutureCancelledException"] = m => new IgniteFutureCancelledException(m);
-            Exs["org.apache.ignite.internal.IgniteFutureCancelledCheckedException"] = m => new IgniteFutureCancelledException(m);
+            Exs["org.apache.ignite.lang.IgniteFutureCancelledException"] = (i, m, e) => new IgniteFutureCancelledException(m, e);
+            Exs["org.apache.ignite.internal.IgniteFutureCancelledCheckedException"] = (i, m, e) => new IgniteFutureCancelledException(m, e);
         }
 
         /// <summary>
         /// Creates exception according to native code class and message.
         /// </summary>
+        /// <param name="ignite">The ignite.</param>
         /// <param name="clsName">Exception class name.</param>
         /// <param name="msg">Exception message.</param>
         /// <param name="reader">Error data reader.</param>
-        public static Exception GetException(string clsName, string msg, BinaryReader reader = null)
+        /// <returns>Exception.</returns>
+        public static Exception GetException(IIgnite ignite, string clsName, string msg, BinaryReader reader = null)
         {
             ExceptionFactoryDelegate ctor;
 
             if (Exs.TryGetValue(clsName, out ctor))
-                return ctor(msg);
+            {
+                var match = InnerClassRegex.Match(msg);
 
-            if (ClsNoClsDefFoundErr.Equals(clsName))
+                ExceptionFactoryDelegate innerCtor;
+
+                if (match.Success && Exs.TryGetValue(match.Groups[1].Value, out innerCtor))
+                    return ctor(ignite, msg, innerCtor(ignite, match.Groups[2].Value, null));
+
+                return ctor(ignite, msg, null);
+            }
+
+            if (ClsNoClsDefFoundErr.Equals(clsName, StringComparison.OrdinalIgnoreCase))
                 return new IgniteException("Java class is not found (did you set IGNITE_HOME environment " +
                     "variable?): " + msg);
 
-            if (ClsNoSuchMthdErr.Equals(clsName))
+            if (ClsNoSuchMthdErr.Equals(clsName, StringComparison.OrdinalIgnoreCase))
                 return new IgniteException("Java class method is not found (did you set IGNITE_HOME environment " +
                     "variable?): " + msg);
 
-            if (ClsCachePartialUpdateErr.Equals(clsName))
-                return ProcessCachePartialUpdateException(msg, reader);
-            
+            if (ClsCachePartialUpdateErr.Equals(clsName, StringComparison.OrdinalIgnoreCase))
+                return ProcessCachePartialUpdateException(ignite, msg, reader);
+
             return new IgniteException("Java exception occurred [class=" + clsName + ", message=" + msg + ']');
         }
 
         /// <summary>
         /// Process cache partial update exception.
         /// </summary>
+        /// <param name="ignite">The ignite.</param>
         /// <param name="msg">Message.</param>
         /// <param name="reader">Reader.</param>
-        /// <returns></returns>
+        /// <returns>CachePartialUpdateException.</returns>
         [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
-        private static Exception ProcessCachePartialUpdateException(string msg, BinaryReader reader)
+        private static Exception ProcessCachePartialUpdateException(IIgnite ignite, string msg, BinaryReader reader)
         {
             if (reader == null)
                 return new CachePartialUpdateException(msg, new IgniteException("Failed keys are not available."));
-            
+
             bool dataExists = reader.ReadBoolean();
 
             Debug.Assert(dataExists);
@@ -160,12 +178,12 @@ namespace Apache.Ignite.Core.Impl
                     return new CachePartialUpdateException(msg, e);
                 }
             }
-            
+
             // Was not able to write keys.
             string innerErrCls = reader.ReadString();
             string innerErrMsg = reader.ReadString();
 
-            Exception innerErr = GetException(innerErrCls, innerErrMsg);
+            Exception innerErr = GetException(ignite, innerErrCls, innerErrMsg);
 
             return new CachePartialUpdateException(msg, innerErr);
         }
@@ -179,7 +197,7 @@ namespace Apache.Ignite.Core.Impl
         public static Exception GetJvmInitializeException(string clsName, string msg)
         {
             if (clsName != null)
-                return new IgniteException("Failed to initialize JVM.", GetException(clsName, msg));
+                return new IgniteException("Failed to initialize JVM.", GetException(null, clsName, msg));
 
             if (msg != null)
                 return new IgniteException("Failed to initialize JVM: " + msg);
@@ -194,7 +212,7 @@ namespace Apache.Ignite.Core.Impl
         /// <returns>List.</returns>
         private static List<object> ReadNullableList(BinaryReader reader)
         {
-            if (!reader.ReadBoolean()) 
+            if (!reader.ReadBoolean())
                 return null;
 
             var size = reader.ReadInt();

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/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 be21d7f..0271fa2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Impl
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
     using System.Linq;
+    using System.Threading.Tasks;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache;
     using Apache.Ignite.Core.Cache.Configuration;
@@ -86,10 +87,13 @@ namespace Apache.Ignite.Core.Impl
         private readonly UnmanagedCallbacks _cbs;
 
         /** Node info cache. */
-
         private readonly ConcurrentDictionary<Guid, ClusterNodeImpl> _nodes =
             new ConcurrentDictionary<Guid, ClusterNodeImpl>();
 
+        /** Client reconnect task completion source. */
+        private volatile TaskCompletionSource<bool> _clientReconnectTaskCompletionSource = 
+            new TaskCompletionSource<bool>();
+
         /// <summary>
         /// Constructor.
         /// </summary>
@@ -128,6 +132,9 @@ namespace Apache.Ignite.Core.Impl
             // Grid is not completely started here, can't initialize interop transactions right away.
             _transactions = new Lazy<TransactionsImpl>(
                     () => new TransactionsImpl(UU.ProcessorTransactions(proc), marsh, GetLocalNode().Id));
+
+            // Set reconnected task to completed state for convenience.
+            _clientReconnectTaskCompletionSource.SetResult(false);
         }
 
         /// <summary>
@@ -429,6 +436,12 @@ namespace Apache.Ignite.Core.Impl
         }
 
         /** <inheritdoc /> */
+        public Task<bool> ClientReconnectTask
+        {
+            get { return _clientReconnectTaskCompletionSource.Task; }
+        }
+
+        /** <inheritdoc /> */
         public IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName)
         {
             return new DataStreamerImpl<TK, TV>(UU.ProcessorDataStreamer(_proc, cacheName, false),
@@ -630,5 +643,22 @@ namespace Apache.Ignite.Core.Impl
         {
             get { return _proc; }
         }
+
+        /// <summary>
+        /// Called when local client node has been disconnected from the cluster.
+        /// </summary>
+        public void OnClientDisconnected()
+        {
+            _clientReconnectTaskCompletionSource = new TaskCompletionSource<bool>();
+        }
+
+        /// <summary>
+        /// Called when local client node has been reconnected to the cluster.
+        /// </summary>
+        /// <param name="clusterRestarted">Cluster restarted flag.</param>
+        public void OnClientReconnected(bool clusterRestarted)
+        {
+            _clientReconnectTaskCompletionSource.TrySetResult(clusterRestarted);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/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 a303783..0aa55fb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Impl
     using System;
     using System.Collections.Generic;
     using System.Diagnostics.CodeAnalysis;
+    using System.Threading.Tasks;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache;
     using Apache.Ignite.Core.Cache.Configuration;
@@ -285,6 +286,12 @@ namespace Apache.Ignite.Core.Impl
         }
 
         /** <inheritdoc /> */
+        public Task<bool> ClientReconnectTask
+        {
+            get { return _ignite.GetCluster().ClientReconnectTask; }
+        }
+
+        /** <inheritdoc /> */
         public IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName)
         {
             return _ignite.GetDataStreamer<TK, TV>(cacheName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
index 8147e9d..fb52033 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
@@ -95,5 +95,8 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
 
         internal void* extensionCbInLongOutLong;
         internal void* extensionCbInLongLongOutLong;
+
+        internal void* onClientDisconnected;
+        internal void* ocClientReconnected;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/acaeafb8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
index 7778484..8d810e3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@ -162,6 +162,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
         private delegate long ExtensionCallbackInLongOutLongDelegate(void* target, int typ, long arg1);
         private delegate long ExtensionCallbackInLongLongOutLongDelegate(void* target, int typ, long arg1, long arg2);
 
+        private delegate void OnClientDisconnectedDelegate(void* target);
+        private delegate void OnClientReconnectedDelegate(void* target, bool clusterRestarted);
+
         /// <summary>
         /// constructor.
         /// </summary>
@@ -241,7 +244,10 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
                 error = CreateFunctionPointer((ErrorCallbackDelegate)Error),
                 
                 extensionCbInLongOutLong = CreateFunctionPointer((ExtensionCallbackInLongOutLongDelegate)ExtensionCallbackInLongOutLong),
-                extensionCbInLongLongOutLong = CreateFunctionPointer((ExtensionCallbackInLongLongOutLongDelegate)ExtensionCallbackInLongLongOutLong)
+                extensionCbInLongLongOutLong = CreateFunctionPointer((ExtensionCallbackInLongLongOutLongDelegate)ExtensionCallbackInLongLongOutLong),
+
+                onClientDisconnected = CreateFunctionPointer((OnClientDisconnectedDelegate)OnClientDisconnected),
+                ocClientReconnected = CreateFunctionPointer((OnClientReconnectedDelegate)OnClientReconnected),
             };
 
             _cbsPtr = Marshal.AllocHGlobal(UU.HandlersSize());
@@ -728,7 +734,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
                     string errCls = reader.ReadString();
                     string errMsg = reader.ReadString();
 
-                    Exception err = ExceptionUtils.GetException(errCls, errMsg, reader);
+                    Exception err = ExceptionUtils.GetException(_ignite, errCls, errMsg, reader);
 
                     ProcessFuture(futPtr, fut => { fut.OnError(err); });
                 }
@@ -1043,10 +1049,10 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
                         // Stream disposal intentionally omitted: IGNITE-1598
                         var stream = new PlatformRawMemory(errData, errDataLen).GetStream();
 
-                        throw ExceptionUtils.GetException(errCls, errMsg, _ignite.Marshaller.StartUnmarshal(stream));
+                        throw ExceptionUtils.GetException(_ignite, errCls, errMsg, _ignite.Marshaller.StartUnmarshal(stream));
                     }
 
-                    throw ExceptionUtils.GetException(errCls, errMsg);
+                    throw ExceptionUtils.GetException(_ignite, errCls, errMsg);
 
                 case ErrJvmInit:
                     throw ExceptionUtils.GetJvmInitializeException(errCls, errMsg);
@@ -1059,8 +1065,24 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
             }
         }
 
+        private void OnClientDisconnected(void* target)
+        {
+            SafeCall(() =>
+            {
+                _ignite.OnClientDisconnected();
+            });
+        }
+
+        private void OnClientReconnected(void* target, bool clusterRestarted)
+        {
+            SafeCall(() =>
+            {
+                _ignite.OnClientReconnected(clusterRestarted);
+            });
+        }
+
         #endregion
-        
+
         #region HELPERS
 
         [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]


[05/13] ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by vo...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/ignite-1786
Commit: 9cb175fb61a47db7201e891010179a5fdf08053f
Parents: acaeafb a67fbfa
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 17 16:11:51 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 17 16:11:51 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryUtils.java     |   5 +-
 .../cache/CacheEntryPredicateContainsValue.java |   8 +-
 .../binary/CacheObjectBinaryProcessorImpl.java  |  10 +-
 .../cache/CacheEnumOperationsAbstractTest.java  | 307 +++++++++++++++++++
 .../CacheEnumOperationsSingleNodeTest.java      |  28 ++
 .../cache/CacheEnumOperationsTest.java          |  28 ++
 .../testsuites/IgniteCacheTestSuite2.java       |   4 +
 pom.xml                                         |   2 +-
 8 files changed, 380 insertions(+), 12 deletions(-)
----------------------------------------------------------------------



[03/13] ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by vo...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/ignite-1786
Commit: a67fbfacac8f61a69732723b26b155cf64aadcaf
Parents: f0f9ef6 8be62f0
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Feb 17 15:08:16 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Feb 17 15:08:16 2016 +0300

----------------------------------------------------------------------
 .../cache/query/CacheQueryEntryEvent.java       |  48 +
 .../ignite/internal/GridJobCancelRequest.java   |   5 +
 .../ignite/internal/GridJobExecuteRequest.java  |   5 +
 .../ignite/internal/GridJobExecuteResponse.java |   5 +
 .../ignite/internal/GridJobSiblingsRequest.java |   5 +
 .../internal/GridJobSiblingsResponse.java       |   5 +
 .../ignite/internal/GridTaskCancelRequest.java  |   5 +
 .../ignite/internal/GridTaskSessionRequest.java |   5 +
 .../internal/binary/BinaryEnumObjectImpl.java   |   5 +
 .../internal/binary/BinaryObjectImpl.java       |   5 +
 .../binary/BinaryObjectOffheapImpl.java         |   5 +
 .../ignite/internal/binary/BinaryUtils.java     |   5 +-
 .../checkpoint/GridCheckpointRequest.java       |   5 +
 .../managers/communication/GridIoMessage.java   |   5 +
 .../communication/GridIoUserMessage.java        |   5 +
 .../deployment/GridDeploymentInfoBean.java      |   5 +
 .../deployment/GridDeploymentRequest.java       |   5 +
 .../deployment/GridDeploymentResponse.java      |   5 +
 .../eventstorage/GridEventStorageMessage.java   |   5 +
 .../affinity/AffinityTopologyVersion.java       |   5 +
 .../cache/CacheEntryInfoCollection.java         |   5 +
 .../cache/CacheEntryPredicateAdapter.java       |   5 +
 .../cache/CacheEntryPredicateContainsValue.java |   8 +-
 .../cache/CacheEntrySerializablePredicate.java  |   5 +
 .../cache/CacheEvictableEntryImpl.java          |   2 +-
 .../processors/cache/CacheEvictionEntry.java    |   5 +
 .../cache/CacheInvokeDirectResult.java          |   5 +
 .../cache/CacheObjectByteArrayImpl.java         |   5 +
 .../processors/cache/CacheObjectImpl.java       |   5 +
 .../processors/cache/GridCacheEntryInfo.java    |   5 +
 .../processors/cache/GridCacheMessage.java      |   5 +
 .../processors/cache/GridCacheReturn.java       |   5 +
 .../processors/cache/KeyCacheObjectImpl.java    |   5 +
 .../binary/CacheObjectBinaryProcessorImpl.java  |  10 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   5 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  14 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |  16 +
 .../preloader/GridDhtPartitionExchangeId.java   |   5 +
 .../distributed/near/CacheVersionedValue.java   |   5 +
 .../cache/query/GridCacheSqlQuery.java          |   5 +
 .../continuous/CacheContinuousQueryEntry.java   |   5 +
 .../continuous/CacheContinuousQueryEvent.java   |  17 +-
 .../continuous/CacheContinuousQueryHandler.java |  95 +-
 .../CacheContinuousQueryListener.java           |   3 +-
 .../continuous/CacheContinuousQueryManager.java |  26 +-
 .../cache/transactions/IgniteTxEntry.java       |   5 +
 .../cache/transactions/IgniteTxKey.java         |   5 +
 .../cache/transactions/TxEntryValueHolder.java  |   5 +
 .../cache/version/GridCacheVersion.java         |   5 +
 .../clock/GridClockDeltaSnapshotMessage.java    |   5 +
 .../processors/clock/GridClockDeltaVersion.java |   5 +
 .../continuous/GridContinuousMessage.java       |   5 +
 .../datastreamer/DataStreamerEntry.java         |   5 +
 .../datastreamer/DataStreamerRequest.java       |   5 +
 .../datastreamer/DataStreamerResponse.java      |   5 +
 .../processors/igfs/IgfsAckMessage.java         |   5 +
 .../internal/processors/igfs/IgfsBlockKey.java  |   5 +
 .../processors/igfs/IgfsBlocksMessage.java      |   5 +
 .../processors/igfs/IgfsDeleteMessage.java      |   5 +
 .../processors/igfs/IgfsFileAffinityRange.java  |   5 +
 .../igfs/IgfsFragmentizerRequest.java           |   5 +
 .../igfs/IgfsFragmentizerResponse.java          |   5 +
 .../processors/igfs/IgfsSyncMessage.java        |   5 +
 .../messages/GridQueryCancelRequest.java        |   5 +
 .../twostep/messages/GridQueryFailResponse.java |   5 +
 .../messages/GridQueryNextPageRequest.java      |   5 +
 .../messages/GridQueryNextPageResponse.java     |   5 +
 .../h2/twostep/messages/GridQueryRequest.java   |   5 +
 .../handlers/task/GridTaskResultRequest.java    |   5 +
 .../handlers/task/GridTaskResultResponse.java   |   5 +
 .../ignite/internal/util/GridByteArrayList.java |   5 +
 .../ignite/internal/util/GridLongList.java      |   5 +
 .../internal/util/GridMessageCollection.java    |   5 +
 .../internal/util/UUIDCollectionMessage.java    |   5 +
 .../util/nio/GridNioFinishedFuture.java         |   5 +
 .../ignite/internal/util/nio/GridNioFuture.java |   7 +-
 .../internal/util/nio/GridNioFutureImpl.java    |   5 +
 .../util/nio/GridNioRecoveryDescriptor.java     |   2 +
 .../ignite/internal/util/nio/GridNioServer.java |   7 +
 .../extensions/communication/Message.java       |   5 +
 .../jobstealing/JobStealingRequest.java         |   5 +
 .../communication/tcp/TcpCommunicationSpi.java  |  15 +
 .../internal/GridAffinityNoCacheSelfTest.java   |   5 +
 .../GridCommunicationSendMessageSelfTest.java   |   5 +
 .../communication/GridIoManagerSelfTest.java    |   5 +
 .../cache/CacheEnumOperationsAbstractTest.java  | 307 +++++++
 .../CacheEnumOperationsSingleNodeTest.java      |  28 +
 .../cache/CacheEnumOperationsTest.java          |  28 +
 .../GridCacheEvictableEntryEqualsSelfTest.java  |  85 ++
 ...CacheContinuousQueryCounterAbstractTest.java | 612 +++++++++++++
 ...inuousQueryCounterPartitionedAtomicTest.java |  41 +
 ...ContinuousQueryCounterPartitionedTxTest.java |  41 +
 ...tinuousQueryCounterReplicatedAtomicTest.java |  41 +
 ...eContinuousQueryCounterReplicatedTxTest.java |  41 +
 ...acheContinuousQueryRandomOperationsTest.java | 896 ++++++++++++++++---
 .../communication/GridTestMessage.java          |   5 +
 .../spi/communication/GridTestMessage.java      |   5 +
 .../IgniteCacheEvictionSelfTestSuite.java       |   4 +-
 .../testsuites/IgniteCacheTestSuite2.java       |   4 +
 .../h2/twostep/msg/GridH2ValueMessage.java      |   5 +
 .../h2/GridIndexingSpiAbstractSelfTest.java     |   5 +
 .../IgniteCacheQuerySelfTestSuite.java          |   8 +
 .../cpp/core-test/src/cache_query_test.cpp      |  45 +
 .../ignite/cache/query/query_fields_row.h       |   2 +-
 104 files changed, 2588 insertions(+), 240 deletions(-)
----------------------------------------------------------------------



[07/13] ignite git commit: IGNITE-2678 Fix types in JNI interop for configuration-related methods

Posted by vo...@apache.org.
IGNITE-2678 Fix types in JNI interop for configuration-related methods


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

Branch: refs/heads/ignite-1786
Commit: d2e6535deeb217a33c1e79c782bb18d2eae520c8
Parents: a2f66b9
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Wed Feb 17 19:05:23 2016 +0300
Committer: Pavel Tupitsyn <pt...@gridgain.com>
Committed: Wed Feb 17 19:05:23 2016 +0300

----------------------------------------------------------------------
 .../cpp/common/include/ignite/common/exports.h          |  6 +++---
 .../platforms/cpp/common/include/ignite/common/java.h   | 12 ++++++------
 modules/platforms/cpp/common/src/exports.cpp            |  6 +++---
 modules/platforms/cpp/common/src/java.cpp               | 12 ++++++------
 4 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d2e6535d/modules/platforms/cpp/common/include/ignite/common/exports.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/exports.h b/modules/platforms/cpp/common/include/ignite/common/exports.h
index 15911a6..6f2049d 100644
--- a/modules/platforms/cpp/common/include/ignite/common/exports.h
+++ b/modules/platforms/cpp/common/include/ignite/common/exports.h
@@ -36,8 +36,8 @@ extern "C" {
     void* IGNITE_CALL IgniteProcessorCache(gcj::JniContext* ctx, void* obj, char* name);
     void* IGNITE_CALL IgniteProcessorCreateCache(gcj::JniContext* ctx, void* obj, char* name);
     void* IGNITE_CALL IgniteProcessorGetOrCreateCache(gcj::JniContext* ctx, void* obj, char* name);
-    void* IGNITE_CALL IgniteProcessorCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long memPtr);
-    void* IGNITE_CALL IgniteProcessorGetOrCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long memPtr);
+    void* IGNITE_CALL IgniteProcessorCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr);
+    void* IGNITE_CALL IgniteProcessorGetOrCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr);
     void IGNITE_CALL IgniteProcessorDestroyCache(gcj::JniContext* ctx, void* obj, char* name);
     void* IGNITE_CALL IgniteProcessorAffinity(gcj::JniContext* ctx, void* obj, char* name);
     void* IGNITE_CALL IgniteProcessorDataStreamer(gcj::JniContext* ctx, void* obj, char* name, bool keepPortable);
@@ -50,7 +50,7 @@ extern "C" {
     void* IGNITE_CALL IgniteProcessorAtomicLong(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create);
     void* IGNITE_CALL IgniteProcessorAtomicSequence(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create);
     void* IGNITE_CALL IgniteProcessorAtomicReference(gcj::JniContext* ctx, void* obj, char* name, long long memPtr, bool create);
-    void IGNITE_CALL IgniteProcessorGetIgniteConfiguration(gcj::JniContext* ctx, void* obj, long memPtr);
+    void IGNITE_CALL IgniteProcessorGetIgniteConfiguration(gcj::JniContext* ctx, void* obj, long long memPtr);
     
     long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
     void IGNITE_CALL IgniteTargetInStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, long long inMemPtr, long long outMemPtr);

http://git-wip-us.apache.org/repos/asf/ignite/blob/d2e6535d/modules/platforms/cpp/common/include/ignite/common/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/java.h b/modules/platforms/cpp/common/include/ignite/common/java.h
index ed47bc3..4b79665 100644
--- a/modules/platforms/cpp/common/include/ignite/common/java.h
+++ b/modules/platforms/cpp/common/include/ignite/common/java.h
@@ -515,10 +515,10 @@ namespace ignite
                 jobject ProcessorCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo);
                 jobject ProcessorGetOrCreateCache(jobject obj, const char* name);
                 jobject ProcessorGetOrCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo);
-                jobject ProcessorCreateCacheFromConfig(jobject obj, long memPtr);
-                jobject ProcessorCreateCacheFromConfig(jobject obj, long memPtr, JniErrorInfo* errInfo);
-                jobject ProcessorGetOrCreateCacheFromConfig(jobject obj, long memPtr);
-                jobject ProcessorGetOrCreateCacheFromConfig(jobject obj, long memPtr, JniErrorInfo* errInfo);
+                jobject ProcessorCreateCacheFromConfig(jobject obj, long long memPtr);
+                jobject ProcessorCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo);
+                jobject ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr);
+                jobject ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo);
                 void ProcessorDestroyCache(jobject obj, const char* name);
                 void ProcessorDestroyCache(jobject obj, const char* name, JniErrorInfo* errInfo);
                 jobject ProcessorAffinity(jobject obj, const char* name);
@@ -532,7 +532,7 @@ namespace ignite
                 jobject ProcessorAtomicLong(jobject obj, char* name, long long initVal, bool create);
                 jobject ProcessorAtomicSequence(jobject obj, char* name, long long initVal, bool create);
                 jobject ProcessorAtomicReference(jobject obj, char* name, long long memPtr, bool create);
-				void ProcessorGetIgniteConfiguration(jobject obj, long memPtr);
+				void ProcessorGetIgniteConfiguration(jobject obj, long long memPtr);
                 
                 long long TargetInStreamOutLong(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
                 void TargetInStreamOutStream(jobject obj, int opType, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL);
@@ -664,7 +664,7 @@ namespace ignite
                 void ExceptionCheck(JNIEnv* env, JniErrorInfo* errInfo);
                 jobject LocalToGlobal(JNIEnv* env, jobject obj);
                 jobject ProcessorCache0(jobject proc, const char* name, jmethodID mthd, JniErrorInfo* errInfo);
-                jobject ProcessorCacheFromConfig0(jobject proc, long memPtr, jmethodID mthd, JniErrorInfo* errInfo);
+                jobject ProcessorCacheFromConfig0(jobject proc, long long memPtr, jmethodID mthd, JniErrorInfo* errInfo);
             };
 
             JNIEXPORT jlong JNICALL JniCacheStoreCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);

http://git-wip-us.apache.org/repos/asf/ignite/blob/d2e6535d/modules/platforms/cpp/common/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/exports.cpp b/modules/platforms/cpp/common/src/exports.cpp
index fff2a16..93fd337 100644
--- a/modules/platforms/cpp/common/src/exports.cpp
+++ b/modules/platforms/cpp/common/src/exports.cpp
@@ -66,11 +66,11 @@ extern "C" {
         return ctx->ProcessorGetOrCreateCache(static_cast<jobject>(obj), name);
     }
 
-    void* IGNITE_CALL IgniteProcessorCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long memPtr) {
+    void* IGNITE_CALL IgniteProcessorCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr) {
         return ctx->ProcessorCreateCacheFromConfig(static_cast<jobject>(obj), memPtr);
     }
 
-    void* IGNITE_CALL IgniteProcessorGetOrCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long memPtr) {
+    void* IGNITE_CALL IgniteProcessorGetOrCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr) {
         return ctx->ProcessorGetOrCreateCacheFromConfig(static_cast<jobject>(obj), memPtr);
     }
 
@@ -122,7 +122,7 @@ extern "C" {
         return ctx->ProcessorAtomicReference(static_cast<jobject>(obj), name, memPtr, create);
     }
 
-	void IGNITE_CALL IgniteProcessorGetIgniteConfiguration(gcj::JniContext* ctx, void* obj, long memPtr) {
+	void IGNITE_CALL IgniteProcessorGetIgniteConfiguration(gcj::JniContext* ctx, void* obj, long long memPtr) {
         return ctx->ProcessorGetIgniteConfiguration(static_cast<jobject>(obj), memPtr);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d2e6535d/modules/platforms/cpp/common/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/java.cpp b/modules/platforms/cpp/common/src/java.cpp
index 8fc2293..89f4713 100644
--- a/modules/platforms/cpp/common/src/java.cpp
+++ b/modules/platforms/cpp/common/src/java.cpp
@@ -1166,7 +1166,7 @@ namespace ignite
                 return LocalToGlobal(env, cache);
             }
 
-            jobject JniContext::ProcessorCacheFromConfig0(jobject obj, long memPtr, jmethodID mthd, JniErrorInfo* errInfo)
+            jobject JniContext::ProcessorCacheFromConfig0(jobject obj, long long memPtr, jmethodID mthd, JniErrorInfo* errInfo)
             {
                 JNIEnv* env = Attach();
 
@@ -1221,20 +1221,20 @@ namespace ignite
                 ExceptionCheck(env, errInfo);
             }
 
-            jobject JniContext::ProcessorCreateCacheFromConfig(jobject obj, long memPtr) {
+            jobject JniContext::ProcessorCreateCacheFromConfig(jobject obj, long long memPtr) {
                 return ProcessorCreateCacheFromConfig(obj, memPtr, NULL);
             }
 
-            jobject JniContext::ProcessorCreateCacheFromConfig(jobject obj, long memPtr, JniErrorInfo* errInfo)
+            jobject JniContext::ProcessorCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo)
             {
                 return ProcessorCacheFromConfig0(obj, memPtr, jvm->GetMembers().m_PlatformProcessor_createCacheFromConfig, errInfo);
             }
 
-            jobject JniContext::ProcessorGetOrCreateCacheFromConfig(jobject obj, long memPtr) {
+            jobject JniContext::ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr) {
                 return ProcessorGetOrCreateCacheFromConfig(obj, memPtr, NULL);
             }
 
-            jobject JniContext::ProcessorGetOrCreateCacheFromConfig(jobject obj, long memPtr, JniErrorInfo* errInfo)
+            jobject JniContext::ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo)
             {
                 return ProcessorCacheFromConfig0(obj, memPtr, jvm->GetMembers().m_PlatformProcessor_getOrCreateCacheFromConfig, errInfo);
             }
@@ -1379,7 +1379,7 @@ namespace ignite
                 return LocalToGlobal(env, res);
             }
 
-            void JniContext::ProcessorGetIgniteConfiguration(jobject obj, long memPtr)
+            void JniContext::ProcessorGetIgniteConfiguration(jobject obj, long long memPtr)
             {
                 JNIEnv* env = Attach();
 


[09/13] ignite git commit: IGNITE-2249 - Do not deserialize services on client node

Posted by vo...@apache.org.
IGNITE-2249 - Do not deserialize services on client node


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

Branch: refs/heads/ignite-1786
Commit: 7d5f77e2f9ad80ec298b96452e5f55f737a01701
Parents: 2ad4b5c
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Wed Feb 17 18:21:54 2016 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Wed Feb 17 18:21:54 2016 -0800

----------------------------------------------------------------------
 .../ignite/internal/MarshallerContextImpl.java  |   3 +-
 .../binary/CacheObjectBinaryProcessorImpl.java  |   3 +-
 .../CacheDataStructuresManager.java             |   4 +-
 .../continuous/CacheContinuousQueryHandler.java |  21 ++-
 .../continuous/CacheContinuousQueryManager.java |  18 ++-
 .../datastructures/DataStructuresProcessor.java |   1 +
 .../service/GridServiceProcessor.java           | 101 ++++++++++++-
 .../processors/service/GridServiceProxy.java    |  22 +--
 .../GridServiceSerializationSelfTest.java       | 149 +++++++++++++++++++
 .../testsuites/IgniteKernalSelfTestSuite.java   |   2 +
 .../hadoop/jobtracker/HadoopJobTracker.java     |   5 +-
 11 files changed, 287 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index e3f2bc9..05fe8ef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -83,7 +83,8 @@ public class MarshallerContextImpl extends MarshallerContextAdapter {
             new ContinuousQueryListener(ctx.log(MarshallerContextImpl.class), workDir),
             null,
             ctx.cache().marshallerCache().context().affinityNode(),
-            true
+            true,
+            false
         );
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index e0da8d1..624a453 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -277,7 +277,8 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
                 new MetaDataEntryListener(),
                 new MetaDataEntryFilter(),
                 false,
-                true);
+                true,
+                false);
 
             while (true) {
                 ClusterNode oldestSrvNode =

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/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 47c3dd9..b42e5e7 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
@@ -37,7 +37,6 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
 import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.cluster.ClusterTopologyException;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -285,7 +284,8 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
                     },
                     new QueueHeaderPredicate(),
                     cctx.isLocal() || (cctx.isReplicated() && cctx.affinityNode()),
-                    true);
+                    true,
+                    false);
             }
 
             GridCacheQueueProxy queue = queuesMap.get(hdr.id());

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index 08fe62a..0324e41 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -151,6 +151,9 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
     /** */
     private AffinityTopologyVersion initTopVer;
 
+    /** */
+    private transient boolean ignoreClassNotFound;
+
     /**
      * Required by {@link Externalizable}.
      */
@@ -188,7 +191,8 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
         int taskHash,
         boolean skipPrimaryCheck,
         boolean locCache,
-        boolean keepBinary) {
+        boolean keepBinary,
+        boolean ignoreClassNotFound) {
         assert topic != null;
         assert locLsnr != null;
 
@@ -205,6 +209,7 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
         this.skipPrimaryCheck = skipPrimaryCheck;
         this.locCache = locCache;
         this.keepBinary = keepBinary;
+        this.ignoreClassNotFound = ignoreClassNotFound;
 
         cacheId = CU.cacheId(cacheName);
     }
@@ -566,6 +571,8 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
 
         final GridCacheContext cctx = cacheContext(ctx);
 
+        Collection<CacheContinuousQueryEntry> entries0 = new ArrayList<>();
+
         for (CacheContinuousQueryEntry e : entries) {
             GridCacheDeploymentManager depMgr = cctx.deploy();
 
@@ -582,19 +589,19 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
 
             try {
                 e.unmarshal(cctx, ldr);
+
+                entries0.addAll(handleEvent(ctx, e));
             }
             catch (IgniteCheckedException ex) {
-                U.error(ctx.log(getClass()), "Failed to unmarshal entry.", ex);
+                if (ignoreClassNotFound)
+                    assert internal;
+                else
+                    U.error(ctx.log(getClass()), "Failed to unmarshal entry.", ex);
             }
         }
 
         final IgniteCache cache = cctx.kernalContext().cache().jcache(cctx.name());
 
-        Collection<CacheContinuousQueryEntry> entries0 = new ArrayList<>();
-
-        for (CacheContinuousQueryEntry e : entries)
-            entries0.addAll(handleEvent(ctx, e));
-
         if (!entries0.isEmpty()) {
             Iterable<CacheEntryEvent<? extends K, ? extends V>> evts = F.viewReadOnly(entries0,
                 new C1<CacheContinuousQueryEntry, CacheEntryEvent<? extends K, ? extends V>>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index 840a61b..409c1da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -433,7 +433,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
             false,
             true,
             loc,
-            keepBinary);
+            keepBinary,
+            false);
     }
 
     /**
@@ -447,7 +448,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
     public UUID executeInternalQuery(CacheEntryUpdatedListener<?, ?> locLsnr,
         CacheEntryEventSerializableFilter rmtFilter,
         boolean loc,
-        boolean notifyExisting)
+        boolean notifyExisting,
+        boolean ignoreClassNotFound)
         throws IgniteCheckedException
     {
         return executeQuery0(
@@ -462,7 +464,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
             false,
             true,
             loc,
-            false);
+            false,
+            ignoreClassNotFound);
     }
 
     /**
@@ -560,7 +563,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
         boolean sync,
         boolean ignoreExpired,
         boolean loc,
-        final boolean keepBinary) throws IgniteCheckedException
+        final boolean keepBinary,
+        boolean ignoreClassNotFound) throws IgniteCheckedException
     {
         cctx.checkSecurity(SecurityPermission.CACHE_READ);
 
@@ -582,7 +586,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
             taskNameHash,
             skipPrimaryCheck,
             cctx.isLocal(),
-            keepBinary);
+            keepBinary,
+            ignoreClassNotFound);
 
         IgnitePredicate<ClusterNode> pred = (loc || cctx.config().getCacheMode() == CacheMode.LOCAL) ?
             F.nodeForNodeId(cctx.localNodeId()) : F.<ClusterNode>alwaysTrue();
@@ -790,7 +795,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
                 cfg.isSynchronous(),
                 false,
                 false,
-                keepBinary);
+                keepBinary,
+                false);
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/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 98848ee..445fc3e 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
@@ -248,6 +248,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
                     qryId = dsCacheCtx.continuousQueries().executeInternalQuery(new DataStructuresEntryListener(),
                         new DataStructuresEntryFilter(),
                         dsCacheCtx.isReplicated() && dsCacheCtx.affinityNode(),
+                        false,
                         false);
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 2841083..1a48e8c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -44,8 +44,10 @@ import org.apache.ignite.configuration.DeploymentMode;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.GridClosureCallMode;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
+import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
@@ -58,21 +60,26 @@ import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.processors.cache.query.CacheQuery;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.LT;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteCallable;
 import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.resources.IgniteInstanceResource;
 import org.apache.ignite.services.Service;
 import org.apache.ignite.services.ServiceConfiguration;
 import org.apache.ignite.services.ServiceDescriptor;
@@ -166,11 +173,13 @@ public class GridServiceProcessor extends GridProcessorAdapter {
             if (ctx.deploy().enabled())
                 ctx.cache().context().deploy().ignoreOwnership(true);
 
+            boolean affNode = cache.context().affinityNode();
+
             cfgQryId = cache.context().continuousQueries().executeInternalQuery(
-                new DeploymentListener(), null, cache.context().affinityNode(), true);
+                new DeploymentListener(), null, affNode, true, !affNode);
 
             assignQryId = cache.context().continuousQueries().executeInternalQuery(
-                new AssignmentListener(), null, cache.context().affinityNode(), true);
+                new AssignmentListener(), null, affNode, true, !affNode);
         }
         finally {
             if (ctx.deploy().enabled())
@@ -544,6 +553,38 @@ public class GridServiceProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @param name Service name.
+     * @return Service topology.
+     */
+    public Map<UUID, Integer> serviceTopology(String name) throws IgniteCheckedException {
+        ClusterNode node = cache.affinity().mapKeyToNode(name);
+
+        if (node.version().compareTo(ServiceTopologyCallable.SINCE_VER) >= 0) {
+            return ctx.closure().callAsyncNoFailover(
+                GridClosureCallMode.BALANCE,
+                new ServiceTopologyCallable(name),
+                Collections.singletonList(node),
+                false
+            ).get();
+        }
+        else
+            return serviceTopology(cache, name);
+    }
+
+    /**
+     * @param cache Utility cache.
+     * @param svcName Service name.
+     * @return Service topology.
+     * @throws IgniteCheckedException In case of error.
+     */
+    private static Map<UUID, Integer> serviceTopology(IgniteInternalCache<Object, Object> cache, String svcName)
+        throws IgniteCheckedException {
+        GridServiceAssignments val = (GridServiceAssignments)cache.get(new GridServiceAssignmentsKey(svcName));
+
+        return val != null ? val.assigns() : null;
+    }
+
+    /**
      * @return Collection of service descriptors.
      */
     public Collection<ServiceDescriptor> serviceDescriptors() {
@@ -1069,7 +1110,17 @@ public class GridServiceProcessor extends GridProcessorAdapter {
                         if (!(e.getKey() instanceof GridServiceDeploymentKey))
                             continue;
 
-                        GridServiceDeployment dep = (GridServiceDeployment)e.getValue();
+                        GridServiceDeployment dep;
+
+                        try {
+                            dep = (GridServiceDeployment)e.getValue();
+                        }
+                        catch (IgniteException ex) {
+                            if (X.hasCause(ex, ClassNotFoundException.class))
+                                continue;
+                            else
+                                throw ex;
+                        }
 
                         if (dep != null) {
                             svcName.set(dep.configuration().getName());
@@ -1346,7 +1397,17 @@ public class GridServiceProcessor extends GridProcessorAdapter {
                         if (!(e.getKey() instanceof GridServiceAssignmentsKey))
                             continue;
 
-                        GridServiceAssignments assigns = (GridServiceAssignments)e.getValue();
+                        GridServiceAssignments assigns;
+
+                        try {
+                            assigns = (GridServiceAssignments)e.getValue();
+                        }
+                        catch (IgniteException ex) {
+                            if (X.hasCause(ex, ClassNotFoundException.class))
+                                continue;
+                            else
+                                throw ex;
+                        }
 
                         if (assigns != null) {
                             svcName.set(assigns.name());
@@ -1467,4 +1528,34 @@ public class GridServiceProcessor extends GridProcessorAdapter {
             return S.toString(ServiceAssignmentsPredicate.class, this);
         }
     }
-}
\ No newline at end of file
+
+    /**
+     */
+    @GridInternal
+    private static class ServiceTopologyCallable implements IgniteCallable<Map<UUID, Integer>> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private static final IgniteProductVersion SINCE_VER = IgniteProductVersion.fromString("1.5.7");
+
+        /** */
+        private final String svcName;
+
+        /** */
+        @IgniteInstanceResource
+        private IgniteEx ignite;
+
+        /**
+         * @param svcName Service name.
+         */
+        public ServiceTopologyCallable(String svcName) {
+            this.svcName = svcName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<UUID, Integer> call() throws Exception {
+            return serviceTopology(ignite.context().cache().utilityCache(), svcName);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
index e54ec7b..6bec8ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
@@ -47,7 +47,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteCallable;
 import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.services.ServiceDescriptor;
 import org.jsr166.ThreadLocalRandom8;
 
 import static org.apache.ignite.internal.GridClosureCallMode.BALANCE;
@@ -210,7 +209,7 @@ class GridServiceProxy<T> implements Serializable {
          * @param name Service name.
          * @return Node with deployed service or {@code null} if there is no such node.
          */
-        private ClusterNode nodeForService(String name, boolean sticky) {
+        private ClusterNode nodeForService(String name, boolean sticky) throws IgniteCheckedException {
             do { // Repeat if reference to remote node was changed.
                 if (sticky) {
                     ClusterNode curNode = rmtNode.get();
@@ -237,11 +236,11 @@ class GridServiceProxy<T> implements Serializable {
          * @return Local node if it has a given service deployed or randomly chosen remote node,
          * otherwise ({@code null} if given service is not deployed on any node.
          */
-        private ClusterNode randomNodeForService(String name) {
+        private ClusterNode randomNodeForService(String name) throws IgniteCheckedException {
             if (hasLocNode && ctx.service().service(name) != null)
                 return ctx.discovery().localNode();
 
-            Map<UUID, Integer> snapshot = serviceTopology(name);
+            Map<UUID, Integer> snapshot = ctx.service().serviceTopology(name);
 
             if (snapshot == null || snapshot.isEmpty())
                 return null;
@@ -307,19 +306,6 @@ class GridServiceProxy<T> implements Serializable {
 
             return null;
         }
-
-        /**
-         * @param name Service name.
-         * @return Map of number of service instances per node ID.
-         */
-        private Map<UUID, Integer> serviceTopology(String name) {
-            for (ServiceDescriptor desc : ctx.service().serviceDescriptors()) {
-                if (desc.name().equals(name))
-                    return desc.topologySnapshot();
-            }
-
-            return null;
-        }
     }
 
     /**
@@ -403,4 +389,4 @@ class GridServiceProxy<T> implements Serializable {
             return S.toString(ServiceProxyCallable.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceSerializationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceSerializationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceSerializationSelfTest.java
new file mode 100644
index 0000000..f709dfe
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceSerializationSelfTest.java
@@ -0,0 +1,149 @@
+/*
+ * 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.service;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceContext;
+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.apache.ignite.thread.IgniteThread;
+
+/**
+ * Service serialization test.
+ */
+public class GridServiceSerializationSelfTest 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.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testServiceSerialization() throws Exception {
+        try {
+            Ignite server = startGridsMultiThreaded(3);
+
+            Ignition.setClientMode(true);
+
+            Ignite client = startGrid("client");
+
+            server.services(server.cluster().forServers())
+                .deployClusterSingleton("my-service", new MyServiceImpl());
+
+            MyService svc = client.services().serviceProxy("my-service", MyService.class, false);
+
+            svc.hello();
+
+            assert MyServiceImpl.latch.await(2000, TimeUnit.MILLISECONDS);
+
+            assertEquals(0, MyServiceImpl.cnt.get());
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     */
+    private static interface MyService extends Service {
+        /** */
+        void hello();
+    }
+
+    /**
+     */
+    private static class MyServiceImpl implements MyService, Externalizable {
+        /** */
+        static final AtomicInteger cnt = new AtomicInteger();
+
+        /** */
+        static final CountDownLatch latch = new CountDownLatch(1);
+
+        /**
+         */
+        public MyServiceImpl() throws ClassNotFoundException {
+            if (clientThread())
+                throw new ClassNotFoundException("Expected ClassNotFoundException");
+        }
+
+        /** {@inheritDoc} */
+        @Override public void cancel(ServiceContext ctx) {
+            if (clientThread())
+                cnt.incrementAndGet();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void init(ServiceContext ctx) throws Exception {
+            if (clientThread())
+                cnt.incrementAndGet();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void execute(ServiceContext ctx) throws Exception {
+            if (clientThread())
+                cnt.incrementAndGet();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void hello() {
+            if (clientThread())
+                cnt.incrementAndGet();
+
+            latch.countDown();
+        }
+
+        /**
+         * @return If current thread belongs to client.
+         */
+        private boolean clientThread() {
+            assert Thread.currentThread() instanceof IgniteThread;
+
+            return ((IgniteThread)Thread.currentThread()).getGridName().contains("client");
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            // No-op.
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index d9e9b0f..214d375 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@ -54,6 +54,7 @@ import org.apache.ignite.internal.processors.service.GridServiceProcessorProxySe
 import org.apache.ignite.internal.processors.service.GridServiceProcessorSingleNodeSelfTest;
 import org.apache.ignite.internal.processors.service.GridServiceProcessorStopSelfTest;
 import org.apache.ignite.internal.processors.service.GridServiceReassignmentSelfTest;
+import org.apache.ignite.internal.processors.service.GridServiceSerializationSelfTest;
 import org.apache.ignite.internal.processors.service.ServicePredicateAccessCacheTest;
 import org.apache.ignite.internal.util.GridStartupWithSpecifiedWorkDirectorySelfTest;
 import org.apache.ignite.internal.util.GridStartupWithUndefinedIgniteHomeSelfTest;
@@ -123,6 +124,7 @@ public class IgniteKernalSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridServiceProcessorStopSelfTest.class);
         suite.addTestSuite(ServicePredicateAccessCacheTest.class);
         suite.addTestSuite(GridServicePackagePrivateSelfTest.class);
+        suite.addTestSuite(GridServiceSerializationSelfTest.class);
 
         return suite;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5f77e2/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
index 81ff8ea..f4cf892 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
@@ -255,7 +255,8 @@ public class HadoopJobTracker extends HadoopComponent {
             },
             null,
             true,
-            true
+            true,
+            false
         );
 
         ctx.kernalContext().event().addLocalEventListener(new GridLocalEventListener() {
@@ -1690,4 +1691,4 @@ public class HadoopJobTracker extends HadoopComponent {
          */
         protected abstract void update(HadoopJobMetadata meta, HadoopJobMetadata cp);
     }
-}
\ No newline at end of file
+}