# ignite-6

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

Branch: refs/heads/ignite-6
Commit: ce3259487fd3df1df8404e62f1ae2fadbc45cde9
Parents: 3bcf470 8db2a83
Author: sboikov <sboi...@gridgain.com>
Authored: Wed Feb 4 15:27:27 2015 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Wed Feb 4 15:27:27 2015 +0300

----------------------------------------------------------------------
 docs/core-site.ignite.xml                       |   2 +-
 examples/config/example-cache.xml               |  14 +-
 examples/config/example-compute.xml             |   8 +-
 examples/config/example-streamer.xml            |  30 +-
 examples/config/filesystem/core-site.xml        |  10 +-
 examples/config/filesystem/example-ggfs.xml     | 165 -----------
 examples/config/filesystem/example-ignitefs.xml | 165 +++++++++++
 examples/config/filesystem/readme.txt           |   8 +-
 .../hibernate/example-hibernate-L2-cache.xml    |   6 +-
 examples/config/servlet/WEB-INF/web.xml         |   2 +-
 examples/rest/http-rest-example.php             |   8 +-
 examples/rest/memcache-rest-example.php         |   4 +-
 .../ignite/examples/ComputeNodeStartup.java     |   4 +-
 .../apache/ignite/examples/ExamplesUtils.java   |   6 +-
 .../compute/ComputeBroadcastExample.java        |  34 +--
 .../compute/ComputeCallableExample.java         |  18 +-
 .../examples/compute/ComputeClosureExample.java |  20 +-
 .../compute/ComputeContinuousMapperExample.java |  24 +-
 .../compute/ComputeExecutorServiceExample.java  |  16 +-
 .../ComputeFibonacciContinuationExample.java    |  35 ++-
 .../compute/ComputeProjectionExample.java       |  23 +-
 .../examples/compute/ComputeReducerExample.java |  20 +-
 .../compute/ComputeRunnableExample.java         |  17 +-
 .../compute/ComputeScheduleExample.java         |  14 +-
 .../examples/compute/ComputeTaskMapExample.java |  30 +-
 .../compute/ComputeTaskSplitExample.java        |  26 +-
 .../failover/ComputeFailoverExample.java        |  17 +-
 .../failover/ComputeFailoverNodeStartup.java    |  12 +-
 .../compute/montecarlo/CreditRiskExample.java   |  30 +-
 .../compute/montecarlo/CreditRiskManager.java   |  14 +-
 .../apache/ignite/examples/compute/package.html |   2 +-
 .../examples/datagrid/CacheAffinityExample.java |  37 ++-
 .../examples/datagrid/CacheApiExample.java      | 104 ++-----
 .../datagrid/CacheContinuousQueryExample.java   |  10 +-
 .../datagrid/CacheDataLoaderExample.java        |  16 +-
 .../examples/datagrid/CacheEventsExample.java   |  21 +-
 .../examples/datagrid/CacheNodeStartup.java     |   4 +-
 .../datagrid/CachePopularNumbersExample.java    |  32 +--
 .../examples/datagrid/CachePutGetExample.java   |  29 +-
 .../examples/datagrid/CacheQueryExample.java    |  26 +-
 .../datagrid/CacheTransactionExample.java       |  41 ++-
 .../datastructures/CacheAtomicLongExample.java  |  74 -----
 .../CacheAtomicReferenceExample.java            | 110 --------
 .../CacheAtomicSequenceExample.java             |  96 -------
 .../CacheAtomicStampedExample.java              | 117 --------
 .../CacheCountDownLatchExample.java             |  96 -------
 .../datastructures/CacheQueueExample.java       | 207 --------------
 .../datastructures/CacheSetExample.java         | 187 -------------
 .../datastructures/IgniteAtomicLongExample.java |  74 +++++
 .../IgniteAtomicReferenceExample.java           | 110 ++++++++
 .../IgniteAtomicSequenceExample.java            |  96 +++++++
 .../IgniteAtomicStampedExample.java             | 117 ++++++++
 .../IgniteCountDownLatchExample.java            |  96 +++++++
 .../datastructures/IgniteQueueExample.java      | 206 ++++++++++++++
 .../datastructures/IgniteSetExample.java        | 186 +++++++++++++
 .../hibernate/HibernateL2CacheExample.java      |  18 +-
 .../HibernateL2CacheExampleNodeStartup.java     |  12 +-
 .../ignite/examples/datagrid/package.html       |   2 +-
 .../starschema/CacheStarSchemaExample.java      |  57 ++--
 .../datagrid/starschema/DimProduct.java         |   3 +-
 .../examples/datagrid/starschema/DimStore.java  |   3 +-
 .../datagrid/starschema/FactPurchase.java       |   3 +-
 .../examples/datagrid/starschema/package.html   |   2 +-
 .../store/CacheNodeWithStoreStartup.java        |  12 +-
 .../datagrid/store/CacheStoreExample.java       |  17 +-
 .../store/CacheStoreLoadDataExample.java        |  15 +-
 .../store/dummy/CacheDummyPersonStore.java      |   9 +-
 .../datagrid/store/hibernate/hibernate.cfg.xml  |   2 +-
 .../store/jdbc/CacheJdbcPersonStore.java        |  10 +-
 .../ignite/examples/events/EventsExample.java   |  32 +--
 .../ignite/examples/fs/IgniteFsExample.java     | 278 +++++++++++++++++++
 .../examples/fs/IgniteFsMapReduceExample.java   | 249 +++++++++++++++++
 .../ignite/examples/fs/IgniteFsNodeStartup.java |  41 +++
 .../org/apache/ignite/examples/fs/package.html  |  23 ++
 .../ignite/examples/ggfs/GgfsExample.java       | 278 -------------------
 .../examples/ggfs/GgfsMapReduceExample.java     | 249 -----------------
 .../ignite/examples/ggfs/GgfsNodeStartup.java   |  41 ---
 .../apache/ignite/examples/ggfs/package.html    |  23 --
 .../examples/messaging/MessagingExample.java    |  36 +--
 .../messaging/MessagingPingPongExample.java     |  26 +-
 .../MessagingPingPongListenActorExample.java    |  20 +-
 .../client/memcache/MemcacheRestExample.java    |  22 +-
 .../MemcacheRestExampleNodeStartup.java         |  14 +-
 .../misc/deployment/DeploymentExample.java      |  34 +--
 .../misc/lifecycle/LifecycleExample.java        |  24 +-
 .../misc/springbean/SpringBeanExample.java      |  30 +-
 .../examples/misc/springbean/package.html       |   2 +-
 .../examples/misc/springbean/spring-bean.xml    |   8 +-
 .../org/apache/ignite/examples/package.html     |   2 +-
 .../examples/services/ServicesExample.java      |  16 +-
 .../streaming/StreamingCheckInExample.java      |  30 +-
 .../streaming/StreamingNodeStartup.java         |   4 +-
 .../StreamingPopularNumbersExample.java         |  40 +--
 .../streaming/StreamingPriceBarsExample.java    |  38 +--
 .../StreamingRunningAverageExample.java         |   6 +-
 .../apache/ignite/examples/ComputeExample.java  |  22 +-
 .../ignite/examples/MessagingExample.java       |  66 +++--
 .../examples/ScalarCacheAffinityExample1.scala  |  22 +-
 .../examples/ScalarCacheAffinityExample2.scala  |  18 +-
 .../ScalarCacheAffinitySimpleExample.scala      |   6 +-
 .../scalar/examples/ScalarCacheExample.scala    |   4 +-
 .../ScalarCachePopularNumbersExample.scala      |  26 +-
 .../examples/ScalarCacheQueryExample.scala      |  20 +-
 .../scalar/examples/ScalarClosureExample.scala  |  20 +-
 .../examples/ScalarContinuationExample.scala    |  33 ++-
 .../examples/ScalarCreditRiskExample.scala      |  22 +-
 .../scalar/examples/ScalarJvmCloudExample.scala |  22 +-
 .../examples/ScalarPiCalculationExample.scala   |   6 +-
 .../scalar/examples/ScalarPingPongExample.scala |  14 +-
 .../scalar/examples/ScalarPrimeExample.scala    |  16 +-
 .../scalar/examples/ScalarScheduleExample.scala |   6 +-
 .../examples/ScalarSnowflakeSchemaExample.scala |  40 +--
 .../scalar/examples/ScalarTaskExample.scala     |  14 +-
 .../examples/ScalarWorldShortestMapReduce.scala |   2 +-
 .../BasicExamplesMultiNodeSelfTest.java         |  28 ++
 .../ignite/examples/BasicExamplesSelfTest.java  |  82 ++++++
 .../CacheExamplesMultiNodeSelfTest.java         |  48 ++++
 .../ignite/examples/CacheExamplesSelfTest.java  | 155 +++++++++++
 ...heStoreLoadDataExampleMultiNodeSelfTest.java |  39 +++
 .../examples/CheckpointExamplesSelfTest.java    |  45 +++
 .../ContinuationExamplesMultiNodeSelfTest.java  |  28 ++
 .../examples/ContinuationExamplesSelfTest.java  |  33 +++
 ...ntinuousMapperExamplesMultiNodeSelfTest.java |  28 ++
 .../ContinuousMapperExamplesSelfTest.java       |  33 +++
 .../DeploymentExamplesMultiNodeSelfTest.java    |  30 ++
 .../examples/DeploymentExamplesSelfTest.java    |  33 +++
 .../EventsExamplesMultiNodeSelfTest.java        |  28 ++
 .../ignite/examples/EventsExamplesSelfTest.java |  33 +++
 .../GridBasicExamplesMultiNodeSelfTest.java     |  28 --
 .../examples/GridBasicExamplesSelfTest.java     |  82 ------
 .../GridCacheExamplesMultiNodeSelfTest.java     |  48 ----
 .../examples/GridCacheExamplesSelfTest.java     | 155 -----------
 ...heStoreLoadDataExampleMultiNodeSelfTest.java |  39 ---
 .../GridCheckpointExamplesSelfTest.java         |  45 ---
 ...idContinuationExamplesMultiNodeSelfTest.java |  28 --
 .../GridContinuationExamplesSelfTest.java       |  33 ---
 ...ntinuousMapperExamplesMultiNodeSelfTest.java |  28 --
 .../GridContinuousMapperExamplesSelfTest.java   |  33 ---
 ...GridDeploymentExamplesMultiNodeSelfTest.java |  30 --
 .../GridDeploymentExamplesSelfTest.java         |  33 ---
 .../GridEventsExamplesMultiNodeSelfTest.java    |  28 --
 .../examples/GridEventsExamplesSelfTest.java    |  33 ---
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  31 ---
 .../GridHibernateL2CacheExampleSelfTest.java    |  33 ---
 .../examples/GridLifecycleExamplesSelfTest.java |  33 ---
 ...idMemcacheRestExamplesMultiNodeSelfTest.java |  31 ---
 .../GridMemcacheRestExamplesSelfTest.java       |  41 ---
 .../examples/GridMessagingExamplesSelfTest.java |  52 ----
 ...GridMonteCarloExamplesMultiNodeSelfTest.java |  28 --
 .../GridMonteCarloExamplesSelfTest.java         |  74 -----
 .../examples/GridProjectionExampleSelfTest.java |  39 ---
 .../GridSpringBeanExamplesSelfTest.java         |  33 ---
 .../GridTaskExamplesMultiNodeSelfTest.java      |  28 --
 .../examples/GridTaskExamplesSelfTest.java      |  40 ---
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |  31 +++
 .../HibernateL2CacheExampleSelfTest.java        |  33 +++
 .../examples/IgniteFsExamplesSelfTest.java      |  16 +-
 .../examples/LifecycleExamplesSelfTest.java     |  33 +++
 .../MemcacheRestExamplesMultiNodeSelfTest.java  |  31 +++
 .../examples/MemcacheRestExamplesSelfTest.java  |  41 +++
 .../examples/MessagingExamplesSelfTest.java     |  52 ++++
 .../MonteCarloExamplesMultiNodeSelfTest.java    |  28 ++
 .../examples/MonteCarloExamplesSelfTest.java    |  74 +++++
 .../examples/ProjectionExampleSelfTest.java     |  39 +++
 .../examples/SpringBeanExamplesSelfTest.java    |  33 +++
 .../examples/TaskExamplesMultiNodeSelfTest.java |  28 ++
 .../ignite/examples/TaskExamplesSelfTest.java   |  40 +++
 .../testsuites/IgniteExamplesSelfTestSuite.java |  54 ++--
 .../ScalarExamplesSelfTestSuite.scala           |   7 +-
 .../src/main/java/org/apache/ignite/Ignite.java |   4 +-
 .../org/apache/ignite/cluster/ClusterGroup.java |   9 +-
 .../ignite/internal/ClusterGroupAdapter.java    |  51 +---
 .../ignite/internal/IgniteClusterAsyncImpl.java |  12 +-
 .../apache/ignite/internal/IgniteKernal.java    |   2 +-
 .../processors/cache/GridCacheMapEntry.java     |   6 +-
 .../processors/cache/IgniteCacheProxy.java      |   7 +
 .../test/config/load/mongo-multinode-foster.xml | 170 ------------
 .../GridProjectionForCachesSelfTest.java        |  27 +-
 .../ignite/testframework/junits/IgniteMock.java |   2 +
 ...idHadoopDefaultMapReducePlannerSelfTest.java |   6 +-
 .../scala/org/apache/ignite/scalar/scalar.scala |  14 +-
 .../tests/ScalarAffinityRoutingSpec.scala       |  12 +-
 .../tests/ScalarCacheProjectionSpec.scala       |   2 +-
 .../ignite/scalar/tests/ScalarCacheSpec.scala   |   2 +-
 .../scalar/tests/ScalarProjectionSpec.scala     |  36 +--
 .../org/apache/ignite/IgniteSpringBean.java     |   5 +
 186 files changed, 3689 insertions(+), 3953 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java
index d70edc5,fc657f1..0000000
deleted file mode 100644,100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java
+++ /dev/null
@@@ -1,74 -1,78 +1,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.datastructures;
--
--import org.apache.ignite.*;
 -import org.apache.ignite.cache.datastructures.*;
--import org.apache.ignite.examples.datagrid.*;
--import org.apache.ignite.lang.*;
--
--import java.util.*;
--
--/**
-- * Demonstrates a simple usage of distributed atomic long.
-- * <p>
-- * Remote nodes should always be started with special configuration file which
-- * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
-- * <p>
-- * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
-  * start GridGain node with {@code examples/config/example-cache.xml} 
configuration.
 - * start node with {@code examples/config/example-cache.xml} configuration.
-- */
--public final class CacheAtomicLongExample {
 -    /** Cache name. */
 -    private static final String CACHE_NAME = "partitioned_tx";
 -
--    /** Number of retries */
--    private static final int RETRIES = 20;
--
--    /**
--     * Executes example.
--     *
--     * @param args Command line arguments, none required.
-      * @throws Exception If example execution failed.
 -     * @throws IgniteCheckedException If example execution failed.
--     */
-     public static void main(String[] args) throws Exception {
-         try (Ignite g = Ignition.start("examples/config/example-cache.xml")) {
 -    public static void main(String[] args) throws IgniteCheckedException {
 -        try (Ignite ignite = 
Ignition.start("examples/config/example-cache.xml")) {
--            System.out.println();
-             System.out.println(">>> Atomic long example started.");
 -            System.out.println(">>> Cache atomic long example started.");
--
-             // Make name for atomic long (by which it will be known in the 
grid).
 -            // Make name for atomic long (by which it will be known in the 
cluster).
--            String atomicName = UUID.randomUUID().toString();
--
-             // Initialize atomic long in grid.
-             final IgniteAtomicLong atomicLong = g.atomicLong(atomicName, 0, 
true);
 -            // Initialize atomic long in ignite.
 -            final CacheAtomicLong atomicLong = 
ignite.cache(CACHE_NAME).dataStructures().atomicLong(atomicName, 0, true);
--
--            System.out.println();
--            System.out.println("Atomic long initial value : " + 
atomicLong.get() + '.');
--
-             // Try increment atomic long from all grid nodes.
-             // Note that this node is also part of the grid.
-             g.compute().broadcast(new IgniteCallable<Object>() {
-                 @Override public Object call() {
 -            // Try increment atomic long from all nodes.
 -            // Note that this node is also part of the ignite cluster.
 -            
ignite.compute(ignite.cluster().forCacheNodes(CACHE_NAME)).call(new 
IgniteCallable<Object>() {
 -                @Override public Object call() throws  Exception {
--                    for (int i = 0; i < RETRIES; i++)
--                        System.out.println("AtomicLong value has been 
incremented: " + atomicLong.incrementAndGet());
--
--                    return null;
--                }
--            });
--
--            System.out.println();
--            System.out.println("Atomic long value after successful CAS: " + 
atomicLong.get());
--        }
--    }
--}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java
index e2b8602,4ce2e7a..0000000
deleted file mode 100644,100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java
+++ /dev/null
@@@ -1,110 -1,126 +1,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.datastructures;
--
--import org.apache.ignite.*;
 -import org.apache.ignite.cache.datastructures.*;
--import org.apache.ignite.examples.datagrid.*;
--import org.apache.ignite.lang.*;
--
--import java.util.*;
--
--/**
-- * Demonstrates a simple usage of distributed atomic reference.
-- * <p>
-- * Remote nodes should always be started with special configuration file which
-- * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
-- * <p>
-- * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
-  * start GridGain node with {@code examples/config/example-cache.xml} 
configuration.
 - * start node with {@code examples/config/example-cache.xml} configuration.
-- */
--public final class CacheAtomicReferenceExample {
 -    /** Cache name. */
 -    private static final String CACHE_NAME = "partitioned_tx";
 -
--    /**
--     * Executes example.
--     *
--     * @param args Command line arguments, none required.
-      * @throws Exception If example execution failed.
 -     * @throws IgniteCheckedException If example execution failed.
--     */
-     public static void main(String[] args) throws Exception {
-         try (Ignite g = Ignition.start("examples/config/example-cache.xml")) {
 -    public static void main(String[] args) throws IgniteCheckedException {
 -        try (Ignite ignite = 
Ignition.start("examples/config/example-cache.xml")) {
--            System.out.println();
-             System.out.println(">>> Atomic reference example started.");
 -            System.out.println(">>> Cache atomic reference example started.");
--
--            // Make name of atomic reference.
--            final String refName = UUID.randomUUID().toString();
--
--            // Make value of atomic reference.
--            String val = UUID.randomUUID().toString();
--
-             // Initialize atomic reference in grid.
-             IgniteAtomicReference<String> ref = g.atomicReference(refName, 
val, true);
 -            // Initialize atomic reference in cluster.
 -            CacheAtomicReference<String> ref = 
ignite.cache(CACHE_NAME).dataStructures().
 -                atomicReference(refName, val, true);
--
--            System.out.println("Atomic reference initial value : " + 
ref.get() + '.');
--
-             // Make closure for checking atomic reference value on grid.
-             Runnable c = new ReferenceClosure(refName);
 -            // Make closure for checking atomic reference value on cluster.
 -            Runnable c = new ReferenceClosure(CACHE_NAME, refName);
--
-             // Check atomic reference on all grid nodes.
-             g.compute().run(c);
 -            // Check atomic reference on all cluster nodes.
 -            ignite.compute().run(c);
--
--            // Make new value of atomic reference.
--            String newVal = UUID.randomUUID().toString();
--
--            System.out.println("Try to change value of atomic reference with 
wrong expected value.");
--
--            ref.compareAndSet("WRONG EXPECTED VALUE", newVal); // Won't 
change.
--
-             // Check atomic reference on all grid nodes.
 -            // Check atomic reference on all cluster nodes.
--            // Atomic reference value shouldn't be changed.
-             g.compute().run(c);
 -            ignite.compute().run(c);
--
--            System.out.println("Try to change value of atomic reference with 
correct expected value.");
--
--            ref.compareAndSet(val, newVal);
--
-             // Check atomic reference on all grid nodes.
 -            // Check atomic reference on all cluster nodes.
--            // Atomic reference value should be changed.
-             g.compute().run(c);
 -            ignite.compute().run(c);
--        }
--
--        System.out.println();
--        System.out.println("Finished atomic reference example...");
-         System.out.println("Check all nodes for output (this node is also 
part of the grid).");
 -        System.out.println("Check all nodes for output (this node is also 
part of the cluster).");
--    }
--
--    /**
--     * Obtains atomic reference.
--     */
--    private static class ReferenceClosure implements IgniteRunnable {
 -        /** Cache name. */
 -        private final String cacheName;
 -
--        /** Reference name. */
--        private final String refName;
--
--        /**
 -         * @param cacheName Cache name.
--         * @param refName Reference name.
--         */
-         ReferenceClosure(String refName) {
 -        ReferenceClosure(String cacheName, String refName) {
 -            this.cacheName = cacheName;
--            this.refName = refName;
--        }
--
--        /** {@inheritDoc} */
--        @Override public void run() {
-             IgniteAtomicReference<String> ref = 
Ignition.ignite().atomicReference(refName, null, true);
 -            try {
 -                CacheAtomicReference<String> ref = 
Ignition.ignite().cache(cacheName).dataStructures().
 -                    atomicReference(refName, null, true);
--
-             System.out.println("Atomic reference value is " + ref.get() + 
'.');
 -                System.out.println("Atomic reference value is " + ref.get() + 
'.');
 -            }
 -            catch (IgniteCheckedException e) {
 -                throw new IgniteException(e);
 -            }
--        }
--    }
--}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicSequenceExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicSequenceExample.java
index 71c131f,6317c3f..0000000
deleted file mode 100644,100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicSequenceExample.java
+++ /dev/null
@@@ -1,96 -1,112 +1,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.datastructures;
--
--import org.apache.ignite.*;
 -import org.apache.ignite.cache.datastructures.*;
--import org.apache.ignite.examples.datagrid.*;
--import org.apache.ignite.lang.*;
--
--import java.util.*;
--
--/**
-- * Demonstrates a simple usage of distributed atomic sequence.
-- * <p>
-- * Remote nodes should always be started with special configuration file which
-- * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
-- * <p>
-- * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
-  * start GridGain node with {@code examples/config/example-cache.xml} 
configuration.
 - * start node with {@code examples/config/example-cache.xml} configuration.
-- */
--public final class CacheAtomicSequenceExample {
 -    /** Cache name. */
 -    private static final String CACHE_NAME = "partitioned_tx";
 -
--    /** Number of retries */
--    private static final int RETRIES = 20;
--
--    /**
--     * Executes example.
--     *
--     * @param args Command line arguments, none required.
-      * @throws Exception If example execution failed.
 -     * @throws IgniteCheckedException If example execution failed.
--     */
-     public static void main(String[] args) throws Exception {
-         try (Ignite g = Ignition.start("examples/config/example-cache.xml")) {
 -    public static void main(String[] args) throws IgniteCheckedException {
 -        try (Ignite ignite = 
Ignition.start("examples/config/example-cache.xml")) {
--            System.out.println();
--            System.out.println(">>> Cache atomic sequence example started.");
--
--            // Make name of sequence.
--            final String seqName = UUID.randomUUID().toString();
--
-             // Initialize atomic sequence in grid.
-             IgniteAtomicSequence seq = g.atomicSequence(seqName, 0, true);
 -            // Initialize atomic sequence in ignite.
 -            CacheAtomicSequence seq = 
ignite.cache(CACHE_NAME).dataStructures().atomicSequence(seqName, 0, true);
--
--            // First value of atomic sequence on this node.
--            long firstVal = seq.get();
--
--            System.out.println("Sequence initial value: " + firstVal);
--
-             // Try increment atomic sequence on all grid nodes. Note that 
this node is also part of the grid.
-             g.compute().run(new SequenceClosure(seqName));
 -            // Try increment atomic sequence on all cluster nodes. Note that 
this node is also part of the cluster.
 -            ignite.compute().run(new SequenceClosure(CACHE_NAME, seqName));
--
--            System.out.println("Sequence after incrementing [expected=" + 
(firstVal + RETRIES) + ", actual=" +
--                seq.get() + ']');
--        }
--
--        System.out.println();
--        System.out.println("Finished atomic sequence example...");
-         System.out.println("Check all nodes for output (this node is also 
part of the grid).");
 -        System.out.println("Check all nodes for output (this node is also 
part of the cluster).");
--    }
--
--    /**
--     * Obtains atomic sequence.
--     */
--    private static class SequenceClosure implements IgniteRunnable {
 -        /** Cache name. */
 -        private final String cacheName;
 -
--        /** Sequence name. */
--        private final String seqName;
--
--        /**
 -         * @param cacheName Cache name.
--         * @param seqName Sequence name.
--         */
-         SequenceClosure(String seqName) {
 -        SequenceClosure(String cacheName, String seqName) {
 -            this.cacheName = cacheName;
--            this.seqName = seqName;
--        }
--
--        /** {@inheritDoc} */
--        @Override public void run() {
-             IgniteAtomicSequence seq = 
Ignition.ignite().atomicSequence(seqName, 0, true);
 -            try {
 -                CacheAtomicSequence seq = 
Ignition.ignite().cache(cacheName).dataStructures().
 -                    atomicSequence(seqName, 0, true);
--
-             for (int i = 0; i < RETRIES; i++)
-                 System.out.println("Sequence [currentValue=" + seq.get() + ", 
afterIncrement=" +
-                     seq.incrementAndGet() + ']');
 -                for (int i = 0; i < RETRIES; i++)
 -                    System.out.println("Sequence [currentValue=" + seq.get() 
+ ", afterIncrement=" +
 -                        seq.incrementAndGet() + ']');
 -
 -            }
 -            catch (IgniteCheckedException e) {
 -                throw new IgniteException(e);
 -            }
--        }
--    }
--}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicStampedExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicStampedExample.java
index b2031e0,dd54374..0000000
deleted file mode 100644,100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicStampedExample.java
+++ /dev/null
@@@ -1,117 -1,132 +1,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.datastructures;
--
--import org.apache.ignite.*;
 -import org.apache.ignite.cache.datastructures.*;
--import org.apache.ignite.examples.datagrid.*;
--import org.apache.ignite.lang.*;
--
--import java.util.*;
--
--/**
-- * Demonstrates a simple usage of distributed atomic stamped.
-- * <p>
-- * Remote nodes should always be started with special configuration file which
-- * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
-- * <p>
-- * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
-  * start GridGain node with {@code examples/config/example-cache.xml} 
configuration.
 - * start node with {@code examples/config/example-cache.xml} configuration.
-- */
--public final class CacheAtomicStampedExample {
 -    /** Cache name. */
 -    private static final String CACHE_NAME = "partitioned_tx";
 -
--    /**
--     * Executes example.
--     *
--     * @param args Command line arguments, none required.
-      * @throws Exception If example execution failed.
 -     * @throws IgniteCheckedException If example execution failed.
--     */
-     public static void main(String[] args) throws Exception {
-         try (Ignite g = Ignition.start("examples/config/example-cache.xml")) {
 -    public static void main(String[] args) throws IgniteCheckedException {
 -        try (Ignite ignite = 
Ignition.start("examples/config/example-cache.xml")) {
--            System.out.println();
-             System.out.println(">>> Atomic stamped example started.");
 -            System.out.println(">>> Cache atomic stamped example started.");
--
--            // Make name of atomic stamped.
--            String stampedName = UUID.randomUUID().toString();
--
--            // Make value of atomic stamped.
--            String val = UUID.randomUUID().toString();
--
--            // Make stamp of atomic stamped.
--            String stamp = UUID.randomUUID().toString();
--
--            // Initialize atomic stamped in cache.
-             IgniteAtomicStamped<String, String> stamped = 
g.atomicStamped(stampedName, val, stamp, true);
 -            CacheAtomicStamped<String, String> stamped = 
ignite.cache(CACHE_NAME).dataStructures().
 -                atomicStamped(stampedName, val, stamp, true);
--
--            System.out.println("Atomic stamped initial [value=" + 
stamped.value() + ", stamp=" + stamped.stamp() + ']');
--
-             // Make closure for checking atomic stamped on grid.
-             Runnable c = new StampedUpdateClosure(stampedName);
 -            // Make closure for checking atomic stamped on ignite.
 -            Runnable c = new StampedUpdateClosure(CACHE_NAME, stampedName);
--
-             // Check atomic stamped on all grid nodes.
-             g.compute().run(c);
 -            // Check atomic stamped on all cluster nodes.
 -            ignite.compute().run(c);
--
--            // Make new value of atomic stamped.
--            String newVal = UUID.randomUUID().toString();
--
--            // Make new stamp of atomic stamped.
--            String newStamp = UUID.randomUUID().toString();
--
--            System.out.println("Try to change value and stamp of atomic 
stamped with wrong expected value and stamp.");
--
--            stamped.compareAndSet("WRONG EXPECTED VALUE", newVal, "WRONG 
EXPECTED STAMP", newStamp);
--
-             // Check atomic stamped on all grid nodes.
 -            // Check atomic stamped on all cluster nodes.
--            // Atomic stamped value and stamp shouldn't be changed.
-             g.compute().run(c);
 -            ignite.compute().run(c);
--
--            System.out.println("Try to change value and stamp of atomic 
stamped with correct value and stamp.");
--
--            stamped.compareAndSet(val, newVal, stamp, newStamp);
--
-             // Check atomic stamped on all grid nodes.
 -            // Check atomic stamped on all cluster nodes.
--            // Atomic stamped value and stamp should be changed.
-             g.compute().run(c);
 -            ignite.compute().run(c);
--        }
--
--        System.out.println();
--        System.out.println("Finished atomic stamped example...");
-         System.out.println("Check all nodes for output (this node is also 
part of the grid).");
 -        System.out.println("Check all nodes for output (this node is also 
part of the cluster).");
--    }
--
--    /**
--     * Performs update of on an atomic stamped variable in cache.
--     */
--    private static class StampedUpdateClosure implements IgniteRunnable {
 -        /** Cache name. */
 -        private final String cacheName;
 -
--        /** Atomic stamped variable name. */
--        private final String stampedName;
--
--        /**
 -         * @param cacheName Cache name.
--         * @param stampedName Atomic stamped variable name.
--         */
-         StampedUpdateClosure(String stampedName) {
 -        StampedUpdateClosure(String cacheName, String stampedName) {
 -            this.cacheName = cacheName;
--            this.stampedName = stampedName;
--        }
--
--        /** {@inheritDoc} */
--        @Override public void run() {
-             IgniteAtomicStamped<String, String> stamped = Ignition.ignite().
-                 atomicStamped(stampedName, null, null, true);
 -            try {
 -                CacheAtomicStamped<String, String> stamped = 
Ignition.ignite().cache(cacheName).dataStructures().
 -                    atomicStamped(stampedName, null, null, true);
--
-             System.out.println("Atomic stamped [value=" + stamped.value() + 
", stamp=" + stamped.stamp() + ']');
 -                System.out.println("Atomic stamped [value=" + stamped.value() 
+ ", stamp=" + stamped.stamp() + ']');
 -            }
 -            catch (IgniteCheckedException e) {
 -                throw new IgniteException(e);
 -            }
--        }
--    }
--}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheCountDownLatchExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheCountDownLatchExample.java
index c255f87,de01b34..0000000
deleted file mode 100644,100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheCountDownLatchExample.java
+++ /dev/null
@@@ -1,96 -1,112 +1,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.datastructures;
--
--import org.apache.ignite.*;
 -import org.apache.ignite.cache.datastructures.*;
--import org.apache.ignite.examples.datagrid.*;
--import org.apache.ignite.lang.*;
--
--import java.util.*;
--
--/**
-- * Demonstrates a simple usage of distributed count down latch.
-- * <p>
-- * Remote nodes should always be started with special configuration file which
-- * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
-- * <p>
-- * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
-  * start GridGain node with {@code examples/config/example-cache.xml} 
configuration.
 - * start node with {@code examples/config/example-cache.xml} configuration.
-- */
--public class CacheCountDownLatchExample {
 -    /** Cache name. */
 -    private static final String CACHE_NAME = "partitioned_tx";
 -
--    /** Number of latch initial count */
--    private static final int INITIAL_COUNT = 10;
--
--    /**
--     * Executes example.
--     *
--     * @param args Command line arguments, none required.
--     * @throws IgniteCheckedException If example execution failed.
--     */
-     public static void main(String[] args) throws Exception {
-         try (Ignite g = Ignition.start("examples/config/example-cache.xml")) {
 -    public static void main(String[] args) throws IgniteCheckedException {
 -        try (Ignite ignite = 
Ignition.start("examples/config/example-cache.xml")) {
--            System.out.println();
--            System.out.println(">>> Cache atomic countdown latch example 
started.");
--
--            // Make name of count down latch.
--            final String latchName = UUID.randomUUID().toString();
--
-             // Initialize count down latch in grid.
-             IgniteCountDownLatch latch = g.countDownLatch(latchName, 
INITIAL_COUNT, false, true);
 -            // Initialize count down latch in ignite.
 -            CacheCountDownLatch latch = 
ignite.cache(CACHE_NAME).dataStructures().
 -                countDownLatch(latchName, INITIAL_COUNT, false, true);
--
--            System.out.println("Latch initial value: " + latch.count());
--
-             // Start waiting on the latch on all grid nodes.
 -            // Start waiting on the latch on all cluster nodes.
--            for (int i = 0; i < INITIAL_COUNT; i++)
-                 g.compute().run(new LatchClosure(latchName));
 -                ignite.compute().run(new LatchClosure(CACHE_NAME, latchName));
--
--            // Wait for latch to go down which essentially means that all 
remote closures completed.
--            latch.await();
--
--            System.out.println("All latch closures have completed.");
--        }
--
--        System.out.println();
--        System.out.println("Finished count down latch example...");
-         System.out.println("Check all nodes for output (this node is also 
part of the grid).");
 -        System.out.println("Check all nodes for output (this node is also 
part of the cluster).");
--    }
--
--    /**
--     * Closure which simply waits on the latch on all nodes.
--     */
--    private static class LatchClosure implements IgniteRunnable {
 -        /** Cache name. */
 -        private final String cacheName;
 -
--        /** Latch name. */
--        private final String latchName;
--
--        /**
 -         * @param cacheName Cache name.
--         * @param latchName Latch name.
--         */
-         LatchClosure(String latchName) {
 -        LatchClosure(String cacheName, String latchName) {
 -            this.cacheName = cacheName;
--            this.latchName = latchName;
--        }
--
--        /** {@inheritDoc} */
--        @Override public void run() {
-             IgniteCountDownLatch latch = 
Ignition.ignite().countDownLatch(latchName, 1, false, true);
 -            try {
 -                CacheCountDownLatch latch = 
Ignition.ignite().cache(cacheName).dataStructures().
 -                    countDownLatch(latchName, 1, false, true);
--
-             int newCnt = latch.countDown();
 -                int newCnt = latch.countDown();
--
-             System.out.println("Counted down [newCnt=" + newCnt + ", nodeId=" 
+ Ignition.ignite().cluster().localNode().id() + ']');
 -                System.out.println("Counted down [newCnt=" + newCnt + ", 
nodeId=" + Ignition.ignite().cluster().localNode().id() + ']');
 -            }
 -            catch (IgniteCheckedException e) {
 -                throw new RuntimeException(e);
 -            }
--        }
--    }
--}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheQueueExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheQueueExample.java
index 4ae9395,a2d2b55..0000000
deleted file mode 100644,100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheQueueExample.java
+++ /dev/null
@@@ -1,207 -1,214 +1,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.datastructures;
--
--import org.apache.ignite.*;
- import org.apache.ignite.configuration.*;
 -import org.apache.ignite.cache.datastructures.*;
--import org.apache.ignite.examples.datagrid.*;
--import org.apache.ignite.lang.*;
--
--import java.util.*;
--
--/**
-  * Grid cache distributed queue example. This example demonstrates {@code 
FIFO} unbounded
 - * Ignite cache distributed queue example. This example demonstrates {@code 
FIFO} unbounded
-- * cache queue.
-- * <p>
-- * Remote nodes should always be started with special configuration file which
-- * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
-- * <p>
-- * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
-  * start GridGain node with {@code examples/config/example-cache.xml} 
configuration.
 - * start node with {@code examples/config/example-cache.xml} configuration.
-- */
--public class CacheQueueExample {
--    /** Cache name. */
--    private static final String CACHE_NAME = "partitioned_tx";
--
--    /** Number of retries */
--    private static final int RETRIES = 20;
--
--    /** Queue instance. */
-     private static IgniteQueue<String> queue;
 -    private static CacheQueue<String> queue;
--
--    /**
--     * Executes example.
--     *
--     * @param args Command line arguments, none required.
-      * @throws Exception If example execution failed.
 -     * @throws IgniteCheckedException If example execution failed.
--     */
-     public static void main(String[] args) throws Exception {
-         try (Ignite g = Ignition.start("examples/config/example-cache.xml")) {
 -    public static void main(String[] args) throws IgniteCheckedException {
 -        try (Ignite ignite = 
Ignition.start("examples/config/example-cache.xml")) {
--            System.out.println();
--            System.out.println(">>> Cache queue example started.");
--
--            // Make queue name.
--            String queueName = UUID.randomUUID().toString();
--
-             queue = initializeQueue(g, queueName);
 -            queue = initializeQueue(ignite, queueName);
--
-             readFromQueue(g);
 -            readFromQueue(ignite);
--
-             writeToQueue(g);
 -            writeToQueue(ignite);
--
-             clearAndRemoveQueue(g);
 -            clearAndRemoveQueue(ignite);
--        }
--
--        System.out.println("Cache queue example finished.");
--    }
--
--    /**
--     * Initialize queue.
--     *
-      * @param g Grid.
 -     * @param ignite Ignite.
--     * @param queueName Name of queue.
--     * @return Queue.
-      * @throws IgniteException If execution failed.
 -     * @throws IgniteCheckedException If execution failed.
--     */
-     private static IgniteQueue<String> initializeQueue(Ignite g, String 
queueName) throws IgniteException {
-         IgniteCollectionConfiguration colCfg = new 
IgniteCollectionConfiguration();
- 
-         colCfg.setCacheName(CACHE_NAME);
- 
 -    private static CacheQueue<String> initializeQueue(Ignite ignite, String 
queueName) throws IgniteCheckedException {
--        // Initialize new FIFO queue.
-         IgniteQueue<String> queue = g.queue(queueName, colCfg, 0, true);
 -        CacheQueue<String> queue = 
ignite.cache(CACHE_NAME).dataStructures().queue(queueName, 0, false, true);
--
--        // Initialize queue items.
--        // We will be use blocking operation and queue size must be 
appropriated.
-         for (int i = 0; i < g.cluster().nodes().size() * RETRIES * 2; i++)
 -        for (int i = 0; i < ignite.cluster().nodes().size() * RETRIES * 2; 
i++)
--            queue.put(Integer.toString(i));
--
--        System.out.println("Queue size after initializing: " + queue.size());
--
--        return queue;
--    }
--
--    /**
--     * Read items from head and tail of queue.
--     *
-      * @param g Grid.
 -     * @param ignite Ignite.
--     * @throws IgniteException If failed.
--     */
-     private static void readFromQueue(Ignite g) throws IgniteException {
 -    private static void readFromQueue(Ignite ignite) throws IgniteException {
--        final String queueName = queue.name();
--
--        // Read queue items on each node.
-         g.compute().run(new QueueClosure(queueName, false));
 -        ignite.compute().run(new QueueClosure(CACHE_NAME, queueName, false));
--
--        System.out.println("Queue size after reading [expected=0, actual=" + 
queue.size() + ']');
--    }
--
--    /**
--     * Write items into queue.
--     *
-      * @param g Grid.
 -     * @param ignite Ignite.
--     * @throws IgniteException If failed.
--     */
-     private static void writeToQueue(Ignite g) throws IgniteException {
 -    private static void writeToQueue(Ignite ignite) throws IgniteException {
--        final String queueName = queue.name();
--
--        // Write queue items on each node.
-         g.compute().run(new QueueClosure(queueName, true));
 -        ignite.compute().run(new QueueClosure(CACHE_NAME, queueName, true));
--
-         System.out.println("Queue size after writing [expected=" + 
g.cluster().nodes().size() * RETRIES +
 -        System.out.println("Queue size after writing [expected=" + 
ignite.cluster().nodes().size() * RETRIES +
--            ", actual=" + queue.size() + ']');
--
--        System.out.println("Iterate over queue.");
--
--        // Iterate over queue.
--        for (String item : queue)
--            System.out.println("Queue item: " + item);
--    }
--
--    /**
--     * Clear and remove queue.
--     *
-      * @param g Grid.
-      * @throws IgniteException If execution failed.
 -     * @param ignite Ignite.
 -     * @throws IgniteCheckedException If execution failed.
--     */
-     private static void clearAndRemoveQueue(Ignite g) throws IgniteException {
 -    private static void clearAndRemoveQueue(Ignite ignite) throws 
IgniteCheckedException {
--        System.out.println("Queue size before clearing: " + queue.size());
--
--        // Clear queue.
--        queue.clear();
--
--        System.out.println("Queue size after clearing: " + queue.size());
--
-         // Remove queue.
-         queue.close();
 -        // Remove queue from cache.
 -        ignite.cache(CACHE_NAME).dataStructures().removeQueue(queue.name());
--
--        // Try to work with removed queue.
--        try {
--            queue.poll();
--        }
--        catch (IgniteException expected) {
--            System.out.println("Expected exception - " + 
expected.getMessage());
--        }
--    }
--
--    /**
--     * Closure to populate or poll the queue.
--     */
--    private static class QueueClosure implements IgniteRunnable {
 -        /** Cache name. */
 -        private final String cacheName;
 -
--        /** Queue name. */
--        private final String queueName;
--
--        /** Flag indicating whether to put or poll. */
--        private final boolean put;
--
--        /**
 -         * @param cacheName Cache name.
--         * @param queueName Queue name.
--         * @param put Flag indicating whether to put or poll.
--         */
-         QueueClosure(String queueName, boolean put) {
 -        QueueClosure(String cacheName, String queueName, boolean put) {
 -            this.cacheName = cacheName;
--            this.queueName = queueName;
--            this.put = put;
--        }
--
--        /** {@inheritDoc} */
--        @Override public void run() {
-             IgniteQueue<String> queue = Ignition.ignite().queue(queueName, 
null, 0, false);
 -            try {
 -                CacheQueue<String> queue = 
Ignition.ignite().cache(cacheName).dataStructures().
 -                    queue(queueName, 0, false, true);
--
-             if (put) {
-                 UUID locId = Ignition.ignite().cluster().localNode().id();
 -                if (put) {
 -                    UUID locId = Ignition.ignite().cluster().localNode().id();
--
-                 for (int i = 0; i < RETRIES; i++) {
-                     String item = locId + "_" + Integer.toString(i);
 -                    for (int i = 0; i < RETRIES; i++) {
 -                        String item = locId + "_" + Integer.toString(i);
--
-                     queue.put(item);
 -                        queue.put(item);
--
-                     System.out.println("Queue item has been added: " + item);
 -                        System.out.println("Queue item has been added: " + 
item);
 -                    }
--                }
-             }
-             else {
-                 // Take items from queue head.
-                 for (int i = 0; i < RETRIES; i++)
-                     System.out.println("Queue item has been read from queue 
head: " + queue.take());
 -                else {
 -                    // Take items from queue head.
 -                    for (int i = 0; i < RETRIES; i++)
 -                        System.out.println("Queue item has been read from 
queue head: " + queue.take());
--
-                 // Take items from queue head once again.
-                 for (int i = 0; i < RETRIES; i++)
-                     System.out.println("Queue item has been read from queue 
head: " + queue.poll());
 -                    // Take items from queue head once again.
 -                    for (int i = 0; i < RETRIES; i++)
 -                        System.out.println("Queue item has been read from 
queue head: " + queue.poll());
 -                }
 -            }
 -            catch (IgniteCheckedException e) {
 -                throw new RuntimeException(e);
--            }
--        }
--    }
--}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheSetExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheSetExample.java
index a961f30,6de65c9..0000000
deleted file mode 100644,100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheSetExample.java
+++ /dev/null
@@@ -1,187 -1,193 +1,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.datastructures;
--
--import org.apache.ignite.*;
- import org.apache.ignite.configuration.*;
 -import org.apache.ignite.cache.datastructures.*;
--import org.apache.ignite.examples.datagrid.*;
--import org.apache.ignite.lang.*;
--
--import java.util.*;
--
--/**
-  * Grid cache distributed set example.
 - * Ignite cache distributed set example.
-- * <p>
-- * Remote nodes should always be started with special configuration file which
-- * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
-- * <p>
-- * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
-  * start GridGain node with {@code examples/config/example-cache.xml} 
configuration.
 - * start node with {@code examples/config/example-cache.xml} configuration.
-- */
--public class CacheSetExample {
--    /** Cache name. */
--    private static final String CACHE_NAME = "partitioned_tx";
--
--    /** Set instance. */
-     private static IgniteSet<String> set;
 -    private static CacheSet<String> set;
--
--    /**
--     * Executes example.
--     *
--     * @param args Command line arguments, none required.
-      * @throws Exception If example execution failed.
 -     * @throws IgniteCheckedException If example execution failed.
--     */
-     public static void main(String[] args) throws Exception {
-         try (Ignite g = Ignition.start("examples/config/example-cache.xml")) {
 -    public static void main(String[] args) throws IgniteCheckedException {
 -        try (Ignite ignite = 
Ignition.start("examples/config/example-cache.xml")) {
--            System.out.println();
--            System.out.println(">>> Cache set example started.");
--
--            // Make set name.
--            String setName = UUID.randomUUID().toString();
--
-             set = initializeSet(g, setName);
 -            set = initializeSet(ignite, setName);
--
-             writeToSet(g);
 -            writeToSet(ignite);
--
-             clearAndRemoveSet(g);
 -            clearAndRemoveSet(ignite);
--        }
--
--        System.out.println("Cache set example finished.");
--    }
--
--    /**
--     * Initialize set.
--     *
-      * @param g Grid.
 -     * @param ignite Ignite.
--     * @param setName Name of set.
--     * @return Set.
--     * @throws IgniteException If execution failed.
--     */
-     private static IgniteSet<String> initializeSet(Ignite g, String setName) 
throws IgniteException {
-         IgniteCollectionConfiguration setCfg = new 
IgniteCollectionConfiguration();
- 
-         setCfg.setCacheName(CACHE_NAME);
- 
 -    private static CacheSet<String> initializeSet(Ignite ignite, String 
setName) throws IgniteCheckedException {
--        // Initialize new set.
-         IgniteSet<String> set = g.set(setName, setCfg, true);
 -        CacheSet<String> set = 
ignite.cache(CACHE_NAME).dataStructures().set(setName, false, true);
--
--        // Initialize set items.
--        for (int i = 0; i < 10; i++)
--            set.add(Integer.toString(i));
--
--        System.out.println("Set size after initializing: " + set.size());
--
--        return set;
--    }
--
--    /**
--     * Write items into set.
--     *
-      * @param g Grid.
 -     * @param ignite Ignite.
--     * @throws IgniteException If failed.
--     */
-     private static void writeToSet(Ignite g) throws IgniteException {
 -    private static void writeToSet(Ignite ignite) throws IgniteException {
--        final String setName = set.name();
--
--        // Write set items on each node.
-         g.compute().broadcast(new SetClosure(setName));
 -        ignite.compute().broadcast(new SetClosure(CACHE_NAME, setName));
--
-         System.out.println("Set size after writing [expected=" + (10 + 
g.cluster().nodes().size() * 5) +
 -        System.out.println("Set size after writing [expected=" + (10 + 
ignite.cluster().nodes().size() * 5) +
--            ", actual=" + set.size() + ']');
--
--        System.out.println("Iterate over set.");
--
--        // Iterate over set.
--        for (String item : set)
--            System.out.println("Set item: " + item);
--
--        // Set API usage examples.
--        if (!set.contains("0"))
--            throw new RuntimeException("Set should contain '0' among its 
elements.");
--
--        if (set.add("0"))
--            throw new RuntimeException("Set should not allow duplicates.");
--
--        if (!set.remove("0"))
--            throw new RuntimeException("Set should correctly remove 
elements.");
--
--        if (set.contains("0"))
--            throw new RuntimeException("Set should not contain '0' among its 
elements.");
--
--        if (!set.add("0"))
--            throw new RuntimeException("Set should correctly add new 
elements.");
--    }
--
--    /**
--     * Clear and remove set.
--     *
-      * @param g Grid.
-      * @throws IgniteException If execution failed.
 -     * @param ignite Ignite.
 -     * @throws IgniteCheckedException If execution failed.
--     */
-     private static void clearAndRemoveSet(Ignite g) throws IgniteException {
 -    private static void clearAndRemoveSet(Ignite ignite) throws 
IgniteCheckedException {
--        System.out.println("Set size before clearing: " + set.size());
--
--        // Clear set.
--        set.clear();
--
--        System.out.println("Set size after clearing: " + set.size());
--
-         // Remove set.
-         set.close();
 -        // Remove set from cache.
 -        ignite.cache(CACHE_NAME).dataStructures().removeSet(set.name());
--
--        System.out.println("Set was removed: " + set.removed());
--
--        // Try to work with removed set.
--        try {
--            set.contains("1");
--        }
--        catch (IgniteException expected) {
--            System.out.println("Expected exception - " + 
expected.getMessage());
--        }
--    }
--
--    /**
--     * Closure to populate the set.
--     */
--    private static class SetClosure implements IgniteRunnable {
 -        /** Cache name. */
 -        private final String cacheName;
 -
--        /** Set name. */
--        private final String setName;
--
--        /**
 -         * @param cacheName Cache name.
--         * @param setName Set name.
--         */
-         SetClosure(String setName) {
 -        SetClosure(String cacheName, String setName) {
 -            this.cacheName = cacheName;
--            this.setName = setName;
--        }
--
--        /** {@inheritDoc} */
--        @Override public void run() {
-             IgniteSet<String> set = Ignition.ignite().set(setName, null, 
false);
 -            try {
 -                CacheSet<String> set = 
Ignition.ignite().cache(cacheName).dataStructures().set(setName, false, true);
--
-             UUID locId = Ignition.ignite().cluster().localNode().id();
 -                UUID locId = Ignition.ignite().cluster().localNode().id();
--
-             for (int i = 0; i < 5; i++) {
-                 String item = locId + "_" + Integer.toString(i);
 -                for (int i = 0; i < 5; i++) {
 -                    String item = locId + "_" + Integer.toString(i);
--
-                 set.add(item);
 -                    set.add(item);
--
-                 System.out.println("Set item has been added: " + item);
 -                    System.out.println("Set item has been added: " + item);
 -                }
 -            }
 -            catch (IgniteCheckedException e) {
 -                throw new RuntimeException(e);
--            }
--        }
--    }
--}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicLongExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicLongExample.java
index 0000000,0000000..969de3e
new file mode 100644
--- /dev/null
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicLongExample.java
@@@ -1,0 -1,0 +1,74 @@@
++/*
++ * 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.datastructures;
++
++import org.apache.ignite.*;
++import org.apache.ignite.examples.datagrid.*;
++import org.apache.ignite.lang.*;
++
++import java.util.*;
++
++/**
++ * Demonstrates a simple usage of distributed atomic long.
++ * <p>
++ * Remote nodes should always be started with special configuration file which
++ * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
++ * <p>
++ * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
++ * start node with {@code examples/config/example-cache.xml} configuration.
++ */
++public final class IgniteAtomicLongExample {
++    /** Number of retries */
++    private static final int RETRIES = 20;
++
++    /**
++     * 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-cache.xml")) {
++            System.out.println();
++            System.out.println(">>> Atomic long example started.");
++
++            // Make name for atomic long (by which it will be known in the 
cluster).
++            String atomicName = UUID.randomUUID().toString();
++
++            // Initialize atomic long.
++            final IgniteAtomicLong atomicLong = ignite.atomicLong(atomicName, 
0, true);
++
++            System.out.println();
++            System.out.println("Atomic long initial value : " + 
atomicLong.get() + '.');
++
++            // Try increment atomic long from all grid nodes.
++            // Note that this node is also part of the grid.
++            ignite.compute().broadcast(new IgniteCallable<Object>() {
++                @Override public Object call() {
++                    for (int i = 0; i < RETRIES; i++)
++                        System.out.println("AtomicLong value has been 
incremented: " + atomicLong.incrementAndGet());
++
++                    return null;
++                }
++            });
++
++            System.out.println();
++            System.out.println("Atomic long value after successful CAS: " + 
atomicLong.get());
++        }
++    }
++}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicReferenceExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicReferenceExample.java
index 0000000,0000000..cfd9873
new file mode 100644
--- /dev/null
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicReferenceExample.java
@@@ -1,0 -1,0 +1,110 @@@
++/*
++ * 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.datastructures;
++
++import org.apache.ignite.*;
++import org.apache.ignite.examples.datagrid.*;
++import org.apache.ignite.lang.*;
++
++import java.util.*;
++
++/**
++ * Demonstrates a simple usage of distributed atomic reference.
++ * <p>
++ * Remote nodes should always be started with special configuration file which
++ * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
++ * <p>
++ * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
++ * start node with {@code examples/config/example-cache.xml} configuration.
++ */
++public final class IgniteAtomicReferenceExample {
++    /**
++     * 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-cache.xml")) {
++            System.out.println();
++            System.out.println(">>> Atomic reference example started.");
++
++            // Make name of atomic reference.
++            final String refName = UUID.randomUUID().toString();
++
++            // Make value of atomic reference.
++            String val = UUID.randomUUID().toString();
++
++            // Initialize atomic reference.
++            IgniteAtomicReference<String> ref = 
ignite.atomicReference(refName, val, true);
++
++            System.out.println("Atomic reference initial value : " + 
ref.get() + '.');
++
++            // Make closure for checking atomic reference value on grid.
++            Runnable c = new ReferenceClosure(refName);
++
++            // Check atomic reference on all cluster nodes.
++            ignite.compute().run(c);
++
++            // Make new value of atomic reference.
++            String newVal = UUID.randomUUID().toString();
++
++            System.out.println("Try to change value of atomic reference with 
wrong expected value.");
++
++            ref.compareAndSet("WRONG EXPECTED VALUE", newVal); // Won't 
change.
++
++            // Check atomic reference on all cluster nodes.
++            // Atomic reference value shouldn't be changed.
++            ignite.compute().run(c);
++
++            System.out.println("Try to change value of atomic reference with 
correct expected value.");
++
++            ref.compareAndSet(val, newVal);
++
++            // Check atomic reference on all cluster nodes.
++            // Atomic reference value should be changed.
++            ignite.compute().run(c);
++        }
++
++        System.out.println();
++        System.out.println("Finished atomic reference example...");
++        System.out.println("Check all nodes for output (this node is also 
part of the cluster).");
++    }
++
++    /**
++     * Obtains atomic reference.
++     */
++    private static class ReferenceClosure implements IgniteRunnable {
++        /** Reference name. */
++        private final String refName;
++
++        /**
++         * @param refName Reference name.
++         */
++        ReferenceClosure(String refName) {
++            this.refName = refName;
++        }
++
++        /** {@inheritDoc} */
++        @Override public void run() {
++            IgniteAtomicReference<String> ref = 
Ignition.ignite().atomicReference(refName, null, true);
++
++            System.out.println("Atomic reference value is " + ref.get() + 
'.');
++        }
++    }
++}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicSequenceExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicSequenceExample.java
index 0000000,0000000..9172733
new file mode 100644
--- /dev/null
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicSequenceExample.java
@@@ -1,0 -1,0 +1,96 @@@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one or more
++ * contributor license agreements.  See the NOTICE file distributed with
++ * this work for additional information regarding copyright ownership.
++ * The ASF licenses this file to You under the Apache License, Version 2.0
++ * (the "License"); you may not use this file except in compliance with
++ * the License.  You may obtain a copy of the License at
++ *
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.apache.ignite.examples.datagrid.datastructures;
++
++import org.apache.ignite.*;
++import org.apache.ignite.examples.datagrid.*;
++import org.apache.ignite.lang.*;
++
++import java.util.*;
++
++/**
++ * Demonstrates a simple usage of distributed atomic sequence.
++ * <p>
++ * Remote nodes should always be started with special configuration file which
++ * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
++ * <p>
++ * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
++ * start node with {@code examples/config/example-cache.xml} configuration.
++ */
++public final class IgniteAtomicSequenceExample {
++    /** Number of retries */
++    private static final int RETRIES = 20;
++
++    /**
++     * 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-cache.xml")) {
++            System.out.println();
++            System.out.println(">>> Cache atomic sequence example started.");
++
++            // Make name of sequence.
++            final String seqName = UUID.randomUUID().toString();
++
++            // Initialize atomic sequence.
++            IgniteAtomicSequence seq = ignite.atomicSequence(seqName, 0, 
true);
++
++            // First value of atomic sequence on this node.
++            long firstVal = seq.get();
++
++            System.out.println("Sequence initial value: " + firstVal);
++
++            // Try increment atomic sequence on all grid nodes. Note that 
this node is also part of the grid.
++            ignite.compute().run(new SequenceClosure(seqName));
++
++            System.out.println("Sequence after incrementing [expected=" + 
(firstVal + RETRIES) + ", actual=" +
++                seq.get() + ']');
++        }
++
++        System.out.println();
++        System.out.println("Finished atomic sequence example...");
++        System.out.println("Check all nodes for output (this node is also 
part of the cluster).");
++    }
++
++    /**
++     * Obtains atomic sequence.
++     */
++    private static class SequenceClosure implements IgniteRunnable {
++        /** Sequence name. */
++        private final String seqName;
++
++        /**
++         * @param seqName Sequence name.
++         */
++        SequenceClosure(String seqName) {
++            this.seqName = seqName;
++        }
++
++        /** {@inheritDoc} */
++        @Override public void run() {
++            IgniteAtomicSequence seq = 
Ignition.ignite().atomicSequence(seqName, 0, true);
++
++            for (int i = 0; i < RETRIES; i++)
++                System.out.println("Sequence [currentValue=" + seq.get() + ", 
afterIncrement=" +
++                    seq.incrementAndGet() + ']');
++        }
++    }
++}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicStampedExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicStampedExample.java
index 0000000,0000000..ea083e1
new file mode 100644
--- /dev/null
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteAtomicStampedExample.java
@@@ -1,0 -1,0 +1,117 @@@
++/*
++ * 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.datastructures;
++
++import org.apache.ignite.*;
++import org.apache.ignite.examples.datagrid.*;
++import org.apache.ignite.lang.*;
++
++import java.util.*;
++
++/**
++ * Demonstrates a simple usage of distributed atomic stamped.
++ * <p>
++ * Remote nodes should always be started with special configuration file which
++ * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
++ * <p>
++ * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
++ * start node with {@code examples/config/example-cache.xml} configuration.
++ */
++public final class IgniteAtomicStampedExample {
++    /**
++     * 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-cache.xml")) {
++            System.out.println();
++            System.out.println(">>> Atomic stamped example started.");
++
++            // Make name of atomic stamped.
++            String stampedName = UUID.randomUUID().toString();
++
++            // Make value of atomic stamped.
++            String val = UUID.randomUUID().toString();
++
++            // Make stamp of atomic stamped.
++            String stamp = UUID.randomUUID().toString();
++
++            // Initialize atomic stamped in cache.
++            IgniteAtomicStamped<String, String> stamped = 
ignite.atomicStamped(stampedName, val, stamp, true);
++
++            System.out.println("Atomic stamped initial [value=" + 
stamped.value() + ", stamp=" + stamped.stamp() + ']');
++
++            // Make closure for checking atomic stamped on grid.
++            Runnable c = new StampedUpdateClosure(stampedName);
++
++            // Check atomic stamped on all cluster nodes.
++            ignite.compute().run(c);
++
++            // Make new value of atomic stamped.
++            String newVal = UUID.randomUUID().toString();
++
++            // Make new stamp of atomic stamped.
++            String newStamp = UUID.randomUUID().toString();
++
++            System.out.println("Try to change value and stamp of atomic 
stamped with wrong expected value and stamp.");
++
++            stamped.compareAndSet("WRONG EXPECTED VALUE", newVal, "WRONG 
EXPECTED STAMP", newStamp);
++
++            // Check atomic stamped on all cluster nodes.
++            // Atomic stamped value and stamp shouldn't be changed.
++            ignite.compute().run(c);
++
++            System.out.println("Try to change value and stamp of atomic 
stamped with correct value and stamp.");
++
++            stamped.compareAndSet(val, newVal, stamp, newStamp);
++
++            // Check atomic stamped on all cluster nodes.
++            // Atomic stamped value and stamp should be changed.
++            ignite.compute().run(c);
++        }
++
++        System.out.println();
++        System.out.println("Finished atomic stamped example...");
++        System.out.println("Check all nodes for output (this node is also 
part of the cluster).");
++    }
++
++    /**
++     * Performs update of on an atomic stamped variable in cache.
++     */
++    private static class StampedUpdateClosure implements IgniteRunnable {
++        /** Atomic stamped variable name. */
++        private final String stampedName;
++
++        /**
++         * @param stampedName Atomic stamped variable name.
++         */
++        StampedUpdateClosure(String stampedName) {
++            this.stampedName = stampedName;
++        }
++
++        /** {@inheritDoc} */
++        @Override public void run() {
++            IgniteAtomicStamped<String, String> stamped = Ignition.ignite().
++                atomicStamped(stampedName, null, null, true);
++
++            System.out.println("Atomic stamped [value=" + stamped.value() + 
", stamp=" + stamped.stamp() + ']');
++        }
++    }
++}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ce325948/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteCountDownLatchExample.java
----------------------------------------------------------------------
diff --cc 
examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteCountDownLatchExample.java
index 0000000,0000000..f7a282c
new file mode 100644
--- /dev/null
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/IgniteCountDownLatchExample.java
@@@ -1,0 -1,0 +1,96 @@@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one or more
++ * contributor license agreements.  See the NOTICE file distributed with
++ * this work for additional information regarding copyright ownership.
++ * The ASF licenses this file to You under the Apache License, Version 2.0
++ * (the "License"); you may not use this file except in compliance with
++ * the License.  You may obtain a copy of the License at
++ *
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.apache.ignite.examples.datagrid.datastructures;
++
++import org.apache.ignite.*;
++import org.apache.ignite.examples.datagrid.*;
++import org.apache.ignite.lang.*;
++
++import java.util.*;
++
++/**
++ * Demonstrates a simple usage of distributed count down latch.
++ * <p>
++ * Remote nodes should always be started with special configuration file which
++ * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-cache.xml'}.
++ * <p>
++ * Alternatively you can run {@link CacheNodeStartup} in another JVM which 
will
++ * start node with {@code examples/config/example-cache.xml} configuration.
++ */
++public class IgniteCountDownLatchExample {
++    /** Number of latch initial count */
++    private static final int INITIAL_COUNT = 10;
++
++    /**
++     * Executes example.
++     *
++     * @param args Command line arguments, none required.
++     * @throws IgniteCheckedException If example execution failed.
++     */
++    public static void main(String[] args) throws IgniteCheckedException {
++        try (Ignite ignite = 
Ignition.start("examples/config/example-cache.xml")) {
++            System.out.println();
++            System.out.println(">>> Cache atomic countdown latch example 
started.");
++
++            // Make name of count down latch.
++            final String latchName = UUID.randomUUID().toString();
++
++            // Initialize count down latch.
++            IgniteCountDownLatch latch = ignite.countDownLatch(latchName, 
INITIAL_COUNT, false, true);
++
++            System.out.println("Latch initial value: " + latch.count());
++
++            // Start waiting on the latch on all cluster nodes.
++            for (int i = 0; i < INITIAL_COUNT; i++)
++                ignite.compute().run(new LatchClosure(latchName));
++
++            // Wait for latch to go down which essentially means that all 
remote closures completed.
++            latch.await();
++
++            System.out.println("All latch closures have completed.");
++        }
++
++        System.out.println();
++        System.out.println("Finished count down latch example...");
++        System.out.println("Check all nodes for output (this node is also 
part of the cluster).");
++    }
++
++    /**
++     * Closure which simply waits on the latch on all nodes.
++     */
++    private static class LatchClosure implements IgniteRunnable {
++        /** Latch name. */
++        private final String latchName;
++
++        /**
++         * @param latchName Latch name.
++         */
++        LatchClosure(String latchName) {
++            this.latchName = latchName;
++        }
++
++        /** {@inheritDoc} */
++        @Override public void run() {
++            IgniteCountDownLatch latch = 
Ignition.ignite().countDownLatch(latchName, 1, false, true);
++
++            int newCnt = latch.countDown();
++
++            System.out.println("Counted down [newCnt=" + newCnt + ", nodeId=" 
+ Ignition.ignite().cluster().localNode().id() + ']');
++        }
++    }
++}

Reply via email to