Repository: incubator-ignite Updated Branches: refs/heads/sprint-2 7e19e2e82 -> 3bf90ab18
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/69e2a7d9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/69e2a7d9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/69e2a7d9 Branch: refs/heads/sprint-2 Commit: 69e2a7d97d6c04a1244cdbfbd0b3855ee6216759 Parents: a4101a5 Author: Yakov Zhdanov <yzhda...@gridgain.com> Authored: Tue Feb 17 15:09:29 2015 +0300 Committer: Yakov Zhdanov <yzhda...@gridgain.com> Committed: Tue Feb 17 15:09:29 2015 +0300 ---------------------------------------------------------------------- .../IgniteAtomicSequenceExample.java | 23 ++++++++++---------- 1 file changed, 12 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/69e2a7d9/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 ac2aec5..ad6ecdd 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 @@ -53,21 +53,13 @@ public final class IgniteAtomicSequenceExample { // 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 cluster nodes. Note that this node is also part of the cluster. ignite.compute().broadcast(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)."); } - - 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)."); } /** @@ -88,9 +80,18 @@ public final class IgniteAtomicSequenceExample { @Override public void run() { IgniteAtomicSequence seq = Ignition.ignite().atomicSequence(seqName, 0, true); + // First value of atomic sequence on this node. + long firstVal = seq.get(); + + System.out.println("Sequence initial value on local node: " + firstVal); + for (int i = 0; i < RETRIES; i++) System.out.println("Sequence [currentValue=" + seq.get() + ", afterIncrement=" + seq.incrementAndGet() + ']'); + + + System.out.println("Sequence after incrementing [expected=" + (firstVal + RETRIES) + ", actual=" + + seq.get() + ']'); } } }