You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/10/16 22:53:26 UTC

[01/11] ignite git commit: ignite-1635, ignite-1616 Added unit-tests for the bugs.

Repository: ignite
Updated Branches:
  refs/heads/ignite-1093-2 9d64c7fbc -> 3d1a95fd6


ignite-1635, ignite-1616 Added unit-tests for the bugs.


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

Branch: refs/heads/ignite-1093-2
Commit: 077af17f7e62ed1c4d0f699c9fd39b9d8161ae1f
Parents: 3a29b97
Author: ashutak <as...@gridgain.com>
Authored: Thu Oct 15 16:58:23 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Oct 15 16:58:23 2015 +0300

----------------------------------------------------------------------
 .../CacheAbstractRestartSelfTest.java           | 247 +++++++++++++++++++
 ...NearDisabledAtomicInvokeRestartSelfTest.java | 179 ++++++++++++++
 ...abledTransactionalInvokeRestartSelfTest.java | 173 +++++++++++++
 ...edTransactionalWriteReadRestartSelfTest.java | 124 ++++++++++
 .../IgniteCacheLoadConsistencyTestSuite.java    |  42 ++++
 5 files changed, 765 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/077af17f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAbstractRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAbstractRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAbstractRestartSelfTest.java
new file mode 100644
index 0000000..7537af1
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAbstractRestartSelfTest.java
@@ -0,0 +1,247 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import java.util.ArrayList;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.testframework.GridTestUtils;
+
+/**
+ * Abstract restart test.
+ */
+public abstract class CacheAbstractRestartSelfTest extends IgniteCacheAbstractTest {
+    /** */
+    private volatile CountDownLatch cacheCheckedLatch = new CountDownLatch(1);
+
+    /** */
+    private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(true);
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        if (gridName.equals(getTestGridName(gridCount() - 1)))
+            cfg.setClientMode(true);
+
+        cfg.setPeerClassLoadingEnabled(false);
+
+        ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return 8 * 60_000;
+    }
+
+    /**
+     * @return Number of updaters threads.
+     */
+    protected int updatersNumber() {
+        return 64;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRestart() throws Exception {
+        final int clientGrid = gridCount() - 1;
+
+        assertTrue(ignite(clientGrid).configuration().isClientMode());
+
+        final IgniteEx grid = grid(clientGrid);
+
+        final IgniteCache cache = jcache(clientGrid);
+
+        updateCache(grid, cache);
+
+        final AtomicBoolean stop = new AtomicBoolean();
+
+        ArrayList<IgniteInternalFuture> updaterFuts = new ArrayList<>();
+
+        for (int i = 0; i < updatersNumber(); i++) {
+            final int threadIdx = i;
+
+            IgniteInternalFuture<?> updateFut = GridTestUtils.runAsync(new Callable<Void>() {
+                @Override public Void call() throws Exception {
+                    Thread.currentThread().setName("update-thread-" + threadIdx);
+
+                    assertTrue(cacheCheckedLatch.await(30_000, TimeUnit.MILLISECONDS));
+
+                    int iter = 0;
+
+                    while (!stop.get()) {
+                        log.info("Start update: " + iter);
+
+                        rwl.readLock().lock();
+
+                        try {
+                            updateCache(grid, cache);
+                        }
+                        finally {
+                            rwl.readLock().unlock();
+                        }
+
+                        log.info("End update: " + iter++);
+                    }
+
+                    log.info("Update iterations: " + iter);
+
+                    return null;
+                }
+            });
+
+            updaterFuts.add(updateFut);
+        }
+
+        IgniteInternalFuture<?> restartFut = GridTestUtils.runAsync(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                Thread.currentThread().setName("restart-thread");
+
+                ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+                while (!stop.get()) {
+                    assertTrue(cacheCheckedLatch.await(30_000, TimeUnit.MILLISECONDS));
+
+                    int node = rnd.nextInt(0, gridCount() - 1);
+
+                    log.info("Stop node: " + node);
+
+                    stopGrid(node);
+
+                    U.sleep(restartSleep());
+
+                    log.info("Start node: " + node);
+
+                    startGrid(node);
+
+                    cacheCheckedLatch = new CountDownLatch(1);
+
+                    U.sleep(restartDelay());
+
+                    awaitPartitionMapExchange();
+                }
+
+                return null;
+            }
+        });
+
+        long endTime = System.currentTimeMillis() + getTestDuration();
+
+        try {
+            int iter = 0;
+
+            while (System.currentTimeMillis() < endTime && !isAnyDone(updaterFuts) && !restartFut.isDone()) {
+                try {
+                    log.info("Start of cache checking: " + iter);
+
+                    rwl.writeLock().lock();
+
+                    try {
+                        checkCache(grid, cache);
+                    }
+                    finally {
+                        rwl.writeLock().unlock();
+                    }
+
+                    log.info("End of cache checking: " + iter++);
+                }
+                finally {
+                    cacheCheckedLatch.countDown();
+                }
+            }
+
+            log.info("Checking iteration: " + iter);
+        }
+        finally {
+            cacheCheckedLatch.countDown();
+
+            stop.set(true);
+        }
+
+        for (IgniteInternalFuture fut : updaterFuts)
+            fut.get();
+
+        restartFut.get();
+
+        checkCache(grid, cache);
+    }
+
+    /**
+     * @return Test duration.
+     * @see #getTestTimeout()
+     */
+    protected int getTestDuration() {
+        return 60_000;
+    }
+
+    /**
+     * @return Restart sleep in milliseconds.
+     */
+    private int restartSleep() {
+        return 100;
+    }
+
+    /**
+     * @return Restart delay in milliseconds.
+     */
+    private int restartDelay() {
+        return 100;
+    }
+
+    /**
+     * Checks cache in one thread. All update operations are not executed.
+     *
+     * @param cache Cache.
+     */
+    protected abstract void checkCache(IgniteEx grid, IgniteCache cache) throws Exception ;
+
+    /**
+     * Updates cache in many threads.
+     *
+     * @param grid Grid.
+     * @param cache Cache.
+     */
+    protected abstract void updateCache(IgniteEx grid, IgniteCache cache) throws Exception ;
+
+    /**
+     * @param futs Futers.
+     * @return {@code True} if all futures are done.
+     */
+    private static boolean isAnyDone(ArrayList<IgniteInternalFuture> futs) {
+        for (IgniteInternalFuture fut : futs) {
+            if (fut.isDone())
+                return true;
+        }
+
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/077af17f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledAtomicInvokeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledAtomicInvokeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledAtomicInvokeRestartSelfTest.java
new file mode 100644
index 0000000..90427f5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledAtomicInvokeRestartSelfTest.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Invoke retry consistency test.
+ */
+public class CacheNearDisabledAtomicInvokeRestartSelfTest extends CacheAbstractRestartSelfTest {
+    /** */
+    public static final int RANGE = 50;
+
+    /** */
+    private static final long FIRST_VAL = 1;
+
+    /** */
+    private final ConcurrentMap<String, AtomicLong> nextValMap = new ConcurrentHashMap<>();
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+        return CacheAtomicWriteOrderMode.PRIMARY;
+    }
+
+    /** */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    protected void checkCache(IgniteEx ignite, IgniteCache cache) throws Exception {
+        log.info("Start cache validation.");
+
+        long startTime = U.currentTimeMillis();
+
+        Map<String, Set> badCacheEntries = new HashMap<>();
+
+        for (Map.Entry<String, AtomicLong> e : nextValMap.entrySet()) {
+            String key = e.getKey();
+
+            Set set = (Set)cache.get(key);
+
+            if (set == null || e.getValue() == null || !Objects.equals(e.getValue().get(), (long)set.size()))
+                badCacheEntries.put(key, set);
+        }
+
+        if (!badCacheEntries.isEmpty()) {
+            // Print all usefull information and finish.
+            for (Map.Entry<String, Set> e : badCacheEntries.entrySet()) {
+                String key = e.getKey();
+
+                U.error(log, "Got unexpected set size [key='" + key + "', expSize=" + nextValMap.get(key)
+                    + ", cacheVal=" + e.getValue() + "]");
+            }
+
+            log.info("Next values map contant:");
+            for (Map.Entry<String, AtomicLong> e : nextValMap.entrySet())
+                log.info("Map Entry [key=" + e.getKey() + ", val=" + e.getValue() + "]");
+
+            log.info("Cache content:");
+
+            for (int k2 = 0; k2 < RANGE; k2++) {
+                String key2 = "key-" + k2;
+
+                Object val = cache.get(key2);
+
+                if (val != null)
+                    log.info("Cache Entry [key=" + key2 + ", val=" + val + "]");
+
+            }
+
+            fail("Cache and local map are in inconsistent state [badKeys=" + badCacheEntries.keySet() + ']');
+        }
+
+        log.info("Clearing all data.");
+
+        cache.removeAll();
+        nextValMap.clear();
+
+        log.info("Cache validation successfully finished in "
+            + (U.currentTimeMillis() - startTime) / 1000 + " sec.");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void updateCache(IgniteEx ignite, IgniteCache cache) {
+        final int k = ThreadLocalRandom.current().nextInt(RANGE);
+
+        String key = "key-" + k;
+
+        AtomicLong nextAtomicVal = nextValMap.putIfAbsent(key, new AtomicLong(FIRST_VAL));
+
+        Long nextVal = FIRST_VAL;
+
+        if (nextAtomicVal != null)
+            nextVal = nextAtomicVal.incrementAndGet();
+
+        cache.invoke(key, new AddInSetEntryProcessor(), nextVal);
+    }
+
+    /**
+     */
+    private static class AddInSetEntryProcessor implements CacheEntryProcessor<String, Set, Object> {
+        /** */
+        private static final long serialVersionUID = 0;
+
+        /** {@inheritDoc} */
+        @Override public Object process(MutableEntry<String, Set> entry,
+            Object... arguments) throws EntryProcessorException {
+            assert !F.isEmpty(arguments);
+
+            Object val = arguments[0];
+
+            Set set;
+
+            if (!entry.exists())
+                set = new HashSet<>();
+            else
+                set = entry.getValue();
+
+            set.add(val);
+
+            entry.setValue(set);
+
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/077af17f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalInvokeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalInvokeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalInvokeRestartSelfTest.java
new file mode 100644
index 0000000..f4eea6c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalInvokeRestartSelfTest.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Invoke retry consistency test.
+ */
+public class CacheNearDisabledTransactionalInvokeRestartSelfTest extends CacheAbstractRestartSelfTest {
+    /** */
+    public static final int RANGE = 100;
+
+    /** */
+    private static final int KEYS_CNT = 5;
+
+    /** */
+    protected final ConcurrentMap<String, AtomicLong> map = new ConcurrentHashMap<>();
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+
+    /** */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    protected void checkCache(IgniteEx ignite, IgniteCache cache) {
+        log.info("Start cache validation.");
+
+        long startTime = U.currentTimeMillis();
+
+        Map<String, Long> notEqualsCacheVals = new HashMap<>();
+        Map<String, Long> notEqualsLocMapVals = new HashMap<>();
+
+        for (int k = 0; k < RANGE; k++) {
+            if (k % 10_000 == 0)
+                log.info("Start validation for keys like 'key-" + k + "-*'");
+
+            for (int i = 0; i < KEYS_CNT; i++) {
+                String key = "key-" + k + "-" + i;
+
+                Long cacheVal = (Long)cache.get(key);
+
+                AtomicLong aVal = map.get(key);
+                Long mapVal = aVal != null ? aVal.get() : null;
+
+                if (!Objects.equals(cacheVal, mapVal)) {
+                    notEqualsCacheVals.put(key, cacheVal);
+                    notEqualsLocMapVals.put(key, mapVal);
+                }
+            }
+        }
+
+        assert notEqualsCacheVals.size() == notEqualsLocMapVals.size() : "Invalid state " +
+            "[cacheMapVals=" + notEqualsCacheVals + ", mapVals=" + notEqualsLocMapVals + "]";
+
+        if (!notEqualsCacheVals.isEmpty()) {
+            // Print all usefull information and finish.
+            for (Map.Entry<String, Long> eLocMap : notEqualsLocMapVals.entrySet()) {
+                String key = eLocMap.getKey();
+                Long mapVal = eLocMap.getValue();
+                Long cacheVal = notEqualsCacheVals.get(key);
+
+                U.error(log, "Got different values [key='" + key
+                    + "', cacheVal=" + cacheVal + ", localMapVal=" + mapVal + "]");
+            }
+
+            log.info("Local driver map contant:\n " + map);
+
+            log.info("Cache content:");
+
+            for (int k2 = 0; k2 < RANGE; k2++) {
+                for (int i2 = 0; i2 < KEYS_CNT; i2++) {
+                    String key2 = "key-" + k2 + "-" + i2;
+
+                    Long val = (Long)cache.get(key2);
+
+                    if (val != null)
+                        log.info("Entry [key=" + key2 + ", val=" + val + "]");
+                }
+            }
+
+            throw new IllegalStateException("Cache and local map are in inconsistent state [badKeys="
+                + notEqualsCacheVals.keySet() + ']');
+        }
+
+        log.info("Cache validation successfully finished in "
+            + (U.currentTimeMillis() - startTime) / 1000 + " sec.");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void updateCache(IgniteEx ignite, IgniteCache cache) {
+        final int k = ThreadLocalRandom.current().nextInt(RANGE);
+
+        final String[] keys = new String[KEYS_CNT];
+
+        for (int i = 0; i < keys.length; i++)
+            keys[i] = "key-" + k + "-" + i;
+
+        for (String key : keys) {
+            cache.invoke(key, new IncrementCacheEntryProcessor());
+
+            AtomicLong prevVal = map.putIfAbsent(key, new AtomicLong(0));
+
+            if (prevVal != null)
+                prevVal.incrementAndGet();
+        }
+    }
+
+    /**
+     */
+    private static class IncrementCacheEntryProcessor implements CacheEntryProcessor<String, Long, Long> {
+        /** */
+        private static final long serialVersionUID = 0;
+
+        /** {@inheritDoc} */
+        @Override public Long process(MutableEntry<String, Long> entry,
+            Object... arguments) throws EntryProcessorException {
+            long newVal = entry.getValue() == null ? 0 : entry.getValue() + 1;
+
+            entry.setValue(newVal);
+
+            return newVal;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/077af17f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalWriteReadRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalWriteReadRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalWriteReadRestartSelfTest.java
new file mode 100644
index 0000000..875aef3
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalWriteReadRestartSelfTest.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Transactional write read consistency test.
+ */
+public class CacheNearDisabledTransactionalWriteReadRestartSelfTest extends CacheAbstractRestartSelfTest{
+    /** */
+    public static final int RANGE = 100;
+
+    /** */
+    private static final int KEYS_CNT = 5;
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+
+    /** */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void checkCache(IgniteEx ignite, IgniteCache cache) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void updateCache(IgniteEx ignite, IgniteCache cache) throws Exception {
+        final int k = ThreadLocalRandom.current().nextInt(RANGE);
+
+        final String[] keys = new String[KEYS_CNT];
+
+        for (int i = 0; i < keys.length; i++)
+            keys[i] = "key-" + k + "-" + i;
+
+        doInTransaction(ignite, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                Map<String, Long> map = new HashMap<>();
+
+                for (String key : keys) {
+                    Long val = (Long)cache.get(key);
+
+                    map.put(key, val);
+                }
+
+                Set<Long> values = new HashSet<>(map.values());
+
+                if (values.size() != 1) {
+                    // Print all usefull information and finish.
+                    U.error(log, "Got different values for keys [map=" + map + "]");
+
+                    log.info("Cache content:");
+
+                    for (int k = 0; k < RANGE; k++) {
+                        for (int i = 0; i < KEYS_CNT; i++) {
+                            String key = "key-" + k + "-" + i;
+
+                            Long val = (Long)cache.get(key);
+
+                            if (val != null)
+                                log.info("Entry [key=" + key + ", val=" + val + "]");
+                        }
+                    }
+
+                    throw new IllegalStateException("Found different values for keys (see above information) [map="
+                        + map + ']');
+                }
+
+                final Long oldVal = map.get(keys[0]);
+
+                final Long newVal = oldVal == null ? 0 : oldVal + 1;
+
+                for (String key : keys)
+                    cache.put(key, newVal);
+
+                return null;
+            }
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/077af17f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheLoadConsistencyTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheLoadConsistencyTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheLoadConsistencyTestSuite.java
new file mode 100644
index 0000000..cd0be9c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheLoadConsistencyTestSuite.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.distributed.CacheNearDisabledAtomicInvokeRestartSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheNearDisabledTransactionalInvokeRestartSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheNearDisabledTransactionalWriteReadRestartSelfTest;
+
+/**
+ * Test suite.
+ */
+public class IgniteCacheLoadConsistencyTestSuite extends TestSuite {
+    /**
+     * @return Ignite Cache Failover test suite.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Cache Load Consistency Test Suite");
+
+        suite.addTestSuite(CacheNearDisabledAtomicInvokeRestartSelfTest.class);
+        suite.addTestSuite(CacheNearDisabledTransactionalInvokeRestartSelfTest.class);
+        suite.addTestSuite(CacheNearDisabledTransactionalWriteReadRestartSelfTest.class);
+
+        return suite;
+    }
+}


[04/11] ignite git commit: IGNITE-1653

Posted by sb...@apache.org.
IGNITE-1653


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

Branch: refs/heads/ignite-1093-2
Commit: c4b0877f29c6e35c57491324837849c420f2b884
Parents: 3a29b97
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Oct 15 16:59:02 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Oct 15 16:59:02 2015 +0300

----------------------------------------------------------------------
 assembly/release-fabric-lgpl.xml                |  63 +++++
 assembly/release-hadoop-lgpl.xml                |  39 +++
 examples-lgpl/README.txt                        |  27 ++
 examples-lgpl/config/example-cache.xml          |  73 ++++++
 examples-lgpl/config/example-ignite.xml         |  83 +++++++
 examples-lgpl/config/filesystem/README.txt      |   8 +
 examples-lgpl/config/filesystem/core-site.xml   |  42 ++++
 .../config/filesystem/example-igfs.xml          | 151 ++++++++++++
 examples-lgpl/config/hibernate/README.txt       |   8 +
 .../hibernate/example-hibernate-L2-cache.xml    |  64 +++++
 examples-lgpl/config/servlet/README.txt         |   8 +
 examples-lgpl/config/servlet/WEB-INF/web.xml    |  36 +++
 examples-lgpl/pom-standalone.xml                | 141 +++++++++++
 examples-lgpl/pom.xml                           | 128 ++++++++++
 .../hibernate/HibernateL2CacheExample.java      | 245 +++++++++++++++++++
 .../examples/datagrid/hibernate/Post.java       | 130 ++++++++++
 .../examples/datagrid/hibernate/User.java       | 154 ++++++++++++
 .../datagrid/hibernate/package-info.java        |  22 ++
 .../hibernate/CacheHibernatePersonStore.java    | 122 +++++++++
 .../hibernate/CacheHibernateStoreExample.java   | 151 ++++++++++++
 .../datagrid/store/hibernate/Person.hbm.xml     |  34 +++
 .../datagrid/store/hibernate/hibernate.cfg.xml  |  41 ++++
 .../datagrid/store/hibernate/package-info.java  |  22 ++
 .../java8/cluster/ClusterGroupExample.java      |  86 +++++++
 .../examples/java8/cluster/package-info.java    |  22 ++
 .../java8/computegrid/ComputeAsyncExample.java  |  75 ++++++
 .../computegrid/ComputeBroadcastExample.java    | 102 ++++++++
 .../computegrid/ComputeCallableExample.java     |  75 ++++++
 .../computegrid/ComputeClosureExample.java      |  71 ++++++
 .../computegrid/ComputeRunnableExample.java     |  64 +++++
 .../java8/computegrid/package-info.java         |  22 ++
 .../java8/datagrid/CacheAffinityExample.java    | 137 +++++++++++
 .../java8/datagrid/CacheApiExample.java         | 105 ++++++++
 .../java8/datagrid/CacheAsyncApiExample.java    |  85 +++++++
 .../examples/java8/datagrid/package-info.java   |  22 ++
 .../IgniteExecutorServiceExample.java           |  70 ++++++
 .../java8/datastructures/package-info.java      |  22 ++
 .../examples/java8/events/EventsExample.java    | 135 ++++++++++
 .../examples/java8/events/package-info.java     |  22 ++
 .../java8/messaging/MessagingExample.java       | 166 +++++++++++++
 .../messaging/MessagingPingPongExample.java     | 113 +++++++++
 .../examples/java8/messaging/package-info.java  |  22 ++
 .../misc/schedule/ComputeScheduleExample.java   |  68 +++++
 .../java8/misc/schedule/package-info.java       |  22 ++
 .../ignite/examples/java8/package-info.java     |  23 ++
 .../streaming/StreamTransformerExample.java     | 101 ++++++++
 .../java8/streaming/StreamVisitorExample.java   | 172 +++++++++++++
 .../examples/java8/streaming/package-info.java  |  22 ++
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  31 +++
 .../HibernateL2CacheExampleSelfTest.java        |  33 +++
 .../IgniteLgplExamplesSelfTestSuite.java        |  48 ++++
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  29 +++
 .../HibernateL2CacheExampleSelfTest.java        |  37 +++
 .../IgniteLgplExamplesJ8SelfTestSuite.java      |  46 ++++
 examples/pom-standalone.xml                     |  12 -
 examples/pom.xml                                |  12 -
 .../hibernate/HibernateL2CacheExample.java      | 245 -------------------
 .../examples/datagrid/hibernate/Post.java       | 130 ----------
 .../examples/datagrid/hibernate/User.java       | 154 ------------
 .../datagrid/hibernate/package-info.java        |  22 --
 .../hibernate/CacheHibernatePersonStore.java    | 122 ---------
 .../hibernate/CacheHibernateStoreExample.java   | 151 ------------
 .../datagrid/store/hibernate/Person.hbm.xml     |  34 ---
 .../datagrid/store/hibernate/hibernate.cfg.xml  |  41 ----
 .../datagrid/store/hibernate/package-info.java  |  22 --
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  31 ---
 .../HibernateL2CacheExampleSelfTest.java        |  33 ---
 .../testsuites/IgniteExamplesSelfTestSuite.java |   4 -
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  29 ---
 .../HibernateL2CacheExampleSelfTest.java        |  37 ---
 pom.xml                                         |  65 ++++-
 71 files changed, 3904 insertions(+), 1080 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/assembly/release-fabric-lgpl.xml
----------------------------------------------------------------------
diff --git a/assembly/release-fabric-lgpl.xml b/assembly/release-fabric-lgpl.xml
new file mode 100644
index 0000000..b8757db
--- /dev/null
+++ b/assembly/release-fabric-lgpl.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
+          http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    <id>fabric</id>
+
+    <includeBaseDirectory>false</includeBaseDirectory>
+
+    <formats>
+        <format>dir</format>
+    </formats>
+
+    <files>
+        <file>
+            <source>examples-lgpl/pom-standalone.xml</source>
+            <outputDirectory>/examples-lgpl</outputDirectory>
+            <destName>pom.xml</destName>
+        </file>
+    </files>
+
+    <fileSets>
+        <fileSet>
+            <directory>examples-lgpl</directory>
+            <outputDirectory>/examples-lgpl</outputDirectory>
+            <includes>
+                <include>README.txt</include>
+            </includes>
+        </fileSet>
+
+        <fileSet>
+            <directory>examples-lgpl</directory>
+            <outputDirectory>/examples-lgpl</outputDirectory>
+            <includes>
+                <include>config/**</include>
+                <include>src/**</include>
+            </includes>
+            <excludes>
+                <exclude>**/package.html</exclude>
+                <exclude>pom-standalone.xml</exclude>
+                <exclude>src/test/**</exclude>
+            </excludes>
+        </fileSet>
+    </fileSets>
+</assembly>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/assembly/release-hadoop-lgpl.xml
----------------------------------------------------------------------
diff --git a/assembly/release-hadoop-lgpl.xml b/assembly/release-hadoop-lgpl.xml
new file mode 100644
index 0000000..ac2fc31
--- /dev/null
+++ b/assembly/release-hadoop-lgpl.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
+          http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    <id>fabric</id>
+
+    <includeBaseDirectory>false</includeBaseDirectory>
+
+    <formats>
+        <format>dir</format>
+    </formats>
+
+    <files>
+        <file>
+            <source>assembly/LICENSE_HADOOP</source><!--assembly should contain at least one file. copied from release-hadoop.xml -->
+            <destName>LICENSE</destName>
+            <outputDirectory>/</outputDirectory>
+        </file>
+    </files>
+</assembly>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/README.txt
----------------------------------------------------------------------
diff --git a/examples-lgpl/README.txt b/examples-lgpl/README.txt
new file mode 100644
index 0000000..8c8982e
--- /dev/null
+++ b/examples-lgpl/README.txt
@@ -0,0 +1,27 @@
+Apache Ignite LGPL Examples
+======================
+
+This folder contains code examples for various Apache Ignite functionality.
+
+Examples are shipped as a separate Maven project, so to start running you simply need
+to import provided `pom.xml` file into your favourite IDE.
+
+The examples folder contains he following subfolders:
+
+- `config` - contains Ignite configuration files needed for examples.
+- `src/main/java` - contains Java examples for different Ignite modules and features.
+- `src/main/java8` - contains additional set of Java examples utilizing Java 8 lambdas. These examples
+  are excluded by default, enable `java8-examples` Maven profile to include them (JDK8 is required).
+
+
+Starting Remote Nodes
+=====================
+
+Remote nodes for examples should always be started with special configuration file which enables P2P
+class loading: `examples/config/example-ignite.xml`. To run a remote node in IDE use `ExampleNodeStartup` class.
+
+
+Java7 vs Java8
+===============
+Some examples (not all) which can benefit from Java8 Lambda support were re-written with Java8 lambdas.
+For full set of examples, look at both Java7 and Java8 packages.

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/config/example-cache.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/config/example-cache.xml b/examples-lgpl/config/example-cache.xml
new file mode 100644
index 0000000..dcb8e75
--- /dev/null
+++ b/examples-lgpl/config/example-cache.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+<!--
+    Ignite Spring configuration file to startup Ignite cache.
+
+    This file demonstrates how to configure cache using Spring. Provided cache
+    will be created on node startup.
+
+    Use this configuration file when running HTTP REST examples (see 'examples/rest' folder).
+
+    When starting a standalone node, you need to execute the following command:
+    {IGNITE_HOME}/bin/ignite.{bat|sh} examples/config/example-cache.xml
+
+    When starting Ignite from Java IDE, pass path to this file to Ignition:
+    Ignition.start("examples/config/example-cache.xml");
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="cacheConfiguration">
+            <list>
+                <!-- Partitioned cache example configuration (Atomic mode). -->
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="atomicityMode" value="ATOMIC"/>
+                    <property name="backups" value="1"/>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <!--
+                        Ignite provides several options for automatic discovery that can be used
+                        instead os static IP based discovery. For information on all options refer
+                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
+                    -->
+                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <!-- In distributed environment, replace with actual host IP address. -->
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/config/example-ignite.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/config/example-ignite.xml b/examples-lgpl/config/example-ignite.xml
new file mode 100644
index 0000000..e870106
--- /dev/null
+++ b/examples-lgpl/config/example-ignite.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+<!--
+    Ignite configuration with all defaults and enabled p2p deployment and enabled events.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <!-- Set to true to enable distributed class loading for examples, default is false. -->
+        <property name="peerClassLoadingEnabled" value="true"/>
+
+        <property name="marshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
+                <!-- Set to false to allow non-serializable objects in examples, default is true. -->
+                <property name="requireSerializable" value="false"/>
+            </bean>
+        </property>
+
+        <!-- Enable task execution events for examples. -->
+        <property name="includeEventTypes">
+            <list>
+                <!--Task execution events-->
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
+
+                <!--Cache events-->
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <!--
+                        Ignite provides several options for automatic discovery that can be used
+                        instead os static IP based discovery. For information on all options refer
+                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
+                    -->
+                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <!-- In distributed environment, replace with actual host IP address. -->
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/config/filesystem/README.txt
----------------------------------------------------------------------
diff --git a/examples-lgpl/config/filesystem/README.txt b/examples-lgpl/config/filesystem/README.txt
new file mode 100644
index 0000000..4f6ae88
--- /dev/null
+++ b/examples-lgpl/config/filesystem/README.txt
@@ -0,0 +1,8 @@
+FileSystem Configuration Example
+--------------------------------
+
+This folder contains configuration files for IgniteFs examples located in
+org.apache.ignite.examples.igfs package.
+
+- example-igfs.xml file is used to start Apache Ignite nodes with IgniteFS configured
+- core-site.xml file is used to run Hadoop FS driver over IgniteFs

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/config/filesystem/core-site.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/config/filesystem/core-site.xml b/examples-lgpl/config/filesystem/core-site.xml
new file mode 100644
index 0000000..a7a027c
--- /dev/null
+++ b/examples-lgpl/config/filesystem/core-site.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+
+<!--
+  ~  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.
+  -->
+
+<!--
+    Example configuration of the Hadoop FS driver over Ignite FS API.
+    Copy this file into '$HADOOP_HOME/conf/core-site.xml'.
+-->
+<configuration>
+    <property>
+        <name>fs.default.name</name>
+        <value>igfs:///</value>
+    </property>
+
+    <property>
+        <!-- FS driver class for the 'igfs://' URIs. -->
+        <name>fs.igfs.impl</name>
+        <value>org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem</value>
+    </property>
+
+    <property>
+        <!-- FS driver class for the 'igfs://' URIs in Hadoop2.x -->
+        <name>fs.AbstractFileSystem.igfs.impl</name>
+        <value>org.apache.ignite.hadoop.fs.v2.IgniteHadoopFileSystem</value>
+    </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/config/filesystem/example-igfs.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/config/filesystem/example-igfs.xml b/examples-lgpl/config/filesystem/example-igfs.xml
new file mode 100644
index 0000000..d009d46
--- /dev/null
+++ b/examples-lgpl/config/filesystem/example-igfs.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+<!--
+    Ignite Spring configuration file to startup ignite cache.
+
+    When starting a standalone node, you need to execute the following command:
+    {IGNITE_HOME}/bin/ignite.{bat|sh} examples/config/filesystem/example-igfs.xml
+
+    When starting Ignite from Java IDE, pass path to this file into Ignition:
+    Ignition.start("examples/config/filesystem/example-igfs.xml");
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+       http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <!--
+        Optional description.
+    -->
+    <description>
+        Spring file for ignite configuration with client available endpoints.
+    </description>
+
+    <!--
+        Initialize property configurer so we can reference environment variables.
+    -->
+    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_FALLBACK"/>
+        <property name="searchSystemEnvironment" value="true"/>
+    </bean>
+
+    <!--
+        Configuration below demonstrates how to setup a IgniteFs node with file data.
+    -->
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <!-- Set to true to enable cluster-aware class loading for examples, default is false. -->
+        <property name="peerClassLoadingEnabled" value="true"/>
+
+        <property name="marshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
+                <!-- Set to false to allow non-serializable objects in examples, default is true. -->
+                <property name="requireSerializable" value="false"/>
+            </bean>
+        </property>
+
+        <property name="fileSystemConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.FileSystemConfiguration">
+                    <property name="name" value="igfs"/>
+                    <property name="metaCacheName" value="igfs-meta"/>
+                    <property name="dataCacheName" value="igfs-data"/>
+
+                    <!-- Must correlate with cache affinity mapper. -->
+                    <property name="blockSize" value="#{128 * 1024}"/>
+                    <property name="perNodeBatchSize" value="512"/>
+                    <property name="perNodeParallelBatchCount" value="16"/>
+
+                    <!-- Set number of prefetch blocks. -->
+                    <property name="prefetchBlocks" value="32"/>
+
+                    <!--
+                        Example of configured IPC loopback endpoint.
+                    -->
+                    <!--
+                    <property name="ipcEndpointConfiguration">
+                        <bean class="org.apache.ignite.igfs.IgfsIpcEndpointConfiguration">
+                            <property name="type" value="TCP" />
+                        </bean>
+                    </property>
+                    -->
+
+                    <!--
+                        Example of configured shared memory endpoint.
+                    -->
+                    <!--
+                    <property name="ipcEndpointConfiguration">
+                        <bean class="org.apache.ignite.igfs.IgfsIpcEndpointConfiguration">
+                            <property name="type" value="SHMEM" />
+                        </bean>
+                    </property>
+                    -->
+                </bean>
+            </list>
+        </property>
+
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="igfs-data"/>
+                    <property name="cacheMode" value="PARTITIONED"/>
+                    <property name="atomicityMode" value="TRANSACTIONAL"/>
+                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+                    <property name="backups" value="0"/>
+                    <property name="affinityMapper">
+                        <bean class="org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper">
+                            <!-- Haw many blocks in row will be stored on the same node. -->
+                            <constructor-arg value="512"/>
+                        </bean>
+                    </property>
+                </bean>
+
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="igfs-meta"/>
+                    <property name="cacheMode" value="REPLICATED"/>
+                    <property name="atomicityMode" value="TRANSACTIONAL"/>
+                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <!--
+                        Ignition provides several options for automatic discovery that can be used
+                        instead os static IP based discovery. For information on all options refer
+                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
+                    -->
+                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <!-- In distributed environment, replace with actual host IP address. -->
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/config/hibernate/README.txt
----------------------------------------------------------------------
diff --git a/examples-lgpl/config/hibernate/README.txt b/examples-lgpl/config/hibernate/README.txt
new file mode 100644
index 0000000..5b7ab29
--- /dev/null
+++ b/examples-lgpl/config/hibernate/README.txt
@@ -0,0 +1,8 @@
+Hibernate L2 Cache Configuration Example
+----------------------------------------
+
+This folder contains example-hibernate-L2-cache.xml file that demonstrates
+how to configure Hibernate to use Apache Ignite cache as an L2 cache provider.
+
+This file is also used in Hibernate example located in org.apache.ignite.examples.datagrid.hibernate
+package.

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/config/hibernate/example-hibernate-L2-cache.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/config/hibernate/example-hibernate-L2-cache.xml b/examples-lgpl/config/hibernate/example-hibernate-L2-cache.xml
new file mode 100644
index 0000000..a2f7e89
--- /dev/null
+++ b/examples-lgpl/config/hibernate/example-hibernate-L2-cache.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+
+<!DOCTYPE hibernate-configuration PUBLIC
+    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<!--
+    Configuration file for HibernateL2CacheExample.
+-->
+
+<hibernate-configuration>
+    <session-factory>
+        <!-- Database connection settings -->
+        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
+
+        <!-- Drop and re-create the database schema on startup. -->
+        <property name="hbm2ddl.auto">create</property>
+
+        <!-- Enable L2 cache. -->
+        <property name="cache.use_second_level_cache">true</property>
+
+        <!-- Enable query cache. -->
+        <property name="cache.use_query_cache">true</property>
+
+        <!-- Generate L2 cache statistics. -->
+        <property name="generate_statistics">true</property>
+
+        <!-- Specify Ignite as L2 cache provider. -->
+        <property name="cache.region.factory_class">org.apache.ignite.cache.hibernate.HibernateRegionFactory</property>
+
+        <!-- Specify connection release mode. -->
+        <property name="connection.release_mode">on_close</property>
+
+        <!-- Set default L2 cache access type. -->
+        <property name="org.apache.ignite.hibernate.default_access_type">READ_ONLY</property>
+
+        <!-- Specify the entity classes for mapping. -->
+        <mapping class="org.apache.ignite.examples.datagrid.hibernate.User"/>
+        <mapping class="org.apache.ignite.examples.datagrid.hibernate.Post"/>
+
+        <!-- Per-class L2 cache settings. -->
+        <class-cache class="org.apache.ignite.examples.datagrid.hibernate.User" usage="read-only"/>
+        <class-cache class="org.apache.ignite.examples.datagrid.hibernate.Post" usage="read-only"/>
+        <collection-cache collection="org.apache.ignite.examples.datagrid.hibernate.User.posts" usage="read-only"/>
+    </session-factory>
+</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/config/servlet/README.txt
----------------------------------------------------------------------
diff --git a/examples-lgpl/config/servlet/README.txt b/examples-lgpl/config/servlet/README.txt
new file mode 100644
index 0000000..20d4b90
--- /dev/null
+++ b/examples-lgpl/config/servlet/README.txt
@@ -0,0 +1,8 @@
+Servlet Configuration Example
+-----------------------------
+
+This folder contains web.xml file that demonstrates how to configure any servlet container
+to start a Apache Ignite node inside a Web application.
+
+For more information on available configuration properties, etc. refer to our documentation:
+http://apacheignite.readme.io/docs/web-session-clustering

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/config/servlet/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/config/servlet/WEB-INF/web.xml b/examples-lgpl/config/servlet/WEB-INF/web.xml
new file mode 100644
index 0000000..de4b3a0
--- /dev/null
+++ b/examples-lgpl/config/servlet/WEB-INF/web.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~  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.
+  -->
+
+<!--
+    Example web.xml to startup Ignite from Servlet container, like Tomcat.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                             http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <context-param>
+        <param-name>IgniteConfigurationFilePath</param-name>
+        <param-value>config/default-config.xml</param-value>
+    </context-param>
+
+    <listener>
+        <listener-class>org.apache.ignite.startup.servlet.ServletContextListenerStartup</listener-class>
+    </listener>
+</web-app>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/pom-standalone.xml b/examples-lgpl/pom-standalone.xml
new file mode 100644
index 0000000..d2a00d1
--- /dev/null
+++ b/examples-lgpl/pom-standalone.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <groupId>org.apache.ignite</groupId>
+    <artifactId>ignite-examples-lgpl</artifactId>
+    <version>to_be_replaced_by_ignite_version</version>
+    <packaging>pom</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-examples</artifactId>
+            <version>to_be_replaced_by_ignite_version</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-hibernate</artifactId>
+            <version>to_be_replaced_by_ignite_version</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-schedule</artifactId>
+            <version>to_be_replaced_by_ignite_version</version>
+        </dependency>
+    </dependencies>
+
+    <modules>
+        <module>../examples</module>
+    </modules>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </resource>
+            <resource>
+                <directory>config</directory>
+            </resource>
+        </resources>
+
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>java8-examples</id>
+
+            <activation>
+                <jdk>[1.8,)</jdk>
+            </activation>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <version>3.1</version>
+                        <configuration>
+                            <source>1.8</source>
+                            <target>1.8</target>
+                        </configuration>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>build-helper-maven-plugin</artifactId>
+                        <version>1.9.1</version>
+                        <executions>
+                            <execution>
+                                <id>add-sources</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>add-source</goal>
+                                </goals>
+                                <configuration>
+                                    <sources>
+                                        <source>src/main/java8</source>
+                                    </sources>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>add-tests</id>
+                                <phase>generate-test-sources</phase>
+                                <goals>
+                                    <goal>add-test-source</goal>
+                                </goals>
+                                <configuration>
+                                    <sources>
+                                        <source>src/test/java8</source>
+                                    </sources>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/pom.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/pom.xml b/examples-lgpl/pom.xml
new file mode 100644
index 0000000..019dc23
--- /dev/null
+++ b/examples-lgpl/pom.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-examples-lgpl</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-hibernate</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-schedule</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-examples</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </resource>
+            <resource>
+                <directory>config</directory>
+            </resource>
+        </resources>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>java8-examples</id>
+
+            <activation>
+                <jdk>[1.8,)</jdk>
+            </activation>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <configuration>
+                            <source>1.8</source>
+                            <target>1.8</target>
+                        </configuration>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>build-helper-maven-plugin</artifactId>
+                        <version>1.9.1</version>
+                        <executions>
+                            <execution>
+                                <id>add-sources</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>add-source</goal>
+                                </goals>
+                                <configuration>
+                                    <sources>
+                                        <source>src/main/java8</source>
+                                    </sources>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>add-tests</id>
+                                <phase>generate-test-sources</phase>
+                                <goals>
+                                    <goal>add-test-source</goal>
+                                </goals>
+                                <configuration>
+                                    <sources>
+                                        <source>src/test/java8</source>
+                                    </sources>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
new file mode 100644
index 0000000..2f271c8
--- /dev/null
+++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples.datagrid.hibernate;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.service.ServiceRegistryBuilder;
+import org.hibernate.stat.SecondLevelCacheStatistics;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * This example demonstrates the use of Ignite In-Memory Data Ignite cluster as a Hibernate
+ * Second-Level cache provider.
+ * <p>
+ * The Hibernate Second-Level cache (or "L2 cache" shortly) lets you significantly
+ * reduce the number of requests to the underlying SQL database. Because database
+ * access is known to be an expansive operation, using L2 cache may improve
+ * performance dramatically.
+ * <p>
+ * This example defines 2 entity classes: {@link User} and {@link Post}, with
+ * 1 <-> N relation, and marks them with appropriate annotations for Hibernate
+ * object-relational mapping to SQL tables of an underlying H2 in-memory database.
+ * The example launches node in the same JVM and registers it in
+ * Hibernate configuration as an L2 cache implementation. It then stores and
+ * queries instances of the entity classes to and from the database, having
+ * Hibernate SQL output, L2 cache statistics output, and Ignite cache metrics
+ * output enabled.
+ * <p>
+ * When running example, it's easy to notice that when an object is first
+ * put into a database, the L2 cache is not used and it's contents is empty.
+ * However, when an object is first read from the database, it is immediately
+ * stored in L2 cache (which is Ignite In-Memory Data Ignite cluster in fact), which can
+ * be seen in stats output. Further requests of the same object only read the data
+ * from L2 cache and do not hit the database.
+ * <p>
+ * In this example, the Hibernate query cache is also enabled. Query cache lets you
+ * avoid hitting the database in case of repetitive queries with the same parameter
+ * values. You may notice that when the example runs the same query repeatedly in
+ * loop, only the first query hits the database and the successive requests take the
+ * data from L2 cache.
+ * <p>
+ * Note: this example uses {@link AccessType#READ_ONLY} L2 cache access type, but you
+ * can experiment with other access types by modifying the Hibernate configuration file
+ * {@code IGNITE_HOME/examples/config/hibernate/example-hibernate-L2-cache.xml}, used by the example.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class HibernateL2CacheExample {
+    /** JDBC URL for backing database (an H2 in-memory database is used). */
+    private static final String JDBC_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
+
+    /** Path to hibernate configuration file (will be resolved from application {@code CLASSPATH}). */
+    private static final String HIBERNATE_CFG = "hibernate/example-hibernate-L2-cache.xml";
+
+    /** Entity names for stats output. */
+    private static final List<String> ENTITY_NAMES =
+        Arrays.asList(User.class.getName(), Post.class.getName(), User.class.getName() + ".posts");
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        // Start the node, run the example, and stop the node when finished.
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            // We use a single session factory, but create a dedicated session
+            // for each transaction or query. This way we ensure that L1 cache
+            // is not used (L1 cache has per-session scope only).
+            System.out.println();
+            System.out.println(">>> Hibernate L2 cache example started.");
+
+            try (
+                // Create all required caches.
+                IgniteCache c1 = createCache("org.hibernate.cache.spi.UpdateTimestampsCache", ATOMIC);
+                IgniteCache c2 = createCache("org.hibernate.cache.internal.StandardQueryCache", ATOMIC);
+                IgniteCache c3 = createCache("org.apache.ignite.examples.datagrid.hibernate.User", TRANSACTIONAL);
+                IgniteCache c4 = createCache("org.apache.ignite.examples.datagrid.hibernate.User.posts", TRANSACTIONAL);
+                IgniteCache c5 = createCache("org.apache.ignite.examples.datagrid.hibernate.Post", TRANSACTIONAL)
+            ) {
+                URL hibernateCfg = ExamplesUtils.url(HIBERNATE_CFG);
+
+                SessionFactory sesFactory = createHibernateSessionFactory(hibernateCfg);
+
+                System.out.println();
+                System.out.println(">>> Creating objects.");
+
+                final long userId;
+
+                Session ses = sesFactory.openSession();
+
+                try {
+                    Transaction tx = ses.beginTransaction();
+
+                    User user = new User("jedi", "Luke", "Skywalker");
+
+                    user.getPosts().add(new Post(user, "Let the Force be with you."));
+
+                    ses.save(user);
+
+                    tx.commit();
+
+                    // Create a user object, store it in DB, and save the database-generated
+                    // object ID. You may try adding more objects in a similar way.
+                    userId = user.getId();
+                }
+                finally {
+                    ses.close();
+                }
+
+                // Output L2 cache and Ignite cache stats. You may notice that
+                // at this point the object is not yet stored in L2 cache, because
+                // the read was not yet performed.
+                printStats(sesFactory);
+
+                System.out.println();
+                System.out.println(">>> Querying object by ID.");
+
+                // Query user by ID several times. First time we get an L2 cache
+                // miss, and the data is queried from DB, but it is then stored
+                // in cache and successive queries hit the cache and return
+                // immediately, no SQL query is made.
+                for (int i = 0; i < 3; i++) {
+                    ses = sesFactory.openSession();
+
+                    try {
+                        Transaction tx = ses.beginTransaction();
+
+                        User user = (User)ses.get(User.class, userId);
+
+                        System.out.println("User: " + user);
+
+                        for (Post post : user.getPosts())
+                            System.out.println("\tPost: " + post);
+
+                        tx.commit();
+                    }
+                    finally {
+                        ses.close();
+                    }
+                }
+
+                // Output the stats. We should see 1 miss and 2 hits for
+                // User and Collection object (stored separately in L2 cache).
+                // The Post is loaded with the collection, so it won't imply
+                // a miss.
+                printStats(sesFactory);
+            }
+        }
+    }
+
+    /**
+     * Creates cache.
+     *
+     * @param name Cache name.
+     * @param atomicityMode Atomicity mode.
+     * @return Cache configuration.
+     */
+    private static IgniteCache createCache(String name, CacheAtomicityMode atomicityMode) {
+        CacheConfiguration ccfg = new CacheConfiguration(name);
+
+        ccfg.setAtomicityMode(atomicityMode);
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        return Ignition.ignite().getOrCreateCache(ccfg);
+    }
+
+    /**
+     * Creates a new Hibernate {@link SessionFactory} using a programmatic
+     * configuration.
+     *
+     * @param hibernateCfg Hibernate configuration file.
+     * @return New Hibernate {@link SessionFactory}.
+     */
+    private static SessionFactory createHibernateSessionFactory(URL hibernateCfg) {
+        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+
+        builder.applySetting("hibernate.connection.url", JDBC_URL);
+        builder.applySetting("hibernate.show_sql", true);
+
+        return new Configuration()
+            .configure(hibernateCfg)
+            .buildSessionFactory(builder.buildServiceRegistry());
+    }
+
+    /**
+     * Prints Hibernate L2 cache statistics to standard output.
+     *
+     * @param sesFactory Hibernate {@link SessionFactory}, for which to print
+     *                   statistics.
+     */
+    private static void printStats(SessionFactory sesFactory) {
+        System.out.println("=== Hibernate L2 cache statistics ===");
+
+        for (String entityName : ENTITY_NAMES) {
+            System.out.println("\tEntity: " + entityName);
+
+            SecondLevelCacheStatistics stats =
+                sesFactory.getStatistics().getSecondLevelCacheStatistics(entityName);
+
+            System.out.println("\t\tL2 cache entries: " + stats.getEntries());
+            System.out.println("\t\tHits: " + stats.getHitCount());
+            System.out.println("\t\tMisses: " + stats.getMissCount());
+        }
+
+        System.out.println("=====================================");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/Post.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/Post.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/Post.java
new file mode 100644
index 0000000..8e98835
--- /dev/null
+++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/Post.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples.datagrid.hibernate;
+
+import java.util.Date;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+/**
+ * An entity class representing a post, that a
+ * {@link User} has made on some public service.
+ */
+@Entity
+class Post {
+    /** ID. */
+    @Id
+    @GeneratedValue(strategy=GenerationType.AUTO)
+    private long id;
+
+    /** Author. */
+    @ManyToOne
+    private User author;
+
+    /** Text. */
+    private String text;
+
+    /** Created timestamp. */
+    private Date created;
+
+    /**
+     * Default constructor (required by Hibernate).
+     */
+    Post() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param author Author.
+     * @param text Text.
+     */
+    Post(User author, String text) {
+        this.author = author;
+        this.text = text;
+        created = new Date();
+    }
+
+    /**
+     * @return ID.
+     */
+    public long getId() {
+        return id;
+    }
+
+    /**
+     * @param id New ID.
+     */
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    /**
+     * @return Author.
+     */
+    public User getAuthor() {
+        return author;
+    }
+
+    /**
+     * @param author New author.
+     */
+    public void setAuthor(User author) {
+        this.author = author;
+    }
+
+    /**
+     * @return Text.
+     */
+    public String getText() {
+        return text;
+    }
+
+    /**
+     * @param text New text.
+     */
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    /**
+     * @return Created timestamp.
+     */
+    public Date getCreated() {
+        return (Date)created.clone();
+    }
+
+    /**
+     * @param created New created timestamp.
+     */
+    public void setCreated(Date created) {
+        this.created = (Date)created.clone();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "Post [id=" + id +
+            ", text=" + text +
+            ", created=" + created +
+            ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/User.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/User.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/User.java
new file mode 100644
index 0000000..d0486f5
--- /dev/null
+++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/User.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples.datagrid.hibernate;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import org.hibernate.annotations.NaturalId;
+
+/**
+ * A user entity class. Represents a user of some public service,
+ * having a number of personal information fields as well as a
+ * number of posts written.
+ */
+@Entity
+class User {
+    /** ID. */
+    @Id
+    @GeneratedValue(strategy=GenerationType.AUTO)
+    private long id;
+
+    /** Login. */
+    @NaturalId
+    private String login;
+
+    /** First name. */
+    private String firstName;
+
+    /** Last name. */
+    private String lastName;
+
+    /** Posts. */
+    @OneToMany(mappedBy = "author", cascade = CascadeType.ALL)
+    private Set<Post> posts = new HashSet<>();
+
+    /**
+     * Default constructor (required by Hibernate).
+     */
+    User() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param login Login.
+     * @param firstName First name.
+     * @param lastName Last name.
+     */
+    User(String login, String firstName, String lastName) {
+        this.login = login;
+        this.firstName = firstName;
+        this.lastName = lastName;
+    }
+
+    /**
+     * @return ID.
+     */
+    public long getId() {
+        return id;
+    }
+
+    /**
+     * @param id New ID.
+     */
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    /**
+     * @return Login.
+     */
+    public String getLogin() {
+        return login;
+    }
+
+    /**
+     * @param login New login.
+     */
+    public void setLogin(String login) {
+        this.login = login;
+    }
+
+    /**
+     * @return First name.
+     */
+    public String getFirstName() {
+        return firstName;
+    }
+
+    /**
+     * @param firstName New first name.
+     */
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    /**
+     * @return Last name.
+     */
+    public String getLastName() {
+        return lastName;
+    }
+
+    /**
+     * @param lastName New last name.
+     */
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    /**
+     * @return Posts.
+     */
+    public Set<Post> getPosts() {
+        return posts;
+    }
+
+    /**
+     * @param posts New posts.
+     */
+    public void setPosts(Set<Post> posts) {
+        this.posts = posts;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return "User [id=" + id +
+            ", login=" + login +
+            ", firstName=" + firstName +
+            ", lastName=" + lastName +
+            ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/package-info.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/package-info.java
new file mode 100644
index 0000000..7bddaaf
--- /dev/null
+++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/hibernate/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Hibernate example.
+ */
+package org.apache.ignite.examples.datagrid.hibernate;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
new file mode 100644
index 0000000..d040b88
--- /dev/null
+++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples.datagrid.store.hibernate;
+
+import java.util.List;
+import java.util.UUID;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreAdapter;
+import org.apache.ignite.cache.store.CacheStoreSession;
+import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.lang.IgniteBiInClosure;
+import org.apache.ignite.resources.CacheStoreSessionResource;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+
+/**
+ * Example of {@link CacheStore} implementation that uses Hibernate
+ * and deals with maps {@link UUID} to {@link Person}.
+ */
+public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> {
+    /** Auto-injected store session. */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
+    /** {@inheritDoc} */
+    @Override public Person load(Long key) {
+        System.out.println(">>> Store load [key=" + key + ']');
+
+        Session hibSes = ses.attachment();
+
+        try {
+            return (Person)hibSes.get(Person.class, key);
+        }
+        catch (HibernateException e) {
+            throw new CacheLoaderException("Failed to load value from cache store [key=" + key + ']', e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(javax.cache.Cache.Entry<? extends Long, ? extends Person> entry) {
+        Long key = entry.getKey();
+        Person val = entry.getValue();
+
+        System.out.println(">>> Store write [key=" + key + ", val=" + val + ']');
+
+        Session hibSes = ses.attachment();
+
+        try {
+            hibSes.saveOrUpdate(val);
+        }
+        catch (HibernateException e) {
+            throw new CacheWriterException("Failed to put value to cache store [key=" + key + ", val" + val + "]", e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"JpaQueryApiInspection"})
+    @Override public void delete(Object key) {
+        System.out.println(">>> Store delete [key=" + key + ']');
+
+        Session hibSes = ses.attachment();
+
+        try {
+            hibSes.createQuery("delete " + Person.class.getSimpleName() + " where key = :key").
+                setParameter("key", key).
+                executeUpdate();
+        }
+        catch (HibernateException e) {
+            throw new CacheWriterException("Failed to remove value from cache store [key=" + key + ']', e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void loadCache(IgniteBiInClosure<Long, Person> clo, Object... args) {
+        if (args == null || args.length == 0 || args[0] == null)
+            throw new CacheLoaderException("Expected entry count parameter is not provided.");
+
+        final int entryCnt = (Integer)args[0];
+
+        Session hibSes = ses.attachment();
+
+        try {
+            int cnt = 0;
+
+            List list = hibSes.createCriteria(Person.class).
+                setMaxResults(entryCnt).
+                list();
+
+            if (list != null) {
+                for (Object obj : list) {
+                    Person person = (Person)obj;
+
+                    clo.apply(person.getId(), person);
+
+                    cnt++;
+                }
+            }
+
+            System.out.println(">>> Loaded " + cnt + " values into cache.");
+        }
+        catch (HibernateException e) {
+            throw new CacheLoaderException("Failed to load values from cache store.", e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
new file mode 100644
index 0000000..f993d81
--- /dev/null
+++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples.datagrid.store.hibernate;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.configuration.FactoryBuilder;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.store.CacheStoreSessionListener;
+import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreSessionListener;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.transactions.Transaction;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+
+/**
+ * Demonstrates usage of cache with underlying persistent store configured.
+ * <p>
+ * This example uses {@link CacheHibernatePersonStore} as a persistent store.
+ * <p>
+ * Remote nodes can be started with {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class CacheHibernateStoreExample {
+    /** Hibernate configuration resource path. */
+    private static final String HIBERNATE_CFG =
+        "/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml";
+
+    /** Cache name. */
+    private static final String CACHE_NAME = CacheHibernateStoreExample.class.getSimpleName();
+
+    /** Heap size required to run this example. */
+    public static final int MIN_MEMORY = 1024 * 1024 * 1024;
+
+    /** Number of entries to load. */
+    private static final int ENTRY_COUNT = 100_000;
+
+    /** Global person ID to use across entire example. */
+    private static final Long id = Math.abs(UUID.randomUUID().getLeastSignificantBits());
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        ExamplesUtils.checkMinMemory(MIN_MEMORY);
+
+        // To start ignite with desired configuration uncomment the appropriate line.
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> Cache store example started.");
+
+            CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>(CACHE_NAME);
+
+            // Set atomicity as transaction, since we are showing transactions in example.
+            cacheCfg.setAtomicityMode(TRANSACTIONAL);
+
+            // Configure Hibernate store.
+            cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(CacheHibernatePersonStore.class));
+
+            // Configure Hibernate session listener.
+            cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
+                @Override public CacheStoreSessionListener create() {
+                    CacheHibernateStoreSessionListener lsnr = new CacheHibernateStoreSessionListener();
+
+                    lsnr.setHibernateConfigurationPath(HIBERNATE_CFG);
+
+                    return lsnr;
+                }
+            });
+
+            cacheCfg.setReadThrough(true);
+            cacheCfg.setWriteThrough(true);
+
+            try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheCfg)) {
+                // Make initial cache loading from persistent store. This is a
+                // distributed operation and will call CacheStore.loadCache(...)
+                // method on all nodes in topology.
+                loadCache(cache);
+
+                // Start transaction and execute several cache operations with
+                // read/write-through to persistent store.
+                executeTransaction(cache);
+            }
+        }
+    }
+
+    /**
+     * Makes initial cache loading.
+     *
+     * @param cache Cache to load.
+     */
+    private static void loadCache(IgniteCache<Long, Person> cache) {
+        long start = System.currentTimeMillis();
+
+        // Start loading cache from persistent store on all caching nodes.
+        cache.loadCache(null, ENTRY_COUNT);
+
+        long end = System.currentTimeMillis();
+
+        System.out.println(">>> Loaded " + cache.size() + " keys with backups in " + (end - start) + "ms.");
+    }
+
+    /**
+     * Executes transaction with read/write-through to persistent store.
+     *
+     * @param cache Cache to execute transaction on.
+     */
+    private static void executeTransaction(IgniteCache<Long, Person> cache) {
+        try (Transaction tx = Ignition.ignite().transactions().txStart()) {
+            Person val = cache.get(id);
+
+            System.out.println("Read value: " + val);
+
+            val = cache.getAndPut(id, new Person(id, "Isaac", "Newton"));
+
+            System.out.println("Overwrote old value: " + val);
+
+            val = cache.get(id);
+
+            System.out.println("Read value: " + val);
+
+            tx.commit();
+        }
+
+        System.out.println("Read value after commit: " + cache.get(id));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
new file mode 100644
index 0000000..035ab98
--- /dev/null
+++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<!DOCTYPE hibernate-mapping PUBLIC
+        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping default-access="field">
+    <class name="org.apache.ignite.examples.datagrid.store.Person" table="PERSONS">
+        <!-- ID. -->
+        <id name="id"/>
+
+        <!-- We only map data we are interested in. -->
+        <property name="firstName"/>
+        <property name="lastName"/>
+    </class>
+</hibernate-mapping>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
new file mode 100644
index 0000000..80a43e7
--- /dev/null
+++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
@@ -0,0 +1,41 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<!--
+  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.
+-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<!--
+    Hibernate configuration.
+-->
+<hibernate-configuration>
+    <session-factory>
+        <!-- Database connection settings (private in-memory database). -->
+        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
+
+        <!-- Only validate the database schema on startup in production mode. -->
+        <property name="hbm2ddl.auto">update</property>
+
+        <!-- Do not output SQL. -->
+        <property name="show_sql">false</property>
+
+        <!-- Mappings. -->
+        <mapping resource="org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml"/>
+    </session-factory>
+</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java
new file mode 100644
index 0000000..7210b49
--- /dev/null
+++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains Hibernate-based cache store implementation.
+ */
+package org.apache.ignite.examples.datagrid.store.hibernate;


[02/11] ignite git commit: IGNITE-1653

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
new file mode 100644
index 0000000..cef9f2f
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamVisitorExample.java
@@ -0,0 +1,172 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.streaming;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Random;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+import org.apache.ignite.stream.StreamVisitor;
+
+/**
+ * Stream random numbers into the streaming cache.
+ * To start the example, you should:
+ * <ul>
+ *     <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ *     <li>Start streaming using {@link StreamVisitorExample}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class StreamVisitorExample {
+    /** Random number generator. */
+    private static final Random RAND = new Random();
+
+    /** The list of instruments. */
+    private static final String[] INSTRUMENTS = {"IBM", "GOOG", "MSFT", "GE", "EBAY", "YHOO", "ORCL", "CSCO", "AMZN", "RHT"};
+
+    /** The list of initial instrument prices. */
+    private static final double[] INITIAL_PRICES = {194.9, 893.49, 34.21, 23.24, 57.93, 45.03, 44.41, 28.44, 378.49, 69.50};
+
+    public static void main(String[] args) throws Exception {
+        // Mark this cluster member as client.
+        Ignition.setClientMode(true);
+
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            if (!ExamplesUtils.hasServerNodes(ignite))
+                return;
+
+            // Market data cache with default configuration.
+            CacheConfiguration<String, Double> mktDataCfg = new CacheConfiguration<>("marketTicks");
+
+            // Financial instrument cache configuration.
+            CacheConfiguration<String, Instrument> instCfg = new CacheConfiguration<>("instCache");
+
+            // Index key and value for querying financial instruments.
+            // Note that Instrument class has @QuerySqlField annotation for secondary field indexing.
+            instCfg.setIndexedTypes(String.class, Instrument.class);
+
+            // Auto-close caches at the end of the example.
+            try (
+                IgniteCache<String, Double> mktCache = ignite.getOrCreateCache(mktDataCfg);
+                IgniteCache<String, Instrument> instCache = ignite.getOrCreateCache(instCfg)
+            ) {
+                try (IgniteDataStreamer<String, Double> mktStmr = ignite.dataStreamer(mktCache.getName())) {
+                    // Note that we receive market data, but do not populate 'mktCache' (it remains empty).
+                    // Instead we update the instruments in the 'instCache'.
+                    // Since both, 'instCache' and 'mktCache' use the same key, updates are collocated.
+                    mktStmr.receiver(StreamVisitor.from((cache, e) -> {
+                        String symbol = e.getKey();
+                        Double tick = e.getValue();
+
+                        Instrument inst = instCache.get(symbol);
+
+                        if (inst == null)
+                            inst = new Instrument(symbol);
+
+                        // Don't populate market cache, as we don't use it for querying.
+                        // Update cached instrument based on the latest market tick.
+                        inst.update(tick);
+
+                        instCache.put(symbol, inst);
+                    }));
+
+                    // Stream 10 million market data ticks into the system.
+                    for (int i = 1; i <= 10_000_000; i++) {
+                        int idx = RAND.nextInt(INSTRUMENTS.length);
+
+                        // Use gaussian distribution to ensure that
+                        // numbers closer to 0 have higher probability.
+                        double price = round2(INITIAL_PRICES[idx] + RAND.nextGaussian());
+
+                        mktStmr.addData(INSTRUMENTS[idx], price);
+
+                        if (i % 500_000 == 0)
+                            System.out.println("Number of tuples streamed into Ignite: " + i);
+                    }
+                }
+
+                // Select top 3 best performing instruments.
+                SqlFieldsQuery top3qry = new SqlFieldsQuery(
+                    "select symbol, (latest - open) from Instrument order by (latest - open) desc limit 3");
+
+                // Execute queries.
+                List<List<?>> top3 = instCache.query(top3qry).getAll();
+
+                System.out.println("Top performing financial instruments: ");
+
+                // Print top 10 words.
+                ExamplesUtils.printQueryResults(top3);
+            }
+        }
+    }
+
+    /**
+     * Rounds double value to two significant signs.
+     *
+     * @param val value to be rounded.
+     * @return rounded double value.
+     */
+    private static double round2(double val) {
+        return Math.floor(100 * val + 0.5) / 100;
+    }
+
+    /**
+     * Financial instrument.
+     */
+    public static class Instrument implements Serializable {
+        /** Instrument symbol. */
+        @QuerySqlField(index = true)
+        private final String symbol;
+
+        /** Open price. */
+        @QuerySqlField(index = true)
+        private double open;
+
+        /** Close price. */
+        @QuerySqlField(index = true)
+        private double latest;
+
+        /**
+         * @param symbol Symbol.
+         */
+        public Instrument(String symbol) {
+            this.symbol = symbol;
+        }
+
+        /**
+         * Updates this instrument based on the latest market tick price.
+         *
+         * @param price Latest price.
+         */
+        public void update(double price) {
+            if (open == 0)
+                open = price;
+
+            this.latest = price;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/package-info.java
new file mode 100644
index 0000000..d215d2f
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/package-info.java
@@ -0,0 +1,22 @@
+/*
+ *  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 description. -->
+ * Demonstrates usage of data streamer.
+ */
+package org.apache.ignite.examples.java8.streaming;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java b/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
new file mode 100644
index 0000000..8a40d4a
--- /dev/null
+++ b/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples;
+
+import org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample;
+
+/**
+ * Multi-node test for {@link HibernateL2CacheExample}.
+ */
+public class HibernateL2CacheExampleMultiNodeSelfTest extends HibernateL2CacheExampleSelfTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        for (int i = 0; i < RMT_NODES_CNT; i++)
+            startGrid("node-" + i, "examples/config/example-ignite.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java b/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java
new file mode 100644
index 0000000..68767d7
--- /dev/null
+++ b/examples-lgpl/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples;
+
+import org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample;
+import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
+
+/**
+ * Tests the {@link HibernateL2CacheExample}.
+ */
+public class HibernateL2CacheExampleSelfTest extends GridAbstractExamplesTest {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testHibernateL2CacheExample() throws Exception {
+        HibernateL2CacheExample.main(EMPTY_ARGS);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/test/java/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java b/examples-lgpl/src/test/java/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java
new file mode 100644
index 0000000..7c99712
--- /dev/null
+++ b/examples-lgpl/src/test/java/org/apache/ignite/testsuites/IgniteLgplExamplesSelfTestSuite.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.examples.HibernateL2CacheExampleMultiNodeSelfTest;
+import org.apache.ignite.examples.HibernateL2CacheExampleSelfTest;
+import org.apache.ignite.testframework.GridTestUtils;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_OVERRIDE_MCAST_GRP;
+
+/**
+ * Examples test suite. <p> Contains only Spring ignite examples tests.
+ */
+public class IgniteLgplExamplesSelfTestSuite extends TestSuite {
+    /**
+     * @return Suite.
+     * @throws Exception If failed.
+     */
+    public static TestSuite suite() throws Exception {
+        System.setProperty(IGNITE_OVERRIDE_MCAST_GRP,
+            GridTestUtils.getNextMulticastGroup(IgniteLgplExamplesSelfTestSuite.class));
+
+        TestSuite suite = new TestSuite("Ignite Examples Test Suite");
+
+        suite.addTest(new TestSuite(HibernateL2CacheExampleSelfTest.class));
+
+        // Multi-node.
+        suite.addTest(new TestSuite(HibernateL2CacheExampleMultiNodeSelfTest.class));
+
+        return suite;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java b/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
new file mode 100644
index 0000000..edfba3d
--- /dev/null
+++ b/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.java8.examples;
+
+/**
+ * Multi-node test for {@link org.apache.ignite.examples.java8.datagrid.hibernate.HibernateL2CacheExample}.
+ */
+public class HibernateL2CacheExampleMultiNodeSelfTest extends HibernateL2CacheExampleSelfTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        for (int i = 0; i < RMT_NODES_CNT; i++)
+            startGrid("node-" + i, "examples/config/example-ignite.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java b/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java
new file mode 100644
index 0000000..8c7a2de
--- /dev/null
+++ b/examples-lgpl/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.java8.examples;
+
+//import org.apache.ignite.examples.java8.datagrid.hibernate.*;
+
+import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
+
+/**
+ * Tests the {@link org.apache.ignite.examples.java8.datagrid.hibernate.HibernateL2CacheExample}.
+ */
+public class HibernateL2CacheExampleSelfTest extends GridAbstractExamplesTest {
+    /**
+     * TODO: IGNITE-711 next example(s) should be implemented for java 8
+     * or testing method(s) should be removed if example(s) does not applicable for java 8.
+     *
+     * @throws Exception If failed.
+     */
+//    public void testHibernateL2CacheExample() throws Exception {
+//        HibernateL2CacheExample.main(EMPTY_ARGS);
+//    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/test/java8/org/apache/ignite/java8/testsuites/IgniteLgplExamplesJ8SelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/java8/org/apache/ignite/java8/testsuites/IgniteLgplExamplesJ8SelfTestSuite.java b/examples-lgpl/src/test/java8/org/apache/ignite/java8/testsuites/IgniteLgplExamplesJ8SelfTestSuite.java
new file mode 100644
index 0000000..bdda5f6
--- /dev/null
+++ b/examples-lgpl/src/test/java8/org/apache/ignite/java8/testsuites/IgniteLgplExamplesJ8SelfTestSuite.java
@@ -0,0 +1,46 @@
+/*
+ *  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.java8.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.testframework.GridTestUtils;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_OVERRIDE_MCAST_GRP;
+
+/**
+ * Examples test suite. <p> Contains only Spring ignite examples tests.
+ */
+public class IgniteLgplExamplesJ8SelfTestSuite extends TestSuite {
+    /**
+     * @return Suite.
+     * @throws Exception If failed.
+     */
+    public static TestSuite suite() throws Exception {
+        System.setProperty(IGNITE_OVERRIDE_MCAST_GRP,
+            GridTestUtils.getNextMulticastGroup(IgniteLgplExamplesJ8SelfTestSuite.class));
+
+        TestSuite suite = new TestSuite("Ignite Examples Test Suite");
+
+//        suite.addTest(new TestSuite(HibernateL2CacheExampleSelfTest.class));
+
+        // Multi-node.
+//        suite.addTest(new TestSuite(HibernateL2CacheExampleMultiNodeSelfTest.class));
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index 996753e..e314acb 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -49,12 +49,6 @@
 
         <dependency>
             <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-hibernate</artifactId>
-            <version>to_be_replaced_by_ignite_version</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-spring</artifactId>
             <version>to_be_replaced_by_ignite_version</version>
         </dependency>
@@ -72,12 +66,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-schedule</artifactId>
-            <version>to_be_replaced_by_ignite_version</version>
-        </dependency>
-
-        <dependency>
             <groupId>com.google.code.simple-spring-memcached</groupId>
             <artifactId>spymemcached</artifactId>
             <version>2.7.3</version>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index e4ec73a..34ba05a 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -45,12 +45,6 @@
 
         <dependency>
             <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-hibernate</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-spring</artifactId>
             <version>${project.version}</version>
         </dependency>
@@ -68,12 +62,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-schedule</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
             <groupId>com.google.code.simple-spring-memcached</groupId>
             <artifactId>spymemcached</artifactId>
             <version>2.7.3</version>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
deleted file mode 100644
index 2f271c8..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.datagrid.hibernate;
-
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.ExampleNodeStartup;
-import org.apache.ignite.examples.ExamplesUtils;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.service.ServiceRegistryBuilder;
-import org.hibernate.stat.SecondLevelCacheStatistics;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * This example demonstrates the use of Ignite In-Memory Data Ignite cluster as a Hibernate
- * Second-Level cache provider.
- * <p>
- * The Hibernate Second-Level cache (or "L2 cache" shortly) lets you significantly
- * reduce the number of requests to the underlying SQL database. Because database
- * access is known to be an expansive operation, using L2 cache may improve
- * performance dramatically.
- * <p>
- * This example defines 2 entity classes: {@link User} and {@link Post}, with
- * 1 <-> N relation, and marks them with appropriate annotations for Hibernate
- * object-relational mapping to SQL tables of an underlying H2 in-memory database.
- * The example launches node in the same JVM and registers it in
- * Hibernate configuration as an L2 cache implementation. It then stores and
- * queries instances of the entity classes to and from the database, having
- * Hibernate SQL output, L2 cache statistics output, and Ignite cache metrics
- * output enabled.
- * <p>
- * When running example, it's easy to notice that when an object is first
- * put into a database, the L2 cache is not used and it's contents is empty.
- * However, when an object is first read from the database, it is immediately
- * stored in L2 cache (which is Ignite In-Memory Data Ignite cluster in fact), which can
- * be seen in stats output. Further requests of the same object only read the data
- * from L2 cache and do not hit the database.
- * <p>
- * In this example, the Hibernate query cache is also enabled. Query cache lets you
- * avoid hitting the database in case of repetitive queries with the same parameter
- * values. You may notice that when the example runs the same query repeatedly in
- * loop, only the first query hits the database and the successive requests take the
- * data from L2 cache.
- * <p>
- * Note: this example uses {@link AccessType#READ_ONLY} L2 cache access type, but you
- * can experiment with other access types by modifying the Hibernate configuration file
- * {@code IGNITE_HOME/examples/config/hibernate/example-hibernate-L2-cache.xml}, used by the example.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
- * <p>
- * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will
- * start node with {@code examples/config/example-ignite.xml} configuration.
- */
-public class HibernateL2CacheExample {
-    /** JDBC URL for backing database (an H2 in-memory database is used). */
-    private static final String JDBC_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
-
-    /** Path to hibernate configuration file (will be resolved from application {@code CLASSPATH}). */
-    private static final String HIBERNATE_CFG = "hibernate/example-hibernate-L2-cache.xml";
-
-    /** Entity names for stats output. */
-    private static final List<String> ENTITY_NAMES =
-        Arrays.asList(User.class.getName(), Post.class.getName(), User.class.getName() + ".posts");
-
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     * @throws IgniteException If example execution failed.
-     */
-    public static void main(String[] args) throws IgniteException {
-        // Start the node, run the example, and stop the node when finished.
-        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
-            // We use a single session factory, but create a dedicated session
-            // for each transaction or query. This way we ensure that L1 cache
-            // is not used (L1 cache has per-session scope only).
-            System.out.println();
-            System.out.println(">>> Hibernate L2 cache example started.");
-
-            try (
-                // Create all required caches.
-                IgniteCache c1 = createCache("org.hibernate.cache.spi.UpdateTimestampsCache", ATOMIC);
-                IgniteCache c2 = createCache("org.hibernate.cache.internal.StandardQueryCache", ATOMIC);
-                IgniteCache c3 = createCache("org.apache.ignite.examples.datagrid.hibernate.User", TRANSACTIONAL);
-                IgniteCache c4 = createCache("org.apache.ignite.examples.datagrid.hibernate.User.posts", TRANSACTIONAL);
-                IgniteCache c5 = createCache("org.apache.ignite.examples.datagrid.hibernate.Post", TRANSACTIONAL)
-            ) {
-                URL hibernateCfg = ExamplesUtils.url(HIBERNATE_CFG);
-
-                SessionFactory sesFactory = createHibernateSessionFactory(hibernateCfg);
-
-                System.out.println();
-                System.out.println(">>> Creating objects.");
-
-                final long userId;
-
-                Session ses = sesFactory.openSession();
-
-                try {
-                    Transaction tx = ses.beginTransaction();
-
-                    User user = new User("jedi", "Luke", "Skywalker");
-
-                    user.getPosts().add(new Post(user, "Let the Force be with you."));
-
-                    ses.save(user);
-
-                    tx.commit();
-
-                    // Create a user object, store it in DB, and save the database-generated
-                    // object ID. You may try adding more objects in a similar way.
-                    userId = user.getId();
-                }
-                finally {
-                    ses.close();
-                }
-
-                // Output L2 cache and Ignite cache stats. You may notice that
-                // at this point the object is not yet stored in L2 cache, because
-                // the read was not yet performed.
-                printStats(sesFactory);
-
-                System.out.println();
-                System.out.println(">>> Querying object by ID.");
-
-                // Query user by ID several times. First time we get an L2 cache
-                // miss, and the data is queried from DB, but it is then stored
-                // in cache and successive queries hit the cache and return
-                // immediately, no SQL query is made.
-                for (int i = 0; i < 3; i++) {
-                    ses = sesFactory.openSession();
-
-                    try {
-                        Transaction tx = ses.beginTransaction();
-
-                        User user = (User)ses.get(User.class, userId);
-
-                        System.out.println("User: " + user);
-
-                        for (Post post : user.getPosts())
-                            System.out.println("\tPost: " + post);
-
-                        tx.commit();
-                    }
-                    finally {
-                        ses.close();
-                    }
-                }
-
-                // Output the stats. We should see 1 miss and 2 hits for
-                // User and Collection object (stored separately in L2 cache).
-                // The Post is loaded with the collection, so it won't imply
-                // a miss.
-                printStats(sesFactory);
-            }
-        }
-    }
-
-    /**
-     * Creates cache.
-     *
-     * @param name Cache name.
-     * @param atomicityMode Atomicity mode.
-     * @return Cache configuration.
-     */
-    private static IgniteCache createCache(String name, CacheAtomicityMode atomicityMode) {
-        CacheConfiguration ccfg = new CacheConfiguration(name);
-
-        ccfg.setAtomicityMode(atomicityMode);
-        ccfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        return Ignition.ignite().getOrCreateCache(ccfg);
-    }
-
-    /**
-     * Creates a new Hibernate {@link SessionFactory} using a programmatic
-     * configuration.
-     *
-     * @param hibernateCfg Hibernate configuration file.
-     * @return New Hibernate {@link SessionFactory}.
-     */
-    private static SessionFactory createHibernateSessionFactory(URL hibernateCfg) {
-        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
-
-        builder.applySetting("hibernate.connection.url", JDBC_URL);
-        builder.applySetting("hibernate.show_sql", true);
-
-        return new Configuration()
-            .configure(hibernateCfg)
-            .buildSessionFactory(builder.buildServiceRegistry());
-    }
-
-    /**
-     * Prints Hibernate L2 cache statistics to standard output.
-     *
-     * @param sesFactory Hibernate {@link SessionFactory}, for which to print
-     *                   statistics.
-     */
-    private static void printStats(SessionFactory sesFactory) {
-        System.out.println("=== Hibernate L2 cache statistics ===");
-
-        for (String entityName : ENTITY_NAMES) {
-            System.out.println("\tEntity: " + entityName);
-
-            SecondLevelCacheStatistics stats =
-                sesFactory.getStatistics().getSecondLevelCacheStatistics(entityName);
-
-            System.out.println("\t\tL2 cache entries: " + stats.getEntries());
-            System.out.println("\t\tHits: " + stats.getHitCount());
-            System.out.println("\t\tMisses: " + stats.getMissCount());
-        }
-
-        System.out.println("=====================================");
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/Post.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/Post.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/Post.java
deleted file mode 100644
index 798411a..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/Post.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.datagrid.hibernate;
-
-import java.util.Date;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-
-/**
- * An entity class representing a post, that a
- * {@link User} has made on some public service.
- */
-@Entity
-class Post {
-    /** ID. */
-    @Id
-    @GeneratedValue(strategy=GenerationType.AUTO)
-    private long id;
-
-    /** Author. */
-    @ManyToOne
-    private User author;
-
-    /** Text. */
-    private String text;
-
-    /** Created timestamp. */
-    private Date created;
-
-    /**
-     * Default constructor (required by Hibernate).
-     */
-    Post() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param author Author.
-     * @param text Text.
-     */
-    Post(User author, String text) {
-        this.author = author;
-        this.text = text;
-        created = new Date();
-    }
-
-    /**
-     * @return ID.
-     */
-    public long getId() {
-        return id;
-    }
-
-    /**
-     * @param id New ID.
-     */
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    /**
-     * @return Author.
-     */
-    public User getAuthor() {
-        return author;
-    }
-
-    /**
-     * @param author New author.
-     */
-    public void setAuthor(User author) {
-        this.author = author;
-    }
-
-    /**
-     * @return Text.
-     */
-    public String getText() {
-        return text;
-    }
-
-    /**
-     * @param text New text.
-     */
-    public void setText(String text) {
-        this.text = text;
-    }
-
-    /**
-     * @return Created timestamp.
-     */
-    public Date getCreated() {
-        return (Date)created.clone();
-    }
-
-    /**
-     * @param created New created timestamp.
-     */
-    public void setCreated(Date created) {
-        this.created = (Date)created.clone();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Post [id=" + id +
-            ", text=" + text +
-            ", created=" + created +
-            ']';
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/User.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/User.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/User.java
deleted file mode 100644
index b7d5299..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/User.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.datagrid.hibernate;
-
-import java.util.HashSet;
-import java.util.Set;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import org.hibernate.annotations.NaturalId;
-
-/**
- * A user entity class. Represents a user of some public service,
- * having a number of personal information fields as well as a
- * number of posts written.
- */
-@Entity
-class User {
-    /** ID. */
-    @Id
-    @GeneratedValue(strategy=GenerationType.AUTO)
-    private long id;
-
-    /** Login. */
-    @NaturalId
-    private String login;
-
-    /** First name. */
-    private String firstName;
-
-    /** Last name. */
-    private String lastName;
-
-    /** Posts. */
-    @OneToMany(mappedBy = "author", cascade = CascadeType.ALL)
-    private Set<Post> posts = new HashSet<>();
-
-    /**
-     * Default constructor (required by Hibernate).
-     */
-    User() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param login Login.
-     * @param firstName First name.
-     * @param lastName Last name.
-     */
-    User(String login, String firstName, String lastName) {
-        this.login = login;
-        this.firstName = firstName;
-        this.lastName = lastName;
-    }
-
-    /**
-     * @return ID.
-     */
-    public long getId() {
-        return id;
-    }
-
-    /**
-     * @param id New ID.
-     */
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    /**
-     * @return Login.
-     */
-    public String getLogin() {
-        return login;
-    }
-
-    /**
-     * @param login New login.
-     */
-    public void setLogin(String login) {
-        this.login = login;
-    }
-
-    /**
-     * @return First name.
-     */
-    public String getFirstName() {
-        return firstName;
-    }
-
-    /**
-     * @param firstName New first name.
-     */
-    public void setFirstName(String firstName) {
-        this.firstName = firstName;
-    }
-
-    /**
-     * @return Last name.
-     */
-    public String getLastName() {
-        return lastName;
-    }
-
-    /**
-     * @param lastName New last name.
-     */
-    public void setLastName(String lastName) {
-        this.lastName = lastName;
-    }
-
-    /**
-     * @return Posts.
-     */
-    public Set<Post> getPosts() {
-        return posts;
-    }
-
-    /**
-     * @param posts New posts.
-     */
-    public void setPosts(Set<Post> posts) {
-        this.posts = posts;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "User [id=" + id +
-            ", login=" + login +
-            ", firstName=" + firstName +
-            ", lastName=" + lastName +
-            ']';
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/package-info.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/package-info.java
deleted file mode 100644
index 4bb876b..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/hibernate/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Hibernate example.
- */
-package org.apache.ignite.examples.datagrid.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
deleted file mode 100644
index f8831ab..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.datagrid.store.hibernate;
-
-import java.util.List;
-import java.util.UUID;
-import javax.cache.integration.CacheLoaderException;
-import javax.cache.integration.CacheWriterException;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.examples.datagrid.store.Person;
-import org.apache.ignite.lang.IgniteBiInClosure;
-import org.apache.ignite.resources.CacheStoreSessionResource;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-
-/**
- * Example of {@link CacheStore} implementation that uses Hibernate
- * and deals with maps {@link UUID} to {@link Person}.
- */
-public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> {
-    /** Auto-injected store session. */
-    @CacheStoreSessionResource
-    private CacheStoreSession ses;
-
-    /** {@inheritDoc} */
-    @Override public Person load(Long key) {
-        System.out.println(">>> Store load [key=" + key + ']');
-
-        Session hibSes = ses.attachment();
-
-        try {
-            return (Person)hibSes.get(Person.class, key);
-        }
-        catch (HibernateException e) {
-            throw new CacheLoaderException("Failed to load value from cache store [key=" + key + ']', e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void write(javax.cache.Cache.Entry<? extends Long, ? extends Person> entry) {
-        Long key = entry.getKey();
-        Person val = entry.getValue();
-
-        System.out.println(">>> Store write [key=" + key + ", val=" + val + ']');
-
-        Session hibSes = ses.attachment();
-
-        try {
-            hibSes.saveOrUpdate(val);
-        }
-        catch (HibernateException e) {
-            throw new CacheWriterException("Failed to put value to cache store [key=" + key + ", val" + val + "]", e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"JpaQueryApiInspection"})
-    @Override public void delete(Object key) {
-        System.out.println(">>> Store delete [key=" + key + ']');
-
-        Session hibSes = ses.attachment();
-
-        try {
-            hibSes.createQuery("delete " + Person.class.getSimpleName() + " where key = :key").
-                setParameter("key", key).
-                executeUpdate();
-        }
-        catch (HibernateException e) {
-            throw new CacheWriterException("Failed to remove value from cache store [key=" + key + ']', e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void loadCache(IgniteBiInClosure<Long, Person> clo, Object... args) {
-        if (args == null || args.length == 0 || args[0] == null)
-            throw new CacheLoaderException("Expected entry count parameter is not provided.");
-
-        final int entryCnt = (Integer)args[0];
-
-        Session hibSes = ses.attachment();
-
-        try {
-            int cnt = 0;
-
-            List list = hibSes.createCriteria(Person.class).
-                setMaxResults(entryCnt).
-                list();
-
-            if (list != null) {
-                for (Object obj : list) {
-                    Person person = (Person)obj;
-
-                    clo.apply(person.getId(), person);
-
-                    cnt++;
-                }
-            }
-
-            System.out.println(">>> Loaded " + cnt + " values into cache.");
-        }
-        catch (HibernateException e) {
-            throw new CacheLoaderException("Failed to load values from cache store.", e);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
deleted file mode 100644
index fbb761a..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.datagrid.store.hibernate;
-
-import java.util.UUID;
-import javax.cache.configuration.Factory;
-import javax.cache.configuration.FactoryBuilder;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.store.CacheStoreSessionListener;
-import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreSessionListener;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.ExampleNodeStartup;
-import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
-import org.apache.ignite.transactions.Transaction;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-
-/**
- * Demonstrates usage of cache with underlying persistent store configured.
- * <p>
- * This example uses {@link CacheHibernatePersonStore} as a persistent store.
- * <p>
- * Remote nodes can be started with {@link ExampleNodeStartup} in another JVM which will
- * start node with {@code examples/config/example-ignite.xml} configuration.
- */
-public class CacheHibernateStoreExample {
-    /** Hibernate configuration resource path. */
-    private static final String HIBERNATE_CFG =
-        "/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml";
-
-    /** Cache name. */
-    private static final String CACHE_NAME = CacheHibernateStoreExample.class.getSimpleName();
-
-    /** Heap size required to run this example. */
-    public static final int MIN_MEMORY = 1024 * 1024 * 1024;
-
-    /** Number of entries to load. */
-    private static final int ENTRY_COUNT = 100_000;
-
-    /** Global person ID to use across entire example. */
-    private static final Long id = Math.abs(UUID.randomUUID().getLeastSignificantBits());
-
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     * @throws IgniteException If example execution failed.
-     */
-    public static void main(String[] args) throws IgniteException {
-        ExamplesUtils.checkMinMemory(MIN_MEMORY);
-
-        // To start ignite with desired configuration uncomment the appropriate line.
-        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
-            System.out.println();
-            System.out.println(">>> Cache store example started.");
-
-            CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>(CACHE_NAME);
-
-            // Set atomicity as transaction, since we are showing transactions in example.
-            cacheCfg.setAtomicityMode(TRANSACTIONAL);
-
-            // Configure Hibernate store.
-            cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(CacheHibernatePersonStore.class));
-
-            // Configure Hibernate session listener.
-            cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
-                @Override public CacheStoreSessionListener create() {
-                    CacheHibernateStoreSessionListener lsnr = new CacheHibernateStoreSessionListener();
-
-                    lsnr.setHibernateConfigurationPath(HIBERNATE_CFG);
-
-                    return lsnr;
-                }
-            });
-
-            cacheCfg.setReadThrough(true);
-            cacheCfg.setWriteThrough(true);
-
-            try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheCfg)) {
-                // Make initial cache loading from persistent store. This is a
-                // distributed operation and will call CacheStore.loadCache(...)
-                // method on all nodes in topology.
-                loadCache(cache);
-
-                // Start transaction and execute several cache operations with
-                // read/write-through to persistent store.
-                executeTransaction(cache);
-            }
-        }
-    }
-
-    /**
-     * Makes initial cache loading.
-     *
-     * @param cache Cache to load.
-     */
-    private static void loadCache(IgniteCache<Long, Person> cache) {
-        long start = System.currentTimeMillis();
-
-        // Start loading cache from persistent store on all caching nodes.
-        cache.loadCache(null, ENTRY_COUNT);
-
-        long end = System.currentTimeMillis();
-
-        System.out.println(">>> Loaded " + cache.size() + " keys with backups in " + (end - start) + "ms.");
-    }
-
-    /**
-     * Executes transaction with read/write-through to persistent store.
-     *
-     * @param cache Cache to execute transaction on.
-     */
-    private static void executeTransaction(IgniteCache<Long, Person> cache) {
-        try (Transaction tx = Ignition.ignite().transactions().txStart()) {
-            Person val = cache.get(id);
-
-            System.out.println("Read value: " + val);
-
-            val = cache.getAndPut(id, new Person(id, "Isaac", "Newton"));
-
-            System.out.println("Overwrote old value: " + val);
-
-            val = cache.get(id);
-
-            System.out.println("Read value: " + val);
-
-            tx.commit();
-        }
-
-        System.out.println("Read value after commit: " + cache.get(id));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
deleted file mode 100644
index 035ab98..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-
-<!DOCTYPE hibernate-mapping PUBLIC
-        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping default-access="field">
-    <class name="org.apache.ignite.examples.datagrid.store.Person" table="PERSONS">
-        <!-- ID. -->
-        <id name="id"/>
-
-        <!-- We only map data we are interested in. -->
-        <property name="firstName"/>
-        <property name="lastName"/>
-    </class>
-</hibernate-mapping>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
deleted file mode 100644
index 80a43e7..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-
-<!--
-  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.
--->
-
-<!DOCTYPE hibernate-configuration PUBLIC
-        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
-
-<!--
-    Hibernate configuration.
--->
-<hibernate-configuration>
-    <session-factory>
-        <!-- Database connection settings (private in-memory database). -->
-        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
-
-        <!-- Only validate the database schema on startup in production mode. -->
-        <property name="hbm2ddl.auto">update</property>
-
-        <!-- Do not output SQL. -->
-        <property name="show_sql">false</property>
-
-        <!-- Mappings. -->
-        <mapping resource="org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml"/>
-    </session-factory>
-</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java
deleted file mode 100644
index 7a6d6de..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Contains Hibernate-based cache store implementation.
- */
-package org.apache.ignite.examples.datagrid.store.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
deleted file mode 100644
index 1ca9b59..0000000
--- a/examples/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples;
-
-import org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample;
-
-/**
- * Multi-node test for {@link HibernateL2CacheExample}.
- */
-public class HibernateL2CacheExampleMultiNodeSelfTest extends HibernateL2CacheExampleSelfTest {
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        for (int i = 0; i < RMT_NODES_CNT; i++)
-            startGrid("node-" + i, "examples/config/example-ignite.xml");
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java
deleted file mode 100644
index 5f55e82..0000000
--- a/examples/src/test/java/org/apache/ignite/examples/HibernateL2CacheExampleSelfTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples;
-
-import org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- * Tests the {@link HibernateL2CacheExample}.
- */
-public class HibernateL2CacheExampleSelfTest extends GridAbstractExamplesTest {
-    /**
-     * @throws Exception If failed.
-     */
-    public void testHibernateL2CacheExample() throws Exception {
-        HibernateL2CacheExample.main(EMPTY_ARGS);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
index 4669ae4..57ff3ff 100644
--- a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
+++ b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
@@ -32,8 +32,6 @@ import org.apache.ignite.examples.DeploymentExamplesMultiNodeSelfTest;
 import org.apache.ignite.examples.DeploymentExamplesSelfTest;
 import org.apache.ignite.examples.EventsExamplesMultiNodeSelfTest;
 import org.apache.ignite.examples.EventsExamplesSelfTest;
-import org.apache.ignite.examples.HibernateL2CacheExampleMultiNodeSelfTest;
-import org.apache.ignite.examples.HibernateL2CacheExampleSelfTest;
 import org.apache.ignite.examples.IgfsExamplesSelfTest;
 import org.apache.ignite.examples.LifecycleExamplesSelfTest;
 import org.apache.ignite.examples.MemcacheRestExamplesMultiNodeSelfTest;
@@ -78,7 +76,6 @@ public class IgniteExamplesSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(SpringBeanExamplesSelfTest.class));
         suite.addTest(new TestSuite(IgfsExamplesSelfTest.class));
         suite.addTest(new TestSuite(CheckpointExamplesSelfTest.class));
-        suite.addTest(new TestSuite(HibernateL2CacheExampleSelfTest.class));
         suite.addTest(new TestSuite(ClusterGroupExampleSelfTest.class));
 
         // Multi-node.
@@ -91,7 +88,6 @@ public class IgniteExamplesSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(TaskExamplesMultiNodeSelfTest.class));
         suite.addTest(new TestSuite(MemcacheRestExamplesMultiNodeSelfTest.class));
         suite.addTest(new TestSuite(MonteCarloExamplesMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(HibernateL2CacheExampleMultiNodeSelfTest.class));
 
         return suite;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java b/examples/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
deleted file mode 100644
index 737d498..0000000
--- a/examples/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleMultiNodeSelfTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.java8.examples;
-
-/**
- * Multi-node test for {@link org.apache.ignite.examples.java8.datagrid.hibernate.HibernateL2CacheExample}.
- */
-public class HibernateL2CacheExampleMultiNodeSelfTest extends HibernateL2CacheExampleSelfTest {
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        for (int i = 0; i < RMT_NODES_CNT; i++)
-            startGrid("node-" + i, "examples/config/example-ignite.xml");
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java b/examples/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java
deleted file mode 100644
index 8c7a2de..0000000
--- a/examples/src/test/java8/org/apache/ignite/java8/examples/HibernateL2CacheExampleSelfTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.java8.examples;
-
-//import org.apache.ignite.examples.java8.datagrid.hibernate.*;
-
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- * Tests the {@link org.apache.ignite.examples.java8.datagrid.hibernate.HibernateL2CacheExample}.
- */
-public class HibernateL2CacheExampleSelfTest extends GridAbstractExamplesTest {
-    /**
-     * TODO: IGNITE-711 next example(s) should be implemented for java 8
-     * or testing method(s) should be removed if example(s) does not applicable for java 8.
-     *
-     * @throws Exception If failed.
-     */
-//    public void testHibernateL2CacheExample() throws Exception {
-//        HibernateL2CacheExample.main(EMPTY_ARGS);
-//    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 208dbbc..7b8763f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -458,7 +458,6 @@
             </modules>
         </profile>
 
-
         <profile>
             <id>lgpl</id>
             <modules>
@@ -466,6 +465,63 @@
                 <module>modules/geospatial</module>
                 <module>modules/schedule</module>
             </modules>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-assembly-plugin</artifactId>
+                        <dependencies>
+                            <dependency>
+                                <groupId>org.apache.apache.resources</groupId>
+                                <artifactId>apache-source-release-assembly-descriptor</artifactId>
+                                <version>1.0.4</version>
+                            </dependency>
+                        </dependencies>
+                        <executions>
+                            <execution>
+                                <id>release-lgpl</id>
+                                <phase>prepare-package</phase>
+                                <goals>
+                                    <goal>single</goal>
+                                </goals>
+                                <configuration>
+                                    <descriptors>
+                                        <descriptor>assembly/release-${ignite.edition}-lgpl.xml</descriptor>
+                                    </descriptors>
+                                    <finalName>release-package</finalName>
+                                    <appendAssemblyId>false</appendAssemblyId>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <version>1.7</version>
+                        <inherited>false</inherited>
+                        <executions>
+                            <execution>
+                                <id>release-postprocessing-lgpl</id>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                                <phase>package</phase>
+                                <configuration>
+                                    <target>
+                                        <replaceregexp file="${basedir}/target/release-package/examples-lgpl/pom.xml"
+                                                       byline="true">
+                                            <regexp pattern="to_be_replaced_by_ignite_version"/>
+                                            <substitution expression="${project.version}"/>
+                                        </replaceregexp>
+                                    </target>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                </plugins>
+            </build>
         </profile>
 
         <profile>
@@ -477,6 +533,13 @@
         </profile>
 
         <profile>
+            <id>examples-lgpl</id>
+            <modules>
+                <module>examples-lgpl</module>
+            </modules>
+        </profile>
+
+        <profile>
             <id>apache-release</id>
             <build>
                 <plugins>


[06/11] ignite git commit: fix compilation under java7

Posted by sb...@apache.org.
fix compilation under java7


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

Branch: refs/heads/ignite-1093-2
Commit: 4d1c02669602bef6e696494ccd7382c967d2f962
Parents: 077af17
Author: ashutak <as...@gridgain.com>
Authored: Thu Oct 15 17:09:27 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Oct 15 17:09:27 2015 +0300

----------------------------------------------------------------------
 .../CacheNearDisabledTransactionalWriteReadRestartSelfTest.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4d1c0266/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalWriteReadRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalWriteReadRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalWriteReadRestartSelfTest.java
index 875aef3..148a95db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalWriteReadRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledTransactionalWriteReadRestartSelfTest.java
@@ -69,7 +69,7 @@ public class CacheNearDisabledTransactionalWriteReadRestartSelfTest extends Cach
     }
 
     /** {@inheritDoc} */
-    @Override protected void updateCache(IgniteEx ignite, IgniteCache cache) throws Exception {
+    @Override protected void updateCache(IgniteEx ignite, final IgniteCache cache) throws Exception {
         final int k = ThreadLocalRandom.current().nextInt(RANGE);
 
         final String[] keys = new String[KEYS_CNT];


[11/11] ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-1093-2

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-1093-2


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

Branch: refs/heads/ignite-1093-2
Commit: 3d1a95fd68273e450734ffd9b65e3e4ca19f3e32
Parents: 9d64c7f 02b59e4
Author: Anton Vinogradov <av...@gridgain.com>
Authored: Fri Oct 16 23:52:34 2015 +0300
Committer: Anton Vinogradov <av...@gridgain.com>
Committed: Fri Oct 16 23:52:34 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |   3 +-
 assembly/dependencies-hadoop.xml                |   1 +
 assembly/release-fabric-lgpl.xml                |  63 ++++
 assembly/release-hadoop-lgpl.xml                |  39 ++
 examples-lgpl/README.txt                        |  27 ++
 examples-lgpl/config/example-cache.xml          |  73 ++++
 examples-lgpl/config/example-ignite.xml         |  83 +++++
 examples-lgpl/config/filesystem/README.txt      |   8 +
 examples-lgpl/config/filesystem/core-site.xml   |  42 +++
 .../config/filesystem/example-igfs.xml          | 151 ++++++++
 examples-lgpl/config/hibernate/README.txt       |   8 +
 .../hibernate/example-hibernate-L2-cache.xml    |  64 ++++
 examples-lgpl/config/servlet/README.txt         |   8 +
 examples-lgpl/config/servlet/WEB-INF/web.xml    |  36 ++
 examples-lgpl/pom-standalone.xml                | 141 ++++++++
 examples-lgpl/pom.xml                           | 128 +++++++
 .../hibernate/HibernateL2CacheExample.java      | 245 +++++++++++++
 .../examples/datagrid/hibernate/Post.java       | 130 +++++++
 .../examples/datagrid/hibernate/User.java       | 154 ++++++++
 .../datagrid/hibernate/package-info.java        |  22 ++
 .../hibernate/CacheHibernatePersonStore.java    | 122 +++++++
 .../hibernate/CacheHibernateStoreExample.java   | 151 ++++++++
 .../datagrid/store/hibernate/Person.hbm.xml     |  34 ++
 .../datagrid/store/hibernate/hibernate.cfg.xml  |  41 +++
 .../datagrid/store/hibernate/package-info.java  |  22 ++
 .../java8/cluster/ClusterGroupExample.java      |  86 +++++
 .../examples/java8/cluster/package-info.java    |  22 ++
 .../java8/computegrid/ComputeAsyncExample.java  |  75 ++++
 .../computegrid/ComputeBroadcastExample.java    | 102 ++++++
 .../computegrid/ComputeCallableExample.java     |  75 ++++
 .../computegrid/ComputeClosureExample.java      |  71 ++++
 .../computegrid/ComputeRunnableExample.java     |  64 ++++
 .../java8/computegrid/package-info.java         |  22 ++
 .../java8/datagrid/CacheAffinityExample.java    | 137 +++++++
 .../java8/datagrid/CacheApiExample.java         | 105 ++++++
 .../java8/datagrid/CacheAsyncApiExample.java    |  85 +++++
 .../examples/java8/datagrid/package-info.java   |  22 ++
 .../IgniteExecutorServiceExample.java           |  70 ++++
 .../java8/datastructures/package-info.java      |  22 ++
 .../examples/java8/events/EventsExample.java    | 135 +++++++
 .../examples/java8/events/package-info.java     |  22 ++
 .../java8/messaging/MessagingExample.java       | 166 +++++++++
 .../messaging/MessagingPingPongExample.java     | 113 ++++++
 .../examples/java8/messaging/package-info.java  |  22 ++
 .../misc/schedule/ComputeScheduleExample.java   |  68 ++++
 .../java8/misc/schedule/package-info.java       |  22 ++
 .../ignite/examples/java8/package-info.java     |  23 ++
 .../streaming/StreamTransformerExample.java     | 101 ++++++
 .../java8/streaming/StreamVisitorExample.java   | 172 +++++++++
 .../examples/java8/streaming/package-info.java  |  22 ++
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  31 ++
 .../HibernateL2CacheExampleSelfTest.java        |  33 ++
 .../IgniteLgplExamplesSelfTestSuite.java        |  48 +++
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  29 ++
 .../HibernateL2CacheExampleSelfTest.java        |  37 ++
 .../IgniteLgplExamplesJ8SelfTestSuite.java      |  46 +++
 examples/pom-standalone.xml                     |  12 -
 examples/pom.xml                                |  12 -
 .../hibernate/HibernateL2CacheExample.java      | 245 -------------
 .../examples/datagrid/hibernate/Post.java       | 130 -------
 .../examples/datagrid/hibernate/User.java       | 154 --------
 .../datagrid/hibernate/package-info.java        |  22 --
 .../hibernate/CacheHibernatePersonStore.java    | 122 -------
 .../hibernate/CacheHibernateStoreExample.java   | 151 --------
 .../datagrid/store/hibernate/Person.hbm.xml     |  34 --
 .../datagrid/store/hibernate/hibernate.cfg.xml  |  41 ---
 .../datagrid/store/hibernate/package-info.java  |  22 --
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  31 --
 .../HibernateL2CacheExampleSelfTest.java        |  33 --
 .../testsuites/IgniteExamplesSelfTestSuite.java |   4 -
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  29 --
 .../HibernateL2CacheExampleSelfTest.java        |  37 --
 .../processors/cache/GridCacheAdapter.java      | 357 +++++++++++--------
 .../cache/GridCacheClearAllRunnable.java        |  18 +-
 .../cache/GridCacheConcurrentMap.java           |   4 +-
 .../processors/cache/GridCacheProxyImpl.java    |  14 +-
 .../processors/cache/IgniteCacheProxy.java      |   2 +-
 .../processors/cache/IgniteInternalCache.java   |  19 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |   6 +-
 .../distributed/near/GridNearCacheAdapter.java  |  21 +-
 .../near/GridNearCacheClearAllRunnable.java     |   9 +-
 .../ignite/spi/deployment/DeploymentSpi.java    |   8 +-
 modules/core/src/test/config/tests.properties   |   3 +
 .../cache/GridCacheClearSelfTest.java           | 308 ++++++++++++++++
 .../CacheAbstractRestartSelfTest.java           | 247 +++++++++++++
 ...NearDisabledAtomicInvokeRestartSelfTest.java | 179 ++++++++++
 ...abledTransactionalInvokeRestartSelfTest.java | 173 +++++++++
 ...edTransactionalWriteReadRestartSelfTest.java | 124 +++++++
 .../dht/GridCacheDhtEntrySelfTest.java          |   2 +-
 .../IgniteCacheFullApiSelfTestSuite.java        |   8 +-
 .../IgniteCacheLoadConsistencyTestSuite.java    |  42 +++
 modules/extdata/uri/pom.xml                     |  11 +-
 .../spi/deployment/uri/UriDeploymentSpi.java    |  93 +++--
 .../scanners/http/UriDeploymentHttpScanner.java |  10 +-
 .../http/GridHttpDeploymentSelfTest.java        | 132 ++++++-
 pom.xml                                         |  65 +++-
 96 files changed, 5463 insertions(+), 1315 deletions(-)
----------------------------------------------------------------------



[08/11] ignite git commit: IGNITE-1555. Combine ignite-hadoop and ignite-spark into signle assembly for downstream consumption.

Posted by sb...@apache.org.
IGNITE-1555. Combine ignite-hadoop and ignite-spark into signle assembly for downstream consumption.


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

Branch: refs/heads/ignite-1093-2
Commit: c9eb539b565bf0a49dbe8dc936c1b2f165946805
Parents: 8217be6
Author: Konstantin Boudnik <co...@wandisco.com>
Authored: Fri Oct 9 20:54:30 2015 -0700
Committer: Konstantin Boudnik <co...@wandisco.com>
Committed: Thu Oct 15 14:01:50 2015 -0700

----------------------------------------------------------------------
 DEVNOTES.txt                     | 3 ++-
 assembly/dependencies-hadoop.xml | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c9eb539b/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index a46b73d..a6c45f0 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -23,7 +23,8 @@ mvn clean package -DskipTests -Dignite.edition=hadoop [-Dhadoop.version=X.X.X]
 
 Use 'hadoop.version' parameter to build Ignite against a specific Hadoop version.
 
-Look for apache-ignite-hadoop-<version>-bin.zip in ./target/bin directory.
+Look for apache-ignite-hadoop-<version>-bin.zip in ./target/bin directory. Resulting binary
+assembly will also include integration module for Apache Spark.
 
 NOTE: JDK version should be 1.7.0-* or >= 1.8.0-u40.
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c9eb539b/assembly/dependencies-hadoop.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-hadoop.xml b/assembly/dependencies-hadoop.xml
index 0e282a4..38646ba 100644
--- a/assembly/dependencies-hadoop.xml
+++ b/assembly/dependencies-hadoop.xml
@@ -32,6 +32,7 @@
     <moduleSets>
         <moduleSet>
             <includes>
+                <include>org.apache.ignite:ignite-spark</include>
                 <include>org.apache.ignite:ignite-spring</include>
                 <include>org.apache.ignite:ignite-log4j</include>
                 <include>org.apache.ignite:ignite-indexing</include>


[10/11] ignite git commit: ignite-1559: UriDeploymentHttpScanner tests and javadoc

Posted by sb...@apache.org.
ignite-1559: UriDeploymentHttpScanner tests and javadoc


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

Branch: refs/heads/ignite-1093-2
Commit: 02b59e433bce7a4c3eece7a80e7a053ae0d69373
Parents: a228c24
Author: Artem SHutak <as...@gridgain.com>
Authored: Thu Oct 15 17:18:15 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Oct 15 17:18:15 2015 -0700

----------------------------------------------------------------------
 .../ignite/spi/deployment/DeploymentSpi.java    |   8 +-
 modules/core/src/test/config/tests.properties   |   3 +
 modules/extdata/uri/pom.xml                     |  11 +-
 .../spi/deployment/uri/UriDeploymentSpi.java    |  93 ++++++++-----
 .../scanners/http/UriDeploymentHttpScanner.java |  10 +-
 .../http/GridHttpDeploymentSelfTest.java        | 132 +++++++++++++++++--
 6 files changed, 204 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/02b59e43/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java
index 7a1f709..af09e48 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/deployment/DeploymentSpi.java
@@ -46,13 +46,13 @@ import org.jetbrains.annotations.Nullable;
  * local deployment.
  * </strong>
  * <p>
- * Ignite provides the following {@code GridDeploymentSpi} implementations:
+ * Ignite provides following {@code GridDeploymentSpi} implementations out of the box:
  * <ul>
  * <li>{@link org.apache.ignite.spi.deployment.local.LocalDeploymentSpi}</li>
  * <li>{@ignitelink org.apache.ignite.spi.deployment.uri.UriDeploymentSpi}</li>
  * </ul>
- * <b>NOTE:</b> this SPI (i.e. methods in this interface) should never be used directly. SPIs provide
- * internal view on the subsystem and is used internally by Ignite kernal. In rare use cases when
+ * <b>NOTE:</b> SPI methods should never be used directly. SPIs provide
+ * internal view on the subsystem and is used internally by Ignite. In rare use cases when
  * access to a specific implementation of this SPI is required - an instance of this SPI can be obtained
  * via {@link org.apache.ignite.Ignite#configuration()} method to check its configuration properties or call other non-SPI
  * methods. Note again that calling methods from this interface on the obtained instance can lead
@@ -104,4 +104,4 @@ public interface DeploymentSpi extends IgniteSpi {
      * @param lsnr Listener for deployment events. {@code null} to unset the listener.
      */
     public void setListener(@Nullable DeploymentListener lsnr);
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/02b59e43/modules/core/src/test/config/tests.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/tests.properties b/modules/core/src/test/config/tests.properties
index ce6d4d8..49e616e 100644
--- a/modules/core/src/test/config/tests.properties
+++ b/modules/core/src/test/config/tests.properties
@@ -67,7 +67,10 @@ ant.gar.srcdir=@{IGNITE_HOME}/modules/extdata/uri/target/classes/
 # GAR paths to use in URI deployment SPI tests
 ant.urideployment.gar.uri=file://freq=5000@localhost/EXTDATA/uri/target/deploy
 ant.urideployment.gar.file=modules/extdata/uri/target/deploy/uri.gar
+ant.urideployment.gar.libs-file=modules/extdata/uri/target/deploy/uri-libs.gar
+ant.urideployment.gar.classes-file=modules/extdata/uri/target/deploy/uri-classes.gar
 ant.urideployment.gar.path=modules/extdata/uri/target/deploy/
+ant.urideployment.gar.path.tmp=modules/extdata/uri/target/deploy_tmp/
 
 # Classpath directory for GridP2PUserVersionChangeSelfTest
 ant.userversion.class.dir=@{IGNITE_HOME}/modules/tests/java/

http://git-wip-us.apache.org/repos/asf/ignite/blob/02b59e43/modules/extdata/uri/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/pom.xml b/modules/extdata/uri/pom.xml
index d9a9297..d5e6349 100644
--- a/modules/extdata/uri/pom.xml
+++ b/modules/extdata/uri/pom.xml
@@ -144,14 +144,23 @@
                                     </fileset>
                                 </copy>
 
-                                <copy file="${settings.localRepository}/com/sun/mail/javax.mail/1.5.2/javax.mail-1.5.2.jar" todir="${basedir}/target/classes/lib" />
+                                <copy file="${settings.localRepository}/com/sun/mail/javax.mail/1.5.2/javax.mail-1.5.2.jar" todir="${basedir}/target/libs" />
 
                                 <zip destfile="${basedir}/target/classes/lib/depend.jar" encoding="UTF-8">
                                     <zipfileset dir="modules/uri-dependency/target/classes" />
                                 </zip>
 
+                                <copy file="${basedir}/target/classes/lib/depend.jar" todir="${basedir}/target/libs" />
+
+                                <mkdir dir="${basedir}/target/deploy_tmp/"/>
+
                                 <taskdef name="gar" classname="org.apache.ignite.util.antgar.IgniteDeploymentGarAntTask" />
 
+                                <gar destfile="${basedir}/target/deploy/uri-classes.gar" basedir="${basedir}/target/classes" />
+                                <gar destfile="${basedir}/target/deploy/uri-libs.gar" basedir="${basedir}/target/libs" />
+
+                                <copy file="${settings.localRepository}/com/sun/mail/javax.mail/1.5.2/javax.mail-1.5.2.jar" todir="${basedir}/target/classes/lib" />
+
                                 <gar destfile="${basedir}/target/deploy/uri.gar" basedir="${basedir}/target/classes" />
 
                                 <!--

http://git-wip-us.apache.org/repos/asf/ignite/blob/02b59e43/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
index c48398d..5f65731 100644
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
+++ b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
@@ -80,7 +80,7 @@ import org.jetbrains.annotations.Nullable;
  * <p>
  * SPI tracks all changes of every given URI. This means that if any file is
  * changed or deleted, SPI will re-deploy or delete corresponding tasks.
- * Note that the very first apply to {@link #findResource(String)} findClassLoader(String)}
+ * Note that the very first apply to {@link #findResource(String)}
  * is blocked until SPI finishes scanning all URI's at least once.
  * <p>
  * There are several deployable unit types supported:
@@ -145,11 +145,33 @@ import org.jetbrains.annotations.Nullable;
  * URI 'path' field will be automatically encoded. By default this flag is
  * set to {@code true}.
  * <p>
+ * <h1 class="header">Code Example</h1>
+ * The following example demonstrates how the deployment SPI can be used. It expects that you have a GAR file
+ * in 'home/username/ignite/work/my_deployment/file' folder which contains 'myproject.HelloWorldTask' class.
+ * <pre name="code" class="java">
+ * IgniteConfiguration cfg = new IgniteConfiguration();
+ *
+ * DeploymentSpi deploymentSpi = new UriDeploymentSpi();
+ *
+ * deploymentSpi.setUriList(Arrays.asList("file:///home/username/ignite/work/my_deployment/file"));
+ *
+ * cfg.setDeploymentSpi(deploymentSpi);
+ *
+ * try (Ignite ignite = Ignition.start(cfg)) {
+ *     ignite.compute().execute("myproject.HelloWorldTask", "my args");
+ * }
+ * </pre>
  * <h1 class="header">Configuration</h1>
  * {@code UriDeploymentSpi} has the following optional configuration
  * parameters (there are no mandatory parameters):
  * <ul>
  * <li>
+ * Array of {@link UriDeploymentScanner}-s which will be used to deploy resources
+ * (see {@link #setScanners(UriDeploymentScanner...)}). If not specified, preconfigured {@link UriDeploymentFileScanner}
+ * and {@link UriDeploymentHttpScanner} are used. You can implement your own scanner
+ * by implementing {@link UriDeploymentScanner} interface.
+ * </li>
+ * <li>
  * Temporary directory path where scanned GAR files and directories are
  * copied to (see {@link #setTemporaryDirectoryPath(String) setTemporaryDirectoryPath(String)}).
  * </li>
@@ -163,25 +185,28 @@ import org.jetbrains.annotations.Nullable;
  * </li>
  * </ul>
  * <h1 class="header">Protocols</h1>
- * Following protocols are supported in SPI:
+ * Following protocols are supported by this SPI out of the box:
  * <ul>
  * <li><a href="#file">file://</a> - File protocol</li>
- * <li><a href="#classes">classes://</a> - Custom File protocol.</li>
  * <li><a href="#http">http://</a> - HTTP protocol</li>
  * <li><a href="#http">https://</a> - Secure HTTP protocol</li>
  * </ul>
+ * <strong>Custom Protocols.</strong>
+ * <p>
+ * You can add support for additional protocols if needed. To do this implement UriDeploymentScanner interface and
+ * plug your implementation into the SPI via {@link #setScanners(UriDeploymentScanner...)} method.
+ * <p>
  * In addition to SPI configuration parameters, all necessary configuration
  * parameters for selected URI should be defined in URI. Different protocols
  * have different configuration parameters described below. Parameters are
  * separated by '{@code ;}' character.
  * <p>
- * <a name="file"></a>
  * <h1 class="header">File</h1>
  * For this protocol SPI will scan folder specified by URI on file system and
  * download any GAR files or directories that end with .gar from source
  * directory defined in URI. For file system URI must have scheme equal to {@code file}.
  * <p>
- * Following parameters are supported for FILE protocol:
+ * Following parameters are supported:
  * <table class="doctable">
  *  <tr>
  *      <th>Parameter</th>
@@ -189,24 +214,29 @@ import org.jetbrains.annotations.Nullable;
  *      <th>Optional</th>
  *      <th>Default</th>
  *  </tr>
+ *  <tr>
+ *      <td>freq</td>
+ *      <td>Scanning frequency in milliseconds.</td>
+ *      <td>Yes</td>
+ *      <td>{@code 5000} ms specified in {@link UriDeploymentFileScanner#DFLT_SCAN_FREQ}.</td>
+ *  </tr>
  * </table>
  * <h2 class="header">File URI Example</h2>
  * The following example will scan {@code 'c:/Program files/ignite/deployment'}
- * folder on local box every {@code '5000'} milliseconds. Note that since path
+ * folder on local box every {@code '1000'} milliseconds. Note that since path
  * has spaces, {@link #setEncodeUri(boolean) setEncodeUri(boolean)} parameter must
  * be set to {@code true} (which is default behavior).
  * <blockquote class="snippet">
- * {@code file://freq=5000@localhost/c:/Program files/ignite/deployment}
+ * {@code file://freq=2000@localhost/c:/Program files/ignite/deployment}
  * </blockquote>
  * <a name="classes"></a>
- * <h1 class="header">Classes</h1>
- * For this protocol SPI will scan folder specified by URI on file system
- * looking for compiled classes that implement {@link org.apache.ignite.compute.ComputeTask} interface.
- * This protocol comes very handy during development, as it allows developer
- * to specify IDE compilation output folder as URI and all task classes
- * in that folder will be deployed automatically.
+ * <h2 class="header">HTTP/HTTPS</h2>
+ * URI deployment scanner tries to read DOM of the html it points to and parses out href attributes of all &lt;a&gt; tags
+ * - this becomes the collection of URLs to GAR files that should be deployed. It's important that HTTP scanner
+ * uses {@code URLConnection.getLastModified()} method to check if there were any changes since last iteration
+ * for each GAR-file before redeploying.
  * <p>
- * Following parameters are supported for CLASSES protocol:
+ * Following parameters are supported:
  * <table class="doctable">
  *  <tr>
  *      <th>Parameter</th>
@@ -214,20 +244,17 @@ import org.jetbrains.annotations.Nullable;
  *      <th>Optional</th>
  *      <th>Default</th>
  *  </tr>
+ *  <tr>
+ *      <td>freq</td>
+ *      <td>Scanning frequency in milliseconds.</td>
+ *      <td>Yes</td>
+ *      <td>{@code 300000} ms specified in {@link UriDeploymentHttpScanner#DFLT_SCAN_FREQ}.</td>
+ *  </tr>
  * </table>
- * <h2 class="header">Classes URI Example</h2>
- * The following example will scan {@code 'c:/Program files/ignite/deployment'}
- * folder on local box every {@code '5000'} milliseconds. Note that since path
- * has spaces, {@link #setEncodeUri(boolean) setEncodeUri(boolean)} parameter must
- * be set to {@code true} (which is default behavior).
- * <blockquote class="snippet">
- * {@code classes://freq=5000@localhost/c:/Program files/ignite/deployment}
- * </blockquote>
- * <a name="http"></a>
  * <h2 class="header">HTTP URI Example</h2>
- * The following example will scan {@code 'ignite/deployment'} folder with
- * on site {@code 'www.mysite.com'} using authentication
- * {@code 'username:password'} every {@code '10000'} milliseconds.
+ * The following example will download the page `www.mysite.com/ignite/deployment`, parse it and download and deploy
+ * all GAR files specified by href attributes of &lt;a&gt; elements on the page using authentication
+ * {@code 'username:password'} every '10000' milliseconds (only new/updated GAR-s).
  * <blockquote class="snippet">
  * {@code http://username:password;freq=10000@www.mysite.com:110/ignite/deployment}
  * </blockquote>
@@ -238,14 +265,9 @@ import org.jetbrains.annotations.Nullable;
  *
  * IgniteConfiguration cfg = new IgniteConfiguration();
  *
- * List&lt;String&gt; uris = new ArrayList&lt;String&gt;(5);
- *
- * uris.add("http://www.site.com/tasks");
- * uris.add("file://freq=20000@localhost/c:/Program files/gg-deployment");
- * uris.add("classes:///c:/Java_Projects/myproject/out");
- *
  * // Set URIs.
- * deploySpi.setUriList(uris);
+ * deploySpi.setUriList(Arrays.asList("http://www.site.com/tasks",
+ *     "file://freq=20000@localhost/c:/Program files/gg-deployment"));
  *
  * // Override temporary directory path.
  * deploySpi.setTemporaryDirectoryPath("c:/tmp/grid");
@@ -254,7 +276,7 @@ import org.jetbrains.annotations.Nullable;
  * cfg.setDeploymentSpi(deploySpi);
  *
  * //  Start grid.
- * G.start(cfg);
+ * Ignition.start(cfg);
  * </pre>
  * <p>
  * <h2 class="header">Spring Example</h2>
@@ -269,7 +291,6 @@ import org.jetbrains.annotations.Nullable;
  *                     &lt;list&gt;
  *                         &lt;value&gt;http://www.site.com/tasks&lt;/value&gt;
  *                         &lt;value&gt;file://freq=20000@localhost/c:/Program files/gg-deployment&lt;/value&gt;
- *                         &lt;value&gt;classes:///c:/Java_Projects/myproject/out&lt;/value&gt;
  *                     &lt;/list&gt;
  *                 &lt;/property&gt;
  *             &lt;/bean&gt;
@@ -1325,4 +1346,4 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
     @Override public String toString() {
         return S.toString(UriDeploymentSpi.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/02b59e43/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/http/UriDeploymentHttpScanner.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/http/UriDeploymentHttpScanner.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/http/UriDeploymentHttpScanner.java
index ef29752..48bfd7f 100644
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/http/UriDeploymentHttpScanner.java
+++ b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/http/UriDeploymentHttpScanner.java
@@ -60,11 +60,15 @@ import org.w3c.dom.NodeList;
 import org.w3c.tidy.Tidy;
 
 /**
- * URI deployment HTTP scanner.
+ * HTTP-based URI deployment scanner.
+ * <p>
+ * This scanner reads DOM of the HTML available via {@link UriDeploymentScannerContext#getUri()}
+ * and parses out href attributes of all {@code &lt;a&gt;} tags -
+ * they become the collection of URLs to GAR files that should be deployed.
  */
 public class UriDeploymentHttpScanner implements UriDeploymentScanner {
     /** Default scan frequency. */
-    private static final int DFLT_SCAN_FREQ = 300000;
+    public static final int DFLT_SCAN_FREQ = 300000;
 
     /** Secure socket protocol to use. */
     private static final String PROTOCOL = "TLS";
@@ -501,4 +505,4 @@ public class UriDeploymentHttpScanner implements UriDeploymentScanner {
             return true;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/02b59e43/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
index 216d0ab..c0044c3 100644
--- a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
+++ b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.spi.deployment.uri.scanners.http;
 
+import java.io.File;
+import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
@@ -38,8 +40,35 @@ import static org.eclipse.jetty.http.HttpHeader.LAST_MODIFIED;
  */
 @GridSpiTest(spi = UriDeploymentSpi.class, group = "Deployment SPI")
 public class GridHttpDeploymentSelfTest extends GridUriDeploymentAbstractSelfTest {
+    /** Frequency */
+    private static final int FREQ = 5000;
+
+    /** */
+    public static final String LIBS_GAR = "libs-file.gar";
+
+    /** */
+    public static final String CLASSES_GAR = "classes-file.gar";
+
+    /** */
+    public static final String ALL_GAR = "file.gar";
+
+    /** Gar-file which contains libs. */
+    public static final String LIBS_GAR_FILE_PATH = U.resolveIgnitePath(
+        GridTestProperties.getProperty("ant.urideployment.gar.libs-file")).getPath();
+
+    /** Gar-file which contains classes (cannot be used without libs). */
+    public static final String CLASSES_GAR_FILE_PATH = U.resolveIgnitePath(
+        GridTestProperties.getProperty("ant.urideployment.gar.classes-file")).getPath();
+
+    /** Gar-file which caontains both libs and classes. */
+    public static final String ALL_GAR_FILE_PATH = U.resolveIgnitePath(
+        GridTestProperties.getProperty("ant.urideployment.gar.file")).getPath();
+
     /** Jetty. */
-    private Server srv;
+    private static Server srv;
+
+    /** Resource base. */
+    private static String rsrcBase;
 
     /** {@inheritDoc} */
     @Override protected void beforeSpiStarted() throws Exception {
@@ -60,8 +89,12 @@ public class GridHttpDeploymentSelfTest extends GridUriDeploymentAbstractSelfTes
         };
 
         hnd.setDirectoriesListed(true);
-        hnd.setResourceBase(
-            U.resolveIgnitePath(GridTestProperties.getProperty("ant.urideployment.gar.path")).getPath());
+
+        File resourseBaseDir = U.resolveIgnitePath(GridTestProperties.getProperty("ant.urideployment.gar.path.tmp"));
+
+        rsrcBase = resourseBaseDir.getPath();
+
+        hnd.setResourceBase(rsrcBase);
 
         srv.setHandler(hnd);
 
@@ -82,11 +115,63 @@ public class GridHttpDeploymentSelfTest extends GridUriDeploymentAbstractSelfTes
     }
 
     /**
-     * @throws Exception if failed.
+     * @throws Exception If failed.
      */
-    public void testDeployment() throws Exception {
-        checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3");
-        checkTask("GridUriDeploymentTestWithNameTask3");
+    public void testDeployUndeploy2Files() throws Exception {
+        checkNoTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3");
+
+        try {
+            copyToResourceBase(LIBS_GAR_FILE_PATH, LIBS_GAR);
+
+            copyToResourceBase(CLASSES_GAR_FILE_PATH, CLASSES_GAR);
+
+            Thread.sleep(FREQ + 3000);
+
+            checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3");
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+        finally {
+            deleteFromResourceBase(LIBS_GAR);
+            deleteFromResourceBase(CLASSES_GAR);
+
+            Thread.sleep(FREQ + 3000);
+
+            checkNoTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3");
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSameContantFiles() throws Exception {
+        checkNoTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3");
+
+        try {
+            copyToResourceBase(ALL_GAR_FILE_PATH, ALL_GAR);
+
+            Thread.sleep(FREQ + 3000);
+
+            checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3");
+
+            copyToResourceBase(ALL_GAR_FILE_PATH, "file-copy.gar");
+
+            Thread.sleep(FREQ + 3000);
+
+            checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3");
+        }
+        catch (Throwable e) {
+            e.printStackTrace();
+        }
+        finally {
+            deleteFromResourceBase(ALL_GAR);
+            deleteFromResourceBase("file-copy.gar");
+
+            Thread.sleep(FREQ + 3000);
+
+            checkNoTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3");
+        }
     }
 
     /**
@@ -94,6 +179,35 @@ public class GridHttpDeploymentSelfTest extends GridUriDeploymentAbstractSelfTes
      */
     @GridSpiTestConfig
     public List<String> getUriList() {
-        return Collections.singletonList("http://freq=5000@localhost:8080/");
+        return Collections.singletonList("http://freq="+FREQ+"@localhost:8080/");
+    }
+
+    /**
+     * @param fileName File name.
+     */
+    private void deleteFromResourceBase(String fileName) {
+        File file = new File(rsrcBase + '/' + fileName);
+
+        if (!file.delete())
+            U.warn(log, "Could not delete file: " + file);
+    }
+
+    /**
+     * @param path Path to the file which should be copied.
+     * @param newFileName New file name.
+     * @throws IOException If exception.
+     */
+    private void copyToResourceBase(String path, String newFileName) throws IOException {
+        File file = new File(path);
+
+        assert file.exists() : "Test file not found [path=" + path + ']';
+
+        File newFile = new File(rsrcBase + '/' + newFileName);
+
+        assert !newFile.exists();
+
+        U.copy(file, newFile, false);
+
+        assert newFile.exists();
     }
-}
\ No newline at end of file
+}


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

Posted by sb...@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/f4d8ea91
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f4d8ea91
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f4d8ea91

Branch: refs/heads/ignite-1093-2
Commit: f4d8ea914e61981ff33e41aee498168b56063834
Parents: c4b0877 077af17
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Oct 15 17:00:01 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Oct 15 17:00:01 2015 +0300

----------------------------------------------------------------------
 .../CacheAbstractRestartSelfTest.java           | 247 +++++++++++++++++++
 ...NearDisabledAtomicInvokeRestartSelfTest.java | 179 ++++++++++++++
 ...abledTransactionalInvokeRestartSelfTest.java | 173 +++++++++++++
 ...edTransactionalWriteReadRestartSelfTest.java | 124 ++++++++++
 .../IgniteCacheLoadConsistencyTestSuite.java    |  42 ++++
 5 files changed, 765 insertions(+)
----------------------------------------------------------------------



[03/11] ignite git commit: IGNITE-1653

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/cluster/ClusterGroupExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/cluster/ClusterGroupExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/cluster/ClusterGroupExample.java
new file mode 100644
index 0000000..caea8a7
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/cluster/ClusterGroupExample.java
@@ -0,0 +1,86 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.cluster;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+
+/**
+ * Demonstrates new functional APIs.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class ClusterGroupExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            if (!ExamplesUtils.checkMinTopologySize(ignite.cluster(), 2))
+                return;
+
+            System.out.println();
+            System.out.println("Compute example started.");
+
+            IgniteCluster cluster = ignite.cluster();
+
+            // Say hello to all nodes in the cluster, including local node.
+            sayHello(ignite, cluster);
+
+            // Say hello to all remote nodes.
+            sayHello(ignite, cluster.forRemotes());
+
+            // Pick random node out of remote nodes.
+            ClusterGroup randomNode = cluster.forRemotes().forRandom();
+
+            // Say hello to a random node.
+            sayHello(ignite, randomNode);
+
+            // Say hello to all nodes residing on the same host with random node.
+            sayHello(ignite, cluster.forHost(randomNode.node()));
+
+            // Say hello to all nodes that have current CPU load less than 50%.
+            sayHello(ignite, cluster.forPredicate(n -> n.metrics().getCurrentCpuLoad() < 0.5));
+        }
+    }
+
+    /**
+     * Print 'Hello' message on remote nodes.
+     *
+     * @param ignite Ignite.
+     * @param grp Cluster group.
+     * @throws IgniteException If failed.
+     */
+    private static void sayHello(Ignite ignite, final ClusterGroup grp) throws IgniteException {
+        // Print out hello message on all cluster nodes.
+        ignite.compute(grp).broadcast(
+            () -> System.out.println(">>> Hello Node: " + grp.ignite().cluster().localNode().id()));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/cluster/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/cluster/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/cluster/package-info.java
new file mode 100644
index 0000000..b96e98a
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/cluster/package-info.java
@@ -0,0 +1,22 @@
+/*
+ *  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 description. -->
+ * Cluster group example.
+ */
+package org.apache.ignite.examples.java8.cluster;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeAsyncExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeAsyncExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeAsyncExample.java
new file mode 100644
index 0000000..8d9cc64
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeAsyncExample.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.computegrid;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteRunnable;
+
+/**
+ * Demonstrates a simple use of {@link IgniteRunnable}.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class ComputeAsyncExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println("Compute asynchronous example started.");
+
+            // Enable asynchronous mode.
+            IgniteCompute compute = ignite.compute().withAsync();
+
+            Collection<IgniteFuture<?>> futs = new ArrayList<>();
+
+            // Iterate through all words in the sentence and create runnable jobs.
+            for (final String word : "Print words using runnable".split(" ")) {
+                // Execute runnable on some node.
+                compute.run(() -> {
+                    System.out.println();
+                    System.out.println(">>> Printing '" + word + "' on this node from ignite job.");
+                });
+
+                futs.add(compute.future());
+            }
+
+            // Wait for completion of all futures.
+            futs.forEach(IgniteFuture::get);
+
+            System.out.println();
+            System.out.println(">>> Finished printing words using runnable execution.");
+            System.out.println(">>> Check all nodes for output (this node is also part of the cluster).");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeBroadcastExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeBroadcastExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeBroadcastExample.java
new file mode 100644
index 0000000..1aed33b
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeBroadcastExample.java
@@ -0,0 +1,102 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.computegrid;
+
+import java.util.Collection;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+
+/**
+ * Demonstrates broadcasting computations within cluster.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class ComputeBroadcastExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> Compute broadcast example started.");
+
+            // Print hello message on all nodes.
+            hello(ignite);
+
+            // Gather system info from all nodes.
+            gatherSystemInfo(ignite);
+       }
+    }
+
+    /**
+     * Print 'Hello' message on all nodes.
+     *
+     * @param ignite Ignite instance.
+     * @throws IgniteException If failed.
+     */
+    private static void hello(Ignite ignite) throws IgniteException {
+        // Print out hello message on all nodes.
+        ignite.compute().broadcast(() -> {
+            System.out.println();
+            System.out.println(">>> Hello Node! :)");
+        });
+
+        System.out.println();
+        System.out.println(">>> Check all nodes for hello message output.");
+    }
+
+    /**
+     * Gather system info from all nodes and print it out.
+     *
+     * @param ignite Ignite instance.
+     * @throws IgniteException if failed.
+     */
+    private static void gatherSystemInfo(Ignite ignite) throws IgniteException {
+        // Gather system info from all nodes.
+        Collection<String> res = ignite.compute().broadcast(() -> {
+            System.out.println();
+            System.out.println("Executing task on node: " + ignite.cluster().localNode().id());
+
+            return "Node ID: " + ignite.cluster().localNode().id() + "\n" +
+                "OS: " + System.getProperty("os.name") + " " + System.getProperty("os.version") + " " +
+                System.getProperty("os.arch") + "\n" +
+                "User: " + System.getProperty("user.name") + "\n" +
+                "JRE: " + System.getProperty("java.runtime.name") + " " +
+                System.getProperty("java.runtime.version");
+        });
+
+        // Print result.
+        System.out.println();
+        System.out.println("Nodes system information:");
+        System.out.println();
+
+        res.forEach(r -> {
+            System.out.println(r);
+            System.out.println();
+        });
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeCallableExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeCallableExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeCallableExample.java
new file mode 100644
index 0000000..cadb447
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeCallableExample.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.computegrid;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.lang.IgniteCallable;
+
+/**
+ * Demonstrates using of {@link IgniteCallable} job execution on the cluster.
+ * <p>
+ * This example takes a sentence composed of multiple words and counts number of non-space
+ * characters in the sentence by having each compute job count characters in each individual
+ * word.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class ComputeCallableExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> Compute callable example started.");
+
+            Collection<IgniteCallable<Integer>> calls = new ArrayList<>();
+
+            // Iterate through all words in the sentence and create callable jobs.
+            for (String word : "Count characters using callable".split(" ")) {
+                calls.add(() -> {
+                    System.out.println();
+                    System.out.println(">>> Printing '" + word + "' on this node from ignite job.");
+
+                    return word.length();
+                });
+            }
+
+            // Execute collection of callables on the ignite.
+            Collection<Integer> res = ignite.compute().call(calls);
+
+            int sum = res.stream().mapToInt(i -> i).sum();
+
+            System.out.println();
+            System.out.println(">>> Total number of characters in the phrase is '" + sum + "'.");
+            System.out.println(">>> Check all nodes for output (this node is also part of the cluster).");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeClosureExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeClosureExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeClosureExample.java
new file mode 100644
index 0000000..c4d3c94
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeClosureExample.java
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.computegrid;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+
+/**
+ * Demonstrates a simple use of Ignite with reduce closure.
+ * <p>
+ * This example splits a phrase into collection of words, computes their length on different
+ * nodes and then computes total amount of non-whitespaces characters in the phrase.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class ComputeClosureExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> Compute closure example started.");
+
+            // Execute closure on all cluster nodes.
+            Collection<Integer> res = ignite.compute().apply(
+                (String word) -> {
+                    System.out.println();
+                    System.out.println(">>> Printing '" + word + "' on this node from ignite job.");
+
+                    // Return number of letters in the word.
+                    return word.length();
+                },
+                // Job parameters. Ignite will create as many jobs as there are parameters.
+                Arrays.asList("Count characters using closure".split(" "))
+            );
+
+            int sum = res.stream().mapToInt(i -> i).sum();
+
+            System.out.println();
+            System.out.println(">>> Total number of characters in the phrase is '" + sum + "'.");
+            System.out.println(">>> Check all nodes for output (this node is also part of the cluster).");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeRunnableExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeRunnableExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeRunnableExample.java
new file mode 100644
index 0000000..acb9893
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/ComputeRunnableExample.java
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.computegrid;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.lang.IgniteRunnable;
+
+/**
+ * Demonstrates a simple use of {@link IgniteRunnable}.
+ * <p>
+ * Remote nodes should always be 0started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class ComputeRunnableExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println("Compute runnable example started.");
+
+            IgniteCompute compute = ignite.compute();
+
+            // Iterate through all words in the sentence and create runnable jobs.
+            for (final String word : "Print words using runnable".split(" ")) {
+                // Execute runnable on some node.
+                compute.run(() -> {
+                    System.out.println();
+                    System.out.println(">>> Printing '" + word + "' on this node from ignite job.");
+                });
+            }
+
+            System.out.println();
+            System.out.println(">>> Finished printing words using runnable execution.");
+            System.out.println(">>> Check all nodes for output (this node is also part of the cluster).");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/package-info.java
new file mode 100644
index 0000000..cda49ef
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/computegrid/package-info.java
@@ -0,0 +1,22 @@
+/*
+ *  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 description. -->
+ * Basic examples for computational ignite functionality.
+ */
+package org.apache.ignite.examples.java8.computegrid;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheAffinityExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheAffinityExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheAffinityExample.java
new file mode 100644
index 0000000..f4a3b03
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheAffinityExample.java
@@ -0,0 +1,137 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.datagrid;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.lang.IgniteRunnable;
+
+/**
+ * This example demonstrates the simplest code that populates the distributed cache
+ * and co-locates simple closure execution with each key. The goal of this particular
+ * example is to provide the simplest code example of this logic.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public final class CacheAffinityExample {
+    /** Cache name. */
+    private static final String CACHE_NAME = CacheAffinityExample.class.getSimpleName();
+
+    /** Number of keys. */
+    private static final int KEY_CNT = 20;
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> Cache affinity example started.");
+
+            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+
+            cfg.setCacheMode(CacheMode.PARTITIONED);
+            cfg.setName(CACHE_NAME);
+
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(cfg)) {
+                for (int i = 0; i < KEY_CNT; i++)
+                    cache.put(i, Integer.toString(i));
+
+                // Co-locates jobs with data using IgniteCompute.affinityRun(...) method.
+                visitUsingAffinityRun();
+
+                // Co-locates jobs with data using IgniteCluster.mapKeysToNodes(...) method.
+                visitUsingMapKeysToNodes();
+            }
+        }
+    }
+
+    /**
+     * Collocates jobs with keys they need to work on using
+     * {@link IgniteCompute#affinityRun(String, Object, IgniteRunnable)} method.
+     */
+    private static void visitUsingAffinityRun() {
+        Ignite ignite = Ignition.ignite();
+
+        final IgniteCache<Integer, String> cache = ignite.cache(CACHE_NAME);
+
+        for (int i = 0; i < KEY_CNT; i++) {
+            int key = i;
+
+            // This runnable will execute on the remote node where
+            // data with the given key is located. Since it will be co-located
+            // we can use local 'peek' operation safely.
+            ignite.compute().affinityRun(CACHE_NAME, key,
+                () -> System.out.println("Co-located using affinityRun [key= " + key + ", value=" + cache.localPeek(key) + ']'));
+        }
+    }
+
+    /**
+     * Collocates jobs with keys they need to work on using {@link IgniteCluster#mapKeysToNodes(String, Collection)}
+     * method. The difference from {@code affinityRun(...)} method is that here we process multiple keys
+     * in a single job.
+     */
+    private static void visitUsingMapKeysToNodes() {
+        final Ignite ignite = Ignition.ignite();
+
+        Collection<Integer> keys = new ArrayList<>(KEY_CNT);
+
+        for (int i = 0; i < KEY_CNT; i++)
+            keys.add(i);
+
+        // Map all keys to nodes.
+        Map<ClusterNode, Collection<Integer>> mappings = ignite.cluster().mapKeysToNodes(CACHE_NAME, keys);
+
+        for (Map.Entry<ClusterNode, Collection<Integer>> mapping : mappings.entrySet()) {
+            ClusterNode node = mapping.getKey();
+
+            final Collection<Integer> mappedKeys = mapping.getValue();
+
+            if (node != null) {
+                // Bring computations to the nodes where the data resides (i.e. collocation).
+                ignite.compute(ignite.cluster().forNode(node)).run(() -> {
+                    IgniteCache<Integer, String> cache = ignite.cache(CACHE_NAME);
+
+                    // Peek is a local memory lookup, however, value should never be 'null'
+                    // as we are co-located with node that has a given key.
+                    for (Integer key : mappedKeys)
+                        System.out.println("Co-located using mapKeysToNodes [key= " + key +
+                            ", value=" + cache.localPeek(key) + ']');
+                });
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheApiExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheApiExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheApiExample.java
new file mode 100644
index 0000000..1891a35
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheApiExample.java
@@ -0,0 +1,105 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.datagrid;
+
+import java.util.concurrent.ConcurrentMap;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+
+/**
+ * This example demonstrates some of the cache rich API capabilities.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class CacheApiExample {
+    /** Cache name. */
+    private static final String CACHE_NAME = CacheApiExample.class.getSimpleName();
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> Cache API example started.");
+
+            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+
+            cfg.setCacheMode(CacheMode.PARTITIONED);
+            cfg.setName(CACHE_NAME);
+
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(cfg)) {
+                // Demonstrate atomic map operations.
+                atomicMapOperations(cache);
+            }
+        }
+    }
+
+    /**
+     * Demonstrates cache operations similar to {@link ConcurrentMap} API. Note that
+     * cache API is a lot richer than the JDK {@link ConcurrentMap}.
+     *
+     * @throws IgniteException If failed.
+     */
+    private static void atomicMapOperations(final IgniteCache<Integer, String> cache) throws IgniteException {
+        System.out.println();
+        System.out.println(">>> Cache atomic map operation examples.");
+
+        // Put and return previous value.
+        String v = cache.getAndPut(1, "1");
+        assert v == null;
+
+        // Put and do not return previous value (all methods ending with 'x' return boolean).
+        // Performs better when previous value is not needed.
+        cache.put(2, "2");
+
+        // Put-if-absent.
+        boolean b1 = cache.putIfAbsent(4, "4");
+        boolean b2 = cache.putIfAbsent(4, "44");
+        assert b1 && !b2;
+
+        // Invoke - assign new value based on previous value.
+        cache.put(6, "6");
+
+        cache.invoke(6, (entry, args) -> {
+            String val = entry.getValue();
+
+            entry.setValue(val + "6"); // Set new value based on previous value.
+
+            return null;
+        });
+
+        // Replace.
+        cache.put(7, "7");
+        b1 = cache.replace(7, "7", "77");
+        b2 = cache.replace(7, "7", "777");
+        assert b1 & !b2;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheAsyncApiExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheAsyncApiExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheAsyncApiExample.java
new file mode 100644
index 0000000..b457b27
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/CacheAsyncApiExample.java
@@ -0,0 +1,85 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.datagrid;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.lang.IgniteFuture;
+
+/**
+ * This example demonstrates some of the cache rich API capabilities.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class CacheAsyncApiExample {
+    /** Cache name. */
+    private static final String CACHE_NAME = CacheAsyncApiExample.class.getSimpleName();
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> Cache asynchronous API example started.");
+
+            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+
+            cfg.setCacheMode(CacheMode.PARTITIONED);
+            cfg.setName(CACHE_NAME);
+
+            try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(cfg)) {
+                // Enable asynchronous mode.
+                IgniteCache<Integer, String> asyncCache = cache.withAsync();
+
+                Collection<IgniteFuture<?>> futs = new ArrayList<>();
+
+                // Execute several puts asynchronously.
+                for (int i = 0; i < 10; i++) {
+                    asyncCache.put(i, String.valueOf(i));
+
+                    futs.add(asyncCache.future());
+                }
+
+                // Wait for completion of all futures.
+                futs.forEach(IgniteFuture::get);
+
+                // Execute get operation asynchronously.
+                asyncCache.get(1);
+
+                // Asynchronously wait for result.
+                asyncCache.<String>future().listen(fut ->
+                    System.out.println("Get operation completed [value=" + fut.get() + ']'));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/package-info.java
new file mode 100644
index 0000000..0bd86a0
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datagrid/package-info.java
@@ -0,0 +1,22 @@
+/*
+ *  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 description. -->
+ * Demonstrates data ignite cache usage.
+ */
+package org.apache.ignite.examples.java8.datagrid;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datastructures/IgniteExecutorServiceExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datastructures/IgniteExecutorServiceExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datastructures/IgniteExecutorServiceExample.java
new file mode 100644
index 0000000..0155144
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datastructures/IgniteExecutorServiceExample.java
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.datastructures;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.lang.IgniteRunnable;
+
+/**
+ * Simple example to demonstrate usage of distributed executor service provided by Ignite.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public final class IgniteExecutorServiceExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws Exception If example execution failed.
+     */
+    @SuppressWarnings({"TooBroadScope"})
+    public static void main(String[] args) throws Exception {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> Compute executor service example started.");
+
+            // Get ignite-enabled executor service.
+            ExecutorService exec = ignite.executorService();
+
+            // Iterate through all words in the sentence and create callable jobs.
+            for (final String word : "Print words using runnable".split(" ")) {
+                // Execute runnable on some node.
+                exec.submit((IgniteRunnable)() -> {
+                    System.out.println();
+                    System.out.println(">>> Printing '" + word + "' on this node from ignite job.");
+                });
+            }
+
+            exec.shutdown();
+
+            // Wait for all jobs to complete (0 means no limit).
+            exec.awaitTermination(0, TimeUnit.MILLISECONDS);
+
+            System.out.println();
+            System.out.println(">>> Check all nodes for output (this node is also part of the cluster).");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datastructures/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datastructures/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datastructures/package-info.java
new file mode 100644
index 0000000..86f3423
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/datastructures/package-info.java
@@ -0,0 +1,22 @@
+/*
+ *  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 description. -->
+ * Demonstrates using of blocking and non-blocking queues and atomic data structures.
+ */
+package org.apache.ignite.examples.java8.datastructures;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/events/EventsExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/events/EventsExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/events/EventsExample.java
new file mode 100644
index 0000000..df2d52b
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/events/EventsExample.java
@@ -0,0 +1,135 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.events;
+
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.compute.ComputeTaskSession;
+import org.apache.ignite.events.TaskEvent;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.resources.TaskSessionResource;
+
+import static org.apache.ignite.events.EventType.EVTS_TASK_EXECUTION;
+
+/**
+ * Demonstrates event consume API that allows to register event listeners on remote nodes.
+ * Note that ignite events are disabled by default and must be specifically enabled,
+ * just like in {@code examples/config/example-ignite.xml} file.
+ * <p>
+ * Remote nodes should always be started with configuration: {@code 'ignite.sh examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start
+ * node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class EventsExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws Exception If example execution failed.
+     */
+    public static void main(String[] args) throws Exception {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> Events API example started.");
+
+            // Listen to events happening on local node.
+            localListen();
+
+            // Listen to events happening on all cluster nodes.
+            remoteListen();
+
+            // Wait for a while while callback is notified about remaining puts.
+            Thread.sleep(1000);
+        }
+    }
+
+    /**
+     * Listen to events that happen only on local node.
+     *
+     * @throws IgniteException If failed.
+     */
+    private static void localListen() throws IgniteException {
+        System.out.println();
+        System.out.println(">>> Local event listener example.");
+
+        Ignite ignite = Ignition.ignite();
+
+        IgnitePredicate<TaskEvent> lsnr = evt -> {
+            System.out.println("Received task event [evt=" + evt.name() + ", taskName=" + evt.taskName() + ']');
+
+            return true; // Return true to continue listening.
+        };
+
+        // Register event listener for all local task execution events.
+        ignite.events().localListen(lsnr, EVTS_TASK_EXECUTION);
+
+        // Generate task events.
+        ignite.compute().withName("example-event-task").run(() -> System.out.println("Executing sample job."));
+
+        // Unsubscribe local task event listener.
+        ignite.events().stopLocalListen(lsnr);
+    }
+
+    /**
+     * Listen to events coming from all cluster nodes.
+     *
+     * @throws IgniteException If failed.
+     */
+    private static void remoteListen() throws IgniteException {
+        System.out.println();
+        System.out.println(">>> Remote event listener example.");
+
+        // This optional local callback is called for each event notification
+        // that passed remote predicate listener.
+        IgniteBiPredicate<UUID, TaskEvent> locLsnr = (nodeId, evt) -> {
+            // Remote filter only accepts tasks whose name being with "good-task" prefix.
+            assert evt.taskName().startsWith("good-task");
+
+            System.out.println("Received task event [evt=" + evt.name() + ", taskName=" + evt.taskName());
+
+            return true; // Return true to continue listening.
+        };
+
+        // Remote filter which only accepts tasks whose name begins with "good-task" prefix.
+        IgnitePredicate<TaskEvent> rmtLsnr = evt -> evt.taskName().startsWith("good-task");
+
+        Ignite ignite = Ignition.ignite();
+
+        // Register event listeners on all nodes to listen for task events.
+        ignite.events().remoteListen(locLsnr, rmtLsnr, EVTS_TASK_EXECUTION);
+
+        // Generate task events.
+        for (int i = 0; i < 10; i++) {
+            ignite.compute().withName(i < 5 ? "good-task-" + i : "bad-task-" + i).run(new IgniteRunnable() {
+                // Auto-inject task session.
+                @TaskSessionResource
+                private ComputeTaskSession ses;
+
+                @Override public void run() {
+                    System.out.println("Executing sample job for task: " + ses.getTaskName());
+                }
+            });
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/events/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/events/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/events/package-info.java
new file mode 100644
index 0000000..b402e78
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/events/package-info.java
@@ -0,0 +1,22 @@
+/*
+ *  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 description. -->
+ * Demonstrates events management API.
+ */
+package org.apache.ignite.examples.java8.events;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingExample.java
new file mode 100644
index 0000000..8b88708
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingExample.java
@@ -0,0 +1,166 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.messaging;
+
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteMessaging;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+
+/**
+ * Example that demonstrates how to exchange messages between nodes. Use such
+ * functionality for cases when you need to communicate to other nodes outside
+ * of ignite task.
+ * <p>
+ * To run this example you must have at least one remote node started.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public final class MessagingExample {
+    /** Number of messages. */
+    private static final int MESSAGES_NUM = 10;
+
+    /** Message topics. */
+    private enum TOPIC { ORDERED, UNORDERED }
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws Exception {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            if (!ExamplesUtils.checkMinTopologySize(ignite.cluster(), 2)) {
+                System.out.println();
+                System.out.println(">>> Please start at least 2 cluster nodes to run example.");
+                System.out.println();
+
+                return;
+            }
+
+            System.out.println();
+            System.out.println(">>> Messaging example started.");
+
+            // Group for remote nodes.
+            ClusterGroup rmtGrp = ignite.cluster().forRemotes();
+
+            // Listen for messages from remote nodes to make sure that they received all the messages.
+            int msgCnt = rmtGrp.nodes().size() * MESSAGES_NUM;
+
+            CountDownLatch orderedLatch = new CountDownLatch(msgCnt);
+            CountDownLatch unorderedLatch = new CountDownLatch(msgCnt);
+
+            localListen(ignite.message(ignite.cluster().forLocal()), orderedLatch, unorderedLatch);
+
+            // Register listeners on all cluster nodes.
+            startListening(ignite, ignite.message(rmtGrp));
+
+            // Send unordered messages to all remote nodes.
+            for (int i = 0; i < MESSAGES_NUM; i++)
+                ignite.message(rmtGrp).send(TOPIC.UNORDERED, Integer.toString(i));
+
+            System.out.println(">>> Finished sending unordered messages.");
+
+            // Send ordered messages to all remote nodes.
+            for (int i = 0; i < MESSAGES_NUM; i++)
+                ignite.message(rmtGrp).sendOrdered(TOPIC.ORDERED, Integer.toString(i), 0);
+
+            System.out.println(">>> Finished sending ordered messages.");
+            System.out.println(">>> Check output on all nodes for message printouts.");
+            System.out.println(">>> Will wait for messages acknowledgements from all remote nodes.");
+
+            orderedLatch.await();
+            unorderedLatch.await();
+
+            System.out.println(">>> Messaging example finished.");
+        }
+    }
+
+    /**
+     * Start listening to messages on remote cluster nodes.
+     *
+     * @param ignite Ignite.
+     * @param imsg Ignite messaging.
+     * @throws IgniteException If failed.
+     */
+    private static void startListening(final Ignite ignite, IgniteMessaging imsg) throws IgniteException {
+        // Add ordered message listener.
+        imsg.remoteListen(TOPIC.ORDERED, (nodeId, msg) -> {
+            System.out.println("Received ordered message [msg=" + msg + ", fromNodeId=" + nodeId + ']');
+
+            try {
+                ignite.message(ignite.cluster().forNodeId(nodeId)).send(TOPIC.ORDERED, msg);
+            }
+            catch (IgniteException e) {
+                e.printStackTrace();
+            }
+
+            return true; // Return true to continue listening.
+        });
+
+        // Add unordered message listener.
+        imsg.remoteListen(TOPIC.UNORDERED, (nodeId, msg) -> {
+            System.out.println("Received unordered message [msg=" + msg + ", fromNodeId=" + nodeId + ']');
+
+            try {
+                ignite.message(ignite.cluster().forNodeId(nodeId)).send(TOPIC.UNORDERED, msg);
+            }
+            catch (IgniteException e) {
+                e.printStackTrace();
+            }
+
+            return true; // Return true to continue listening.
+        });
+    }
+
+    /**
+     * Listen for messages from remote nodes.
+     *
+     * @param imsg Ignite messaging.
+     * @param orderedLatch Latch for ordered messages acks.
+     * @param unorderedLatch Latch for unordered messages acks.
+     */
+    private static void localListen(
+        IgniteMessaging imsg,
+        final CountDownLatch orderedLatch,
+        final CountDownLatch unorderedLatch
+    ) {
+        imsg.localListen(TOPIC.ORDERED, (nodeId, msg) -> {
+            orderedLatch.countDown();
+
+            // Return true to continue listening, false to stop.
+            return orderedLatch.getCount() > 0;
+        });
+
+        imsg.localListen(TOPIC.UNORDERED, (nodeId, msg) -> {
+            unorderedLatch.countDown();
+
+            // Return true to continue listening, false to stop.
+            return unorderedLatch.getCount() > 0;
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingPingPongExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingPingPongExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingPingPongExample.java
new file mode 100644
index 0000000..b19b476
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingPingPongExample.java
@@ -0,0 +1,113 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.messaging;
+
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+
+/**
+ * Demonstrates simple message exchange between local and remote nodes.
+ * <p>
+ * To run this example you must have at least one remote node started.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class MessagingPingPongExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws Exception If example execution failed.
+     */
+    public static void main(String[] args) throws Exception {
+        // Game is played over the default ignite.
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            if (!ExamplesUtils.checkMinTopologySize(ignite.cluster(), 2))
+                return;
+
+            System.out.println();
+            System.out.println(">>> Messaging ping-pong example started.");
+
+            // Pick random remote node as a partner.
+            ClusterGroup nodeB = ignite.cluster().forRemotes().forRandom();
+
+            // Note that both nodeA and nodeB will always point to
+            // same nodes regardless of whether they were implicitly
+            // serialized and deserialized on another node as part of
+            // anonymous closure's state during its remote execution.
+
+            // Set up remote player.
+            ignite.message(nodeB).remoteListen(null, (nodeId, rcvMsg) -> {
+                System.out.println("Received message [msg=" + rcvMsg + ", sender=" + nodeId + ']');
+
+                if ("PING".equals(rcvMsg)) {
+                    ignite.message(ignite.cluster().forNodeId(nodeId)).send(null, "PONG");
+
+                    return true; // Continue listening.
+                }
+
+                return false; // Unsubscribe.
+            });
+
+            int MAX_PLAYS = 10;
+
+            final CountDownLatch cnt = new CountDownLatch(MAX_PLAYS);
+
+            // Set up local player.
+            ignite.message().localListen(null, (nodeId, rcvMsg) -> {
+                System.out.println("Received message [msg=" + rcvMsg + ", sender=" + nodeId + ']');
+
+                if (cnt.getCount() == 1) {
+                    ignite.message(ignite.cluster().forNodeId(nodeId)).send(null, "STOP");
+
+                    cnt.countDown();
+
+                    return false; // Stop listening.
+                }
+                else if ("PONG".equals(rcvMsg))
+                    ignite.message(ignite.cluster().forNodeId(nodeId)).send(null, "PING");
+                else
+                    throw new IgniteException("Received unexpected message: " + rcvMsg);
+
+                cnt.countDown();
+
+                return true; // Continue listening.
+            });
+
+            // Serve!
+            ignite.message(nodeB).send(null, "PING");
+
+            // Wait til the game is over.
+            try {
+                cnt.await();
+            }
+            catch (InterruptedException e) {
+                System.err.println("Hm... let us finish the game!\n" + e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/package-info.java
new file mode 100644
index 0000000..75180cf
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/messaging/package-info.java
@@ -0,0 +1,22 @@
+/*
+ *  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 description. -->
+ * Demonstrates how to exchange messages between nodes.
+ */
+package org.apache.ignite.examples.java8.messaging;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java
new file mode 100644
index 0000000..8c85a3e
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.misc.schedule;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.scheduler.SchedulerFuture;
+
+/**
+ * Demonstrates a cron-based {@link Runnable} execution scheduling.
+ * Test runnable object broadcasts a phrase to all cluster nodes every minute
+ * three times with initial scheduling delay equal to five seconds.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node
+ * with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class ComputeScheduleExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println("Compute schedule example started.");
+
+            // Schedule output message every minute.
+            SchedulerFuture<?> fut = ignite.scheduler().scheduleLocal(() ->
+                ignite.compute().broadcast(() -> {
+                    System.out.println();
+                    System.out.println("Howdy! :)");
+
+                    return "Howdy! :)";
+                }),
+                "{5, 3} * * * * *" // Cron expression.
+            );
+
+            while (!fut.isDone())
+                System.out.println(">>> Invocation result: " + fut.get());
+
+            System.out.println();
+            System.out.println(">>> Schedule future is done and has been unscheduled.");
+            System.out.println(">>> Check all nodes for hello message output.");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java
new file mode 100644
index 0000000..42132f1
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java
@@ -0,0 +1,22 @@
+/*
+ *  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 description. -->
+ * Demonstrates usage of cron-based scheduler.
+ */
+package org.apache.ignite.examples.java8.misc.schedule;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/package-info.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/package-info.java
new file mode 100644
index 0000000..66847dc
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/package-info.java
@@ -0,0 +1,23 @@
+/*
+ *  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 description. -->
+ * Basic examples for ignite functionality utilizing Java8 lambdas.
+ * Use "java8" examples with JDK8 in addition to the "java" examples.
+ */
+package org.apache.ignite.examples.java8;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c4b0877f/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
new file mode 100644
index 0000000..538c4eb
--- /dev/null
+++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/streaming/StreamTransformerExample.java
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.examples.java8.streaming;
+
+import java.util.List;
+import java.util.Random;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.ExamplesUtils;
+import org.apache.ignite.stream.StreamTransformer;
+
+/**
+ * Stream random numbers into the streaming cache.
+ * To start the example, you should:
+ * <ul>
+ *     <li>Start a few nodes using {@link ExampleNodeStartup} or by starting remote nodes as specified below.</li>
+ *     <li>Start streaming using {@link StreamTransformerExample}.</li>
+ * </ul>
+ * <p>
+ * You should start remote nodes by running {@link ExampleNodeStartup} in another JVM.
+ */
+public class StreamTransformerExample {
+    /** Random number generator. */
+    private static final Random RAND = new Random();
+
+    /** Range within which to generate numbers. */
+    private static final int RANGE = 1000;
+
+    public static void main(String[] args) throws Exception {
+        // Mark this cluster member as client.
+        Ignition.setClientMode(true);
+
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            if (!ExamplesUtils.hasServerNodes(ignite))
+                return;
+
+            CacheConfiguration<Integer, Long> cfg = new CacheConfiguration<>("randomNumbers");
+
+            // Index key and value.
+            cfg.setIndexedTypes(Integer.class, Long.class);
+
+            // Auto-close cache at the end of the example.
+            try (IgniteCache<Integer, Long> stmCache = ignite.getOrCreateCache(cfg)) {
+                try (IgniteDataStreamer<Integer, Long> stmr = ignite.dataStreamer(stmCache.getName())) {
+                    // Allow data updates.
+                    stmr.allowOverwrite(true);
+
+                    // Configure data transformation to count random numbers added to the stream.
+                    stmr.receiver(StreamTransformer.from((e, arg) -> {
+                        // Get current count.
+                        Long val = e.getValue();
+
+                        // Increment count by 1.
+                        e.setValue(val == null ? 1L : val + 1);
+
+                        return null;
+                    }));
+
+                    // Stream 10 million of random numbers into the streamer cache.
+                    for (int i = 1; i <= 10_000_000; i++) {
+                        stmr.addData(RAND.nextInt(RANGE), 1L);
+
+                        if (i % 500_000 == 0)
+                            System.out.println("Number of tuples streamed into Ignite: " + i);
+                    }
+                }
+
+                // Query top 10 most popular numbers every.
+                SqlFieldsQuery top10Qry = new SqlFieldsQuery("select _key, _val from Long order by _val desc limit 10");
+
+                // Execute queries.
+                List<List<?>> top10 = stmCache.query(top10Qry).getAll();
+
+                System.out.println("Top 10 most popular numbers:");
+
+                // Print top 10 words.
+                ExamplesUtils.printQueryResults(top10);
+            }
+        }
+    }
+}
\ No newline at end of file


[07/11] ignite git commit: Merge remote-tracking branch 'apache/master'

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


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

Branch: refs/heads/ignite-1093-2
Commit: 8217be6a0f7a3a0e564203e9ace52697833863ed
Parents: 4d1c026 f4d8ea9
Author: ashutak <as...@gridgain.com>
Authored: Thu Oct 15 17:12:53 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Oct 15 17:12:53 2015 +0300

----------------------------------------------------------------------
 assembly/release-fabric-lgpl.xml                |  63 +++++
 assembly/release-hadoop-lgpl.xml                |  39 +++
 examples-lgpl/README.txt                        |  27 ++
 examples-lgpl/config/example-cache.xml          |  73 ++++++
 examples-lgpl/config/example-ignite.xml         |  83 +++++++
 examples-lgpl/config/filesystem/README.txt      |   8 +
 examples-lgpl/config/filesystem/core-site.xml   |  42 ++++
 .../config/filesystem/example-igfs.xml          | 151 ++++++++++++
 examples-lgpl/config/hibernate/README.txt       |   8 +
 .../hibernate/example-hibernate-L2-cache.xml    |  64 +++++
 examples-lgpl/config/servlet/README.txt         |   8 +
 examples-lgpl/config/servlet/WEB-INF/web.xml    |  36 +++
 examples-lgpl/pom-standalone.xml                | 141 +++++++++++
 examples-lgpl/pom.xml                           | 128 ++++++++++
 .../hibernate/HibernateL2CacheExample.java      | 245 +++++++++++++++++++
 .../examples/datagrid/hibernate/Post.java       | 130 ++++++++++
 .../examples/datagrid/hibernate/User.java       | 154 ++++++++++++
 .../datagrid/hibernate/package-info.java        |  22 ++
 .../hibernate/CacheHibernatePersonStore.java    | 122 +++++++++
 .../hibernate/CacheHibernateStoreExample.java   | 151 ++++++++++++
 .../datagrid/store/hibernate/Person.hbm.xml     |  34 +++
 .../datagrid/store/hibernate/hibernate.cfg.xml  |  41 ++++
 .../datagrid/store/hibernate/package-info.java  |  22 ++
 .../java8/cluster/ClusterGroupExample.java      |  86 +++++++
 .../examples/java8/cluster/package-info.java    |  22 ++
 .../java8/computegrid/ComputeAsyncExample.java  |  75 ++++++
 .../computegrid/ComputeBroadcastExample.java    | 102 ++++++++
 .../computegrid/ComputeCallableExample.java     |  75 ++++++
 .../computegrid/ComputeClosureExample.java      |  71 ++++++
 .../computegrid/ComputeRunnableExample.java     |  64 +++++
 .../java8/computegrid/package-info.java         |  22 ++
 .../java8/datagrid/CacheAffinityExample.java    | 137 +++++++++++
 .../java8/datagrid/CacheApiExample.java         | 105 ++++++++
 .../java8/datagrid/CacheAsyncApiExample.java    |  85 +++++++
 .../examples/java8/datagrid/package-info.java   |  22 ++
 .../IgniteExecutorServiceExample.java           |  70 ++++++
 .../java8/datastructures/package-info.java      |  22 ++
 .../examples/java8/events/EventsExample.java    | 135 ++++++++++
 .../examples/java8/events/package-info.java     |  22 ++
 .../java8/messaging/MessagingExample.java       | 166 +++++++++++++
 .../messaging/MessagingPingPongExample.java     | 113 +++++++++
 .../examples/java8/messaging/package-info.java  |  22 ++
 .../misc/schedule/ComputeScheduleExample.java   |  68 +++++
 .../java8/misc/schedule/package-info.java       |  22 ++
 .../ignite/examples/java8/package-info.java     |  23 ++
 .../streaming/StreamTransformerExample.java     | 101 ++++++++
 .../java8/streaming/StreamVisitorExample.java   | 172 +++++++++++++
 .../examples/java8/streaming/package-info.java  |  22 ++
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  31 +++
 .../HibernateL2CacheExampleSelfTest.java        |  33 +++
 .../IgniteLgplExamplesSelfTestSuite.java        |  48 ++++
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  29 +++
 .../HibernateL2CacheExampleSelfTest.java        |  37 +++
 .../IgniteLgplExamplesJ8SelfTestSuite.java      |  46 ++++
 examples/pom-standalone.xml                     |  12 -
 examples/pom.xml                                |  12 -
 .../hibernate/HibernateL2CacheExample.java      | 245 -------------------
 .../examples/datagrid/hibernate/Post.java       | 130 ----------
 .../examples/datagrid/hibernate/User.java       | 154 ------------
 .../datagrid/hibernate/package-info.java        |  22 --
 .../hibernate/CacheHibernatePersonStore.java    | 122 ---------
 .../hibernate/CacheHibernateStoreExample.java   | 151 ------------
 .../datagrid/store/hibernate/Person.hbm.xml     |  34 ---
 .../datagrid/store/hibernate/hibernate.cfg.xml  |  41 ----
 .../datagrid/store/hibernate/package-info.java  |  22 --
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  31 ---
 .../HibernateL2CacheExampleSelfTest.java        |  33 ---
 .../testsuites/IgniteExamplesSelfTestSuite.java |   4 -
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  29 ---
 .../HibernateL2CacheExampleSelfTest.java        |  37 ---
 pom.xml                                         |  65 ++++-
 71 files changed, 3904 insertions(+), 1080 deletions(-)
----------------------------------------------------------------------



[09/11] ignite git commit: IGNITE-1622 - Fixed cache.clear() with near cache

Posted by sb...@apache.org.
IGNITE-1622 - Fixed cache.clear() with near cache


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

Branch: refs/heads/ignite-1093-2
Commit: a228c246ae58894d0939887218252c2bde882fce
Parents: c9eb539
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Oct 15 16:02:38 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Oct 15 16:02:38 2015 -0700

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 357 +++++++++++--------
 .../cache/GridCacheClearAllRunnable.java        |  18 +-
 .../cache/GridCacheConcurrentMap.java           |   4 +-
 .../processors/cache/GridCacheProxyImpl.java    |  14 +-
 .../processors/cache/IgniteCacheProxy.java      |   2 +-
 .../processors/cache/IgniteInternalCache.java   |  19 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |   6 +-
 .../distributed/near/GridNearCacheAdapter.java  |  21 +-
 .../near/GridNearCacheClearAllRunnable.java     |   9 +-
 .../cache/GridCacheClearSelfTest.java           | 308 ++++++++++++++++
 .../dht/GridCacheDhtEntrySelfTest.java          |   2 +-
 .../IgniteCacheFullApiSelfTestSuite.java        |   8 +-
 12 files changed, 587 insertions(+), 181 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index ae987b7..417b396 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -129,6 +129,7 @@ import org.apache.ignite.lang.IgniteCallable;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteOutClosure;
+import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.mxbean.CacheMetricsMXBean;
 import org.apache.ignite.plugin.security.SecurityPermission;
@@ -149,7 +150,6 @@ import static org.apache.ignite.internal.processors.dr.GridDrType.DR_LOAD;
 import static org.apache.ignite.internal.processors.dr.GridDrType.DR_NONE;
 import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_NO_FAILOVER;
 import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_SUBGRID;
-import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_TIMEOUT;
 import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
 import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
 
@@ -1057,44 +1057,52 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     /**
      * Split clearLocally all task into multiple runnables.
      *
+     * @param srv Whether to clear server cache.
+     * @param near Whether to clear near cache.
+     * @param readers Whether to clear readers.
      * @return Split runnables.
      */
-    public List<GridCacheClearAllRunnable<K, V>> splitClearLocally() {
-        assert CLEAR_ALL_SPLIT_THRESHOLD > 0;
+    public List<GridCacheClearAllRunnable<K, V>> splitClearLocally(boolean srv, boolean near, boolean readers) {
+        if ((isNear() && near) || (!isNear() && srv)) {
+            int keySize = size();
 
-        int keySize = size();
+            int cnt = Math.min(keySize / CLEAR_ALL_SPLIT_THRESHOLD + (keySize % CLEAR_ALL_SPLIT_THRESHOLD != 0 ? 1 : 0),
+                    Runtime.getRuntime().availableProcessors());
 
-        int cnt = Math.min(keySize / CLEAR_ALL_SPLIT_THRESHOLD + (keySize % CLEAR_ALL_SPLIT_THRESHOLD != 0 ? 1 : 0),
-            Runtime.getRuntime().availableProcessors());
+            if (cnt == 0)
+                cnt = 1; // Still perform cleanup since there could be entries in swap.
 
-        if (cnt == 0)
-            cnt = 1; // Still perform cleanup since there could be entries in swap.
+            GridCacheVersion obsoleteVer = ctx.versions().next();
 
-        GridCacheVersion obsoleteVer = ctx.versions().next();
-
-        List<GridCacheClearAllRunnable<K, V>> res = new ArrayList<>(cnt);
+            List<GridCacheClearAllRunnable<K, V>> res = new ArrayList<>(cnt);
 
-        for (int i = 0; i < cnt; i++)
-            res.add(new GridCacheClearAllRunnable<>(this, obsoleteVer, i, cnt));
+            for (int i = 0; i < cnt; i++)
+                res.add(new GridCacheClearAllRunnable<>(this, obsoleteVer, i, cnt, readers));
 
-        return res;
+            return res;
+        }
+        else
+            return null;
     }
 
     /** {@inheritDoc} */
     @Override public boolean clearLocally(K key) {
-        return clearLocally0(key);
+        return clearLocally0(key, false);
     }
 
     /** {@inheritDoc} */
-    @Override public void clearLocallyAll(Set<? extends K> keys) {
-        clearLocally0(keys);
+    @Override public void clearLocallyAll(Set<? extends K> keys, boolean srv, boolean near, boolean readers) {
+        if (keys != null && ((isNear() && near) || (!isNear() && srv))) {
+            for (K key : keys)
+                clearLocally0(key, readers);
+        }
     }
 
     /** {@inheritDoc} */
-    @Override public void clearLocally() {
+    @Override public void clearLocally(boolean srv, boolean near, boolean readers) {
         ctx.checkSecurity(SecurityPermission.CACHE_REMOVE);
 
-        List<GridCacheClearAllRunnable<K, V>> jobs = splitClearLocally();
+        List<GridCacheClearAllRunnable<K, V>> jobs = splitClearLocally(srv, near, readers);
 
         if (!F.isEmpty(jobs)) {
             ExecutorService execSvc = null;
@@ -1128,135 +1136,102 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         }
     }
 
-    /**
-     * @param keys Keys.
-     * @param readers Readers flag.
-     */
-    public void clearLocally(Collection<KeyCacheObject> keys, boolean readers) {
-        if (F.isEmpty(keys))
-            return;
-
-        GridCacheVersion obsoleteVer = ctx.versions().next();
-
-        for (KeyCacheObject key : keys) {
-            GridCacheEntryEx e = peekEx(key);
-
-            try {
-                if (e != null)
-                    e.clear(obsoleteVer, readers, null);
-            }
-            catch (IgniteCheckedException ex) {
-                U.error(log, "Failed to clearLocally entry (will continue to clearLocally other entries): " + e,
-                    ex);
-            }
-        }
-    }
-
-    /**
-     * Clears entry from cache.
-     *
-     * @param obsoleteVer Obsolete version to set.
-     * @param key Key to clearLocally.
-     * @param filter Optional filter.
-     * @return {@code True} if cleared.
-     */
-    private boolean clearLocally(GridCacheVersion obsoleteVer, K key, @Nullable CacheEntryPredicate[] filter) {
-        try {
-            KeyCacheObject cacheKey = ctx.toCacheKeyObject(key);
-
-            GridCacheEntryEx entry = ctx.isSwapOrOffheapEnabled() ? entryEx(cacheKey) : peekEx(cacheKey);
-
-            if (entry != null)
-                return entry.clear(obsoleteVer, false, filter);
-        }
-        catch (GridDhtInvalidPartitionException ignored) {
-            return false;
-        }
-        catch (IgniteCheckedException ex) {
-            U.error(log, "Failed to clearLocally entry for key: " + key, ex);
-        }
-
-        return false;
-    }
-
     /** {@inheritDoc} */
     @Override public void clear() throws IgniteCheckedException {
-        // Clear local cache synchronously.
-        clearLocally();
-
-        clearRemotes(0, null);
+        clear((Set<? extends K>)null);
     }
 
     /** {@inheritDoc} */
     @Override public void clear(K key) throws IgniteCheckedException {
-        // Clear local cache synchronously.
-        clearLocally(key);
-
-        clearRemotes(0, Collections.singleton(key));
+        clear(Collections.singleton(key));
     }
 
     /** {@inheritDoc} */
     @Override public void clearAll(Set<? extends K> keys) throws IgniteCheckedException {
-        // Clear local cache synchronously.
-        clearLocallyAll(keys);
+        clear(keys);
+    }
 
-        clearRemotes(0, keys);
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> clearAsync() {
+        return clearAsync((Set<? extends K>)null);
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> clearAsync(K key) {
-        return clearKeysAsync(Collections.singleton(key));
+        return clearAsync(Collections.singleton(key));
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> clearAsync(Set<? extends K> keys) {
-        return clearKeysAsync(keys);
+    @Override public IgniteInternalFuture<?> clearAllAsync(Set<? extends K> keys) {
+        return clearAsync(keys);
     }
 
     /**
-     * @param timeout Timeout for clearLocally all task in milliseconds (0 for never).
-     *      Set it to larger value for large caches.
-     * @param keys Keys to clear or {@code null} if all cache should be cleared.
-     * @throws IgniteCheckedException In case of cache could not be cleared on any of the nodes.
+     * @param keys Keys to clear.
+     * @throws IgniteCheckedException In case of error.
      */
-    private void clearRemotes(long timeout, @Nullable final Set<? extends K> keys) throws IgniteCheckedException {
-        // Send job to remote nodes only.
-        Collection<ClusterNode> nodes =
-            ctx.grid().cluster().forCacheNodes(name(), true, true, false).forRemotes().nodes();
-
-        if (!nodes.isEmpty()) {
-            ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, timeout);
-
-            ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
-
-            ctx.kernalContext().task().execute(
-                new ClearTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys), null).get();
-        }
+    private void clear(@Nullable Set<? extends K> keys) throws IgniteCheckedException {
+        executeClearTask(keys, false).get();
+        executeClearTask(keys, true).get();
     }
 
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> clearAsync() {
-        return clearKeysAsync(null);
+    /**
+     * @param keys Keys to clear or {@code null} if all cache should be cleared.
+     * @return Future.
+     */
+    private IgniteInternalFuture<?> clearAsync(@Nullable final Set<? extends K> keys) {
+        return executeClearTask(keys, false).chain(new CX1<IgniteInternalFuture<?>, Object>() {
+            @Override public Object applyx(IgniteInternalFuture<?> fut) throws IgniteCheckedException {
+                executeClearTask(keys, true).get();
+
+                return null;
+            }
+        });
     }
 
     /**
-     * @param keys Keys to clear or {@code null} if all cache should be cleared.
+     * @param keys Keys to clear.
+     * @param near Near cache flag.
      * @return Future.
      */
-    private IgniteInternalFuture<?> clearKeysAsync(final Set<? extends K> keys) {
-        Collection<ClusterNode> nodes = ctx.grid().cluster().forCacheNodes(name(), true, true, false).nodes();
+    private IgniteInternalFuture<?> executeClearTask(@Nullable Set<? extends K> keys, boolean near) {
+        Collection<ClusterNode> srvNodes = ctx.grid().cluster().forCacheNodes(name(), !near, near, false).nodes();
 
-        if (!nodes.isEmpty()) {
-            ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
+        if (!srvNodes.isEmpty()) {
+            ctx.kernalContext().task().setThreadContext(TC_SUBGRID, srvNodes);
 
             return ctx.kernalContext().task().execute(
-                new ClearTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys), null);
+                new ClearTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys, near), null);
         }
         else
             return new GridFinishedFuture<>();
     }
 
     /**
+     * @param keys Keys.
+     * @param readers Readers flag.
+     */
+    public void clearLocally(Collection<KeyCacheObject> keys, boolean readers) {
+        if (F.isEmpty(keys))
+            return;
+
+        GridCacheVersion obsoleteVer = ctx.versions().next();
+
+        for (KeyCacheObject key : keys) {
+            GridCacheEntryEx e = peekEx(key);
+
+            try {
+                if (e != null)
+                    e.clear(obsoleteVer, readers, null);
+            }
+            catch (IgniteCheckedException ex) {
+                U.error(log, "Failed to clearLocally entry (will continue to clearLocally other entries): " + e,
+                    ex);
+            }
+        }
+    }
+
+    /**
      * @param entry Removes entry from cache if currently mapped value is the same as passed.
      */
     public void removeEntry(GridCacheEntryEx entry) {
@@ -4427,39 +4402,33 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     }
 
     /**
-     * @param keys Keys.
-     * @param filter Filters to evaluate.
+     * @param key Key.
+     * @param readers Whether to clear readers.
      */
-    public void clearLocally0(Collection<? extends K> keys,
-        @Nullable CacheEntryPredicate... filter) {
+    private boolean clearLocally0(K key, boolean readers) {
         ctx.checkSecurity(SecurityPermission.CACHE_REMOVE);
 
-        if (F.isEmpty(keys))
-            return;
-
         if (keyCheck)
-            validateCacheKeys(keys);
+            validateCacheKey(key);
 
         GridCacheVersion obsoleteVer = ctx.versions().next();
 
-        for (K k : keys)
-            clearLocally(obsoleteVer, k, filter);
-    }
-
-    /**
-     * @param key Key.
-     * @param filter Filters to evaluate.
-     * @return {@code True} if cleared.
-     */
-    public boolean clearLocally0(K key, @Nullable CacheEntryPredicate... filter) {
-        A.notNull(key, "key");
+        try {
+            KeyCacheObject cacheKey = ctx.toCacheKeyObject(key);
 
-        if (keyCheck)
-            validateCacheKey(key);
+            GridCacheEntryEx entry = ctx.isSwapOrOffheapEnabled() ? entryEx(cacheKey) : peekEx(cacheKey);
 
-        ctx.checkSecurity(SecurityPermission.CACHE_REMOVE);
+            if (entry != null)
+                return entry.clear(obsoleteVer, readers, null);
+        }
+        catch (GridDhtInvalidPartitionException ignored) {
+            // No-op.
+        }
+        catch (IgniteCheckedException ex) {
+            U.error(log, "Failed to clearLocally entry for key: " + key, ex);
+        }
 
-        return clearLocally(ctx.versions().next(), key, filter);
+        return false;
     }
 
     /** {@inheritDoc} */
@@ -5178,10 +5147,24 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         /** {@inheritDoc} */
         @Nullable @Override public Object localExecute(@Nullable IgniteInternalCache cache) {
             if (cache != null)
-                cache.clearLocally();
+                cache.clearLocally(clearServerCache(), clearNearCache(), true);
 
             return null;
         }
+
+        /**
+         * @return Whether to clear server cache.
+         */
+        protected boolean clearServerCache() {
+            return true;
+        }
+
+        /**
+         * @return Whether to clear near cache.
+         */
+        protected boolean clearNearCache() {
+            return false;
+        }
     }
 
     /**
@@ -5209,10 +5192,87 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         /** {@inheritDoc} */
         @Nullable @Override public Object localExecute(@Nullable IgniteInternalCache cache) {
             if (cache != null)
-                cache.clearLocallyAll(keys);
+                cache.clearLocallyAll(keys, clearServerCache(), clearNearCache(), true);
 
             return null;
         }
+
+        /**
+         * @return Whether to clear server cache.
+         */
+        protected boolean clearServerCache() {
+            return true;
+        }
+
+        /**
+         * @return Whether to clear near cache.
+         */
+        protected boolean clearNearCache() {
+            return false;
+        }
+    }
+
+    /**
+     * Global clear all for near cache.
+     */
+    @GridInternal
+    private static class GlobalClearAllNearJob extends GlobalClearAllJob {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param cacheName Cache name.
+         * @param topVer Affinity topology version.
+         */
+        private GlobalClearAllNearJob(String cacheName, AffinityTopologyVersion topVer) {
+            super(cacheName, topVer);
+        }
+
+        /**
+         * @return Whether to clear server cache.
+         */
+        @Override protected boolean clearServerCache() {
+            return false;
+        }
+
+        /**
+         * @return Whether to clear near cache.
+         */
+        @Override protected boolean clearNearCache() {
+            return true;
+        }
+    }
+
+    /**
+     * Global clear keys for near cache.
+     */
+    @GridInternal
+    private static class GlobalClearKeySetNearJob<K> extends GlobalClearKeySetJob<K> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param cacheName Cache name.
+         * @param topVer Affinity topology version.
+         * @param keys Keys to clear.
+         */
+        private GlobalClearKeySetNearJob(String cacheName, AffinityTopologyVersion topVer, Set<? extends K> keys) {
+            super(cacheName, topVer, keys);
+        }
+
+        /**
+         * @return Whether to clear server cache.
+         */
+        protected boolean clearServerCache() {
+            return false;
+        }
+
+        /**
+         * @return Whether to clear near cache.
+         */
+        protected boolean clearNearCache() {
+            return true;
+        }
     }
 
     /**
@@ -5972,6 +6032,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         /** */
         private static final long serialVersionUID = 0L;
 
+        /** */
+        public static final IgniteProductVersion NEAR_JOB_SINCE = IgniteProductVersion.fromString("1.5.0");
+
         /** Cache name. */
         private final String cacheName;
 
@@ -5981,26 +6044,40 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         /** Keys to clear. */
         private final Set<? extends K> keys;
 
+        /** Near cache flag. */
+        private final boolean near;
+
         /**
          * @param cacheName Cache name.
          * @param topVer Affinity topology version.
          * @param keys Keys to clear.
+         * @param near Near cache flag.
          */
-        public ClearTask(String cacheName, AffinityTopologyVersion topVer, Set<? extends K> keys) {
+        public ClearTask(String cacheName, AffinityTopologyVersion topVer, Set<? extends K> keys, boolean near) {
             this.cacheName = cacheName;
             this.topVer = topVer;
             this.keys = keys;
+            this.near = near;
         }
 
         /** {@inheritDoc} */
         @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
             @Nullable Object arg) throws IgniteException {
-            Map<ComputeJob, ClusterNode> jobs = new HashMap();
+            Map<ComputeJob, ClusterNode> jobs = new HashMap<>();
 
             for (ClusterNode node : subgrid) {
-                jobs.put(keys == null ? new GlobalClearAllJob(cacheName, topVer) :
-                        new GlobalClearKeySetJob<K>(cacheName, topVer, keys),
-                    node);
+                ComputeJob job;
+
+                if (near && node.version().compareTo(NEAR_JOB_SINCE) >= 0) {
+                    job = keys == null ? new GlobalClearAllNearJob(cacheName, topVer) :
+                        new GlobalClearKeySetNearJob<>(cacheName, topVer, keys);
+                }
+                else {
+                    job = keys == null ? new GlobalClearAllJob(cacheName, topVer) :
+                        new GlobalClearKeySetJob<>(cacheName, topVer, keys);
+                }
+
+                jobs.put(job, node);
             }
 
             return jobs;

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
index feafc58..77c5a55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
@@ -28,7 +28,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
- * Base runnable for {@link GridCacheAdapter#clearLocally()} routine.
+ * Base runnable for {@link IgniteInternalCache#clearLocally(boolean, boolean, boolean)} routine.
  */
 public class GridCacheClearAllRunnable<K, V> implements Runnable {
     /** Cache to be cleared. */
@@ -43,6 +43,9 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
     /** Mods count across all spawned clearLocally runnables. */
     protected final int totalCnt;
 
+    /** Whether to clear readers. */
+    protected final boolean readers;
+
     /** Cache context. */
     protected final GridCacheContext<K, V> ctx;
 
@@ -57,7 +60,8 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
      * @param id Mod for the given runnable.
      * @param totalCnt Mods count across all spawned clearLocally runnables.
      */
-    public GridCacheClearAllRunnable(GridCacheAdapter<K, V> cache, GridCacheVersion obsoleteVer, int id, int totalCnt) {
+    public GridCacheClearAllRunnable(GridCacheAdapter<K, V> cache, GridCacheVersion obsoleteVer,
+        int id, int totalCnt, boolean readers) {
         assert cache != null;
         assert obsoleteVer != null;
         assert id >= 0;
@@ -68,6 +72,7 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
         this.obsoleteVer = obsoleteVer;
         this.id = id;
         this.totalCnt = totalCnt;
+        this.readers = readers;
 
         ctx = cache.context();
         log = ctx.logger(getClass());
@@ -138,7 +143,7 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
      */
     protected void clearEntry(GridCacheEntryEx e) {
         try {
-            e.clear(obsoleteVer, false, CU.empty0());
+            e.clear(obsoleteVer, readers, CU.empty0());
         }
         catch (IgniteCheckedException ex) {
             U.error(log, "Failed to clearLocally entry from cache (will continue to clearLocally other entries): " + e, ex);
@@ -172,6 +177,13 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
         return totalCnt;
     }
 
+    /**
+     * @return Whether to clean readers.
+     */
+    public boolean readers() {
+        return readers;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridCacheClearAllRunnable.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
index a1fc585..1be7c07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
@@ -1968,7 +1968,7 @@ public class GridCacheConcurrentMap {
 
         /** {@inheritDoc} */
         @Override public void clear() {
-            ctx.cache().clearLocally0(new KeySet<K, V>(map, filter, false));
+            ctx.cache().clearLocallyAll(new KeySet<K, V>(map, filter, false), true, true, false);
         }
 
         /** {@inheritDoc} */
@@ -2413,4 +2413,4 @@ public class GridCacheConcurrentMap {
             set = (Set0<K, V>)in.readObject();
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index 4d26bd8..cd779f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -937,11 +937,11 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
     }
 
     /** {@inheritDoc} */
-    @Override public void clearLocally() {
+    @Override public void clearLocally(boolean srv, boolean near, boolean readers) {
         CacheOperationContext prev = gate.enter(opCtx);
 
         try {
-            delegate.clearLocally();
+            delegate.clearLocally(srv, near, readers);
         }
         finally {
             gate.leave(prev);
@@ -985,11 +985,11 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> clearAsync(Set<? extends K> keys) {
+    @Override public IgniteInternalFuture<?> clearAllAsync(Set<? extends K> keys) {
         CacheOperationContext prev = gate.enter(opCtx);
 
         try {
-            return delegate.clearAsync(keys);
+            return delegate.clearAllAsync(keys);
         }
         finally {
             gate.leave(prev);
@@ -1009,11 +1009,11 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
     }
 
     /** {@inheritDoc} */
-    @Override public void clearLocallyAll(Set<? extends K> keys) {
+    @Override public void clearLocallyAll(Set<? extends K> keys, boolean srv, boolean near, boolean readers) {
         CacheOperationContext prev = gate.enter(opCtx);
 
         try {
-            delegate.clearLocallyAll(keys);
+            delegate.clearLocallyAll(keys, srv, near, readers);
         }
         finally {
             gate.leave(prev);
@@ -1536,4 +1536,4 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
     @Override public String toString() {
         return S.toString(GridCacheProxyImpl.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index ae96f23..c563e59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -1311,7 +1311,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
 
         try {
             if (isAsync())
-                setFuture(delegate.clearAsync(keys));
+                setFuture(delegate.clearAllAsync(keys));
             else
                 delegate.clearAll(keys);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
index 07650da..167cc8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
@@ -925,8 +925,12 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
      * Note that this operation is local as it merely clears
      * entries from local cache. It does not remove entries from
      * remote caches or from underlying persistent storage.
+     *
+     * @param srv Whether to clear server cache.
+     * @param near Whether to clear near cache.
+     * @param readers Whether to clear readers.
      */
-    public void clearLocally();
+    public void clearLocally(boolean srv, boolean near, boolean readers);
 
     /**
      * Clears an entry from this cache and swap storage only if the entry
@@ -958,8 +962,11 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
      * remote caches or from underlying persistent storage.
      *
      * @param keys Keys to clearLocally.
+     * @param srv Whether to clear server cache.
+     * @param near Whether to clear near cache.
+     * @param readers Whether to clear readers.
      */
-    public void clearLocallyAll(Set<? extends K> keys);
+    public void clearLocallyAll(Set<? extends K> keys, boolean srv, boolean near, boolean readers);
 
     /**
      * Clears key on all nodes that store it's data. That is, caches are cleared on remote
@@ -976,7 +983,7 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
 
     /**
      * Clears keys on all nodes that store it's data. That is, caches are cleared on remote
-     * nodes and local node, as opposed to {@link IgniteInternalCache#clearLocallyAll(Set)} method which only
+     * nodes and local node, as opposed to {@link IgniteInternalCache#clearLocallyAll(Set, boolean, boolean, boolean)} method which only
      * clears local node's cache.
      * <p>
      * Ignite will make the best attempt to clear caches on all nodes. If some caches
@@ -989,7 +996,7 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
 
     /**
      * Clears cache on all nodes that store it's data. That is, caches are cleared on remote
-     * nodes and local node, as opposed to {@link IgniteInternalCache#clearLocally()} method which only
+     * nodes and local node, as opposed to {@link IgniteInternalCache#clearLocally(boolean, boolean, boolean)} method which only
      * clears local node's cache.
      * <p>
      * Ignite will make the best attempt to clear caches on all nodes. If some caches
@@ -1015,7 +1022,7 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
      * @param keys Keys to clear.
      * @return Clear future.
      */
-    public IgniteInternalFuture<?> clearAsync(Set<? extends K> keys);
+    public IgniteInternalFuture<?> clearAllAsync(Set<? extends K> keys);
 
     /**
      * Removes given key mapping from cache. If cache previously contained value for the given key,
@@ -1802,4 +1809,4 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
      * @return Future to be completed whenever loading completes.
      */
     public IgniteInternalFuture<?> localLoadCacheAsync(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args);
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 3ce9ee9..333bce2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -972,8 +972,8 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
     }
 
     /** {@inheritDoc} */
-    @Override public List<GridCacheClearAllRunnable<K, V>> splitClearLocally() {
-        return ctx.affinityNode() ? super.splitClearLocally() :
+    @Override public List<GridCacheClearAllRunnable<K, V>> splitClearLocally(boolean srv, boolean near, boolean readers) {
+        return ctx.affinityNode() ? super.splitClearLocally(srv, near, readers) :
             Collections.<GridCacheClearAllRunnable<K, V>>emptyList();
     }
 
@@ -1184,4 +1184,4 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
             return topVer;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 01c3e2b..fe519a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -99,7 +99,7 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
             /** {@inheritDoc} */
             @Override public GridCacheMapEntry create(
                 GridCacheContext ctx,
-                AffinityTopologyVersion topVer, 
+                AffinityTopologyVersion topVer,
                 KeyCacheObject key,
                 int hash,
                 CacheObject val,
@@ -450,16 +450,15 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
     }
 
     /** {@inheritDoc} */
-    @Override public boolean clearLocally0(K key, @Nullable CacheEntryPredicate[] filter) {
-        return super.clearLocally0(key, filter) | dht().clearLocally0(key, filter);
+    @Override public boolean clearLocally(K key) {
+        return super.clearLocally(key) | dht().clearLocally(key);
     }
 
     /** {@inheritDoc} */
-    @Override public void clearLocally0(Collection<? extends K> keys,
-        @Nullable CacheEntryPredicate[] filter) {
-        super.clearLocally0(keys, filter);
+    @Override public void clearLocallyAll(Set<? extends K> keys, boolean srv, boolean near, boolean readers) {
+        super.clearLocallyAll(keys, srv, near, readers);
 
-        dht().clearLocally0(keys, filter);
+        dht().clearLocallyAll(keys, srv, near, readers);
     }
 
     /** {@inheritDoc} */
@@ -532,13 +531,13 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
     }
 
     /** {@inheritDoc} */
-    @Override public List<GridCacheClearAllRunnable<K, V>> splitClearLocally() {
+    @Override public List<GridCacheClearAllRunnable<K, V>> splitClearLocally(boolean srv, boolean near, boolean readers) {
         assert configuration().getNearConfiguration() != null;
 
         if (ctx.affinityNode()) {
             GridCacheVersion obsoleteVer = ctx.versions().next();
 
-            List<GridCacheClearAllRunnable<K, V>> dhtJobs = dht().splitClearLocally();
+            List<GridCacheClearAllRunnable<K, V>> dhtJobs = dht().splitClearLocally(srv, near, readers);
 
             List<GridCacheClearAllRunnable<K, V>> res = new ArrayList<>(dhtJobs.size());
 
@@ -548,7 +547,7 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
             return res;
         }
         else
-            return super.splitClearLocally();
+            return super.splitClearLocally(srv, near, readers);
     }
 
     /**
@@ -662,4 +661,4 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
     @Override public String toString() {
         return S.toString(GridNearCacheAdapter.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheClearAllRunnable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheClearAllRunnable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheClearAllRunnable.java
index 675ea8d..eea0b6e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheClearAllRunnable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheClearAllRunnable.java
@@ -19,11 +19,12 @@ package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheClearAllRunnable;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
- * Runnable for {@link GridCacheAdapter#clearLocally()} routine for near cache.
+ * Runnable for {@link IgniteInternalCache#clearLocally(boolean, boolean, boolean)} routine for near cache.
  */
 public class GridNearCacheClearAllRunnable<K, V> extends GridCacheClearAllRunnable<K, V> {
     /** Runnable for DHT cache. */
@@ -38,9 +39,7 @@ public class GridNearCacheClearAllRunnable<K, V> extends GridCacheClearAllRunnab
      */
     public GridNearCacheClearAllRunnable(GridCacheAdapter<K, V> cache, GridCacheVersion obsoleteVer,
         GridCacheClearAllRunnable<K, V> dhtJob) {
-        super(cache, obsoleteVer, dhtJob.id(), dhtJob.totalCount());
-
-        assert dhtJob != null;
+        super(cache, obsoleteVer, dhtJob.id(), dhtJob.totalCount(), dhtJob.readers());
 
         this.dhtJob = dhtJob;
     }
@@ -61,4 +60,4 @@ public class GridNearCacheClearAllRunnable<K, V> extends GridCacheClearAllRunnab
     @Override public String toString() {
         return S.toString(GridNearCacheClearAllRunnable.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearSelfTest.java
new file mode 100644
index 0000000..5e14f14
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearSelfTest.java
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Collections;
+import java.util.Set;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
+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.jetbrains.annotations.Nullable;
+
+/**
+ * Tests for cache clear.
+ */
+public class GridCacheClearSelfTest 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);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(3);
+
+        Ignition.setClientMode(true);
+
+        startGrid("client1");
+        startGrid("client2");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearPartitioned() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.ONHEAP_TIERED, false, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearPartitionedOffHeap() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.OFFHEAP_TIERED, false, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearPartitionedNear() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.ONHEAP_TIERED, true, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearPartitionedOffHeapNear() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.OFFHEAP_TIERED, true, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearReplicated() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.ONHEAP_TIERED, false, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearReplicatedOffHeap() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.OFFHEAP_TIERED, false, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearReplicatedNear() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.ONHEAP_TIERED, true, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearReplicatedOffHeapNear() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.OFFHEAP_TIERED, true, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeyPartitioned() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.ONHEAP_TIERED, false, Collections.singleton(3));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeyPartitionedOffHeap() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.OFFHEAP_TIERED, false, Collections.singleton(3));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeyPartitionedNear() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.ONHEAP_TIERED, true, Collections.singleton(3));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeyPartitionedOffHeapNear() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.OFFHEAP_TIERED, true, Collections.singleton(3));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeyReplicated() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.ONHEAP_TIERED, false, Collections.singleton(3));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeyReplicatedOffHeap() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.OFFHEAP_TIERED, false, Collections.singleton(3));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeyReplicatedNear() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.ONHEAP_TIERED, true, Collections.singleton(3));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeyReplicatedOffHeapNear() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.OFFHEAP_TIERED, true, Collections.singleton(3));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeysPartitioned() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.ONHEAP_TIERED, false, F.asSet(2, 6, 9));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeysPartitionedOffHeap() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.OFFHEAP_TIERED, false, F.asSet(2, 6, 9));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeysPartitionedNear() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.ONHEAP_TIERED, true, F.asSet(2, 6, 9));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeysPartitionedOffHeapNear() throws Exception {
+        testClear(CacheMode.PARTITIONED, CacheMemoryMode.OFFHEAP_TIERED, true, F.asSet(2, 6, 9));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeysReplicated() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.ONHEAP_TIERED, false, F.asSet(2, 6, 9));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeysReplicatedOffHeap() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.OFFHEAP_TIERED, false, F.asSet(2, 6, 9));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeysReplicatedNear() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.ONHEAP_TIERED, true, F.asSet(2, 6, 9));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClearKeysReplicatedOffHeapNear() throws Exception {
+        testClear(CacheMode.REPLICATED, CacheMemoryMode.OFFHEAP_TIERED, true, F.asSet(2, 6, 9));
+    }
+
+    /**
+     * @param cacheMode Cache mode.
+     * @param memMode Memory mode.
+     * @param near Near cache flag.
+     * @param keys Keys to clear.
+     */
+    private void testClear(CacheMode cacheMode, CacheMemoryMode memMode, boolean near, @Nullable Set<Integer> keys) {
+        Ignite client1 = client1();
+        Ignite client2 = client2();
+
+        try {
+            CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("cache");
+
+            cfg.setCacheMode(cacheMode);
+            cfg.setMemoryMode(memMode);
+
+            IgniteCache<Integer, Integer> cache1 = near ?
+                client1.createCache(cfg, new NearCacheConfiguration<Integer, Integer>()) :
+                client1.createCache(cfg);
+
+            IgniteCache<Integer, Integer> cache2 = near ?
+                client2.createNearCache("cache", new NearCacheConfiguration<Integer, Integer>()) :
+                client2.<Integer, Integer>cache("cache");
+
+            for (int i = 0; i < 10; i++)
+                cache1.put(i, i);
+
+            for (int i = 0; i < 10; i++)
+                cache2.get(i);
+
+            assertEquals(10, cache1.size(CachePeekMode.PRIMARY));
+            assertEquals(10, cache2.size(CachePeekMode.PRIMARY));
+            assertEquals(near ? 10 : 0, cache1.localSize(CachePeekMode.NEAR));
+            assertEquals(near ? 10 : 0, cache2.localSize(CachePeekMode.NEAR));
+
+            if (F.isEmpty(keys))
+                cache1.clear();
+            else if (keys.size() == 1)
+                cache1.clear(F.first(keys));
+            else
+                cache1.clearAll(keys);
+
+            int expSize = F.isEmpty(keys) ? 0 : 10 - keys.size();
+
+            assertEquals(expSize, cache1.size(CachePeekMode.PRIMARY));
+            assertEquals(expSize, cache2.size(CachePeekMode.PRIMARY));
+            assertEquals(near ? expSize : 0, cache1.localSize(CachePeekMode.NEAR));
+            assertEquals(near ? expSize : 0, cache2.localSize(CachePeekMode.NEAR));
+        }
+        finally {
+            client1.destroyCache("cache");
+        }
+    }
+
+    /**
+     * @return Client 1.
+     */
+    private Ignite client1() {
+        return grid("client1");
+    }
+
+    /**
+     * @return Client 2.
+     */
+    private Ignite client2() {
+        return grid("client2");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
index 26548b9..62fee5e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
@@ -314,4 +314,4 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest {
 
         return F.t(primary, other);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a228c246/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
index ff53250..c2f27fe 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.GridCacheClearSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicNearEnabledFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest;
@@ -204,11 +205,14 @@ public class IgniteCacheFullApiSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCachePartitionedNearDisabledOffHeapTieredMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiNodeFullApiSelfTest.class);
 
-        // Multithreaded
+        // Multithreaded.
         suite.addTestSuite(GridCacheLocalFullApiMultithreadedSelfTest.class);
         suite.addTestSuite(GridCacheReplicatedFullApiMultithreadedSelfTest.class);
         suite.addTestSuite(GridCachePartitionedFullApiMultithreadedSelfTest.class);
 
+        // Other.
+        suite.addTestSuite(GridCacheClearSelfTest.class);
+
         return suite;
     }
-}
\ No newline at end of file
+}