Repository: incubator-ignite Updated Branches: refs/heads/sprint-2 b3a53842b -> 0dda33a30
sprint-2: minor Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0dda33a3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0dda33a3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0dda33a3 Branch: refs/heads/sprint-2 Commit: 0dda33a309e5928362a4a165d39cb51979b06a0e Parents: b3a5384 Author: Yakov Zhdanov <yzhda...@gridgain.com> Authored: Tue Feb 17 15:14:56 2015 +0300 Committer: Yakov Zhdanov <yzhda...@gridgain.com> Committed: Tue Feb 17 15:14:56 2015 +0300 ---------------------------------------------------------------------- .../datastructures/IgniteAtomicSequenceExample.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0dda33a3/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteAtomicSequenceExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteAtomicSequenceExample.java b/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteAtomicSequenceExample.java index c65e2cd..f83a819 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteAtomicSequenceExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datastructures/IgniteAtomicSequenceExample.java @@ -21,8 +21,6 @@ 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> @@ -47,18 +45,13 @@ public final class IgniteAtomicSequenceExample { 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); - // Try increment atomic sequence on all cluster nodes. Note that this node is also part of the cluster. - ignite.compute().broadcast(new SequenceClosure(seqName)); + ignite.compute().broadcast(new SequenceClosure("example-sequence")); 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)."); + System.out.println(); } } @@ -78,6 +71,8 @@ public final class IgniteAtomicSequenceExample { /** {@inheritDoc} */ @Override public void run() { + // Create sequence. Only one concurrent call will succeed in creation. + // Rest of the callers will get already created instance. IgniteAtomicSequence seq = Ignition.ignite().atomicSequence(seqName, 0, true); // First value of atomic sequence on this node.