# ignite-106 review
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cb4a2f59 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cb4a2f59 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cb4a2f59 Branch: refs/heads/ignite-6 Commit: cb4a2f59de9e1e7de21f86d3ca89d7d412a6b23d Parents: 0f7b123 Author: sboikov <sboi...@gridgain.com> Authored: Tue Feb 3 13:57:44 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Tue Feb 3 13:57:44 2015 +0300 ---------------------------------------------------------------------- examples/config/filesystem/example-ggfs.xml | 2 +- .../examples/compute/ComputeBroadcastExample.java | 8 ++++---- .../examples/compute/ComputeCallableExample.java | 6 +++--- .../ignite/examples/compute/ComputeClosureExample.java | 6 +++--- .../compute/ComputeContinuousMapperExample.java | 4 ++-- .../compute/ComputeExecutorServiceExample.java | 4 ++-- .../examples/compute/ComputeProjectionExample.java | 10 +++++----- .../ignite/examples/compute/ComputeReducerExample.java | 2 +- .../examples/compute/ComputeRunnableExample.java | 3 +-- .../ignite/examples/compute/ComputeTaskMapExample.java | 2 +- .../examples/compute/ComputeTaskSplitExample.java | 2 +- .../compute/failover/ComputeFailoverExample.java | 5 ++--- .../examples/compute/montecarlo/CreditRiskManager.java | 10 ---------- .../ignite/examples/datagrid/CacheAffinityExample.java | 4 +--- .../ignite/examples/datagrid/CacheApiExample.java | 2 -- .../ignite/examples/datagrid/CacheEventsExample.java | 1 - .../examples/datagrid/CachePopularNumbersExample.java | 6 +++--- .../examples/datagrid/CacheTransactionExample.java | 13 +++++-------- .../datastructures/CacheAtomicLongExample.java | 3 +-- .../datastructures/CacheAtomicReferenceExample.java | 2 +- .../examples/datagrid/store/CacheStoreExample.java | 4 +++- .../datagrid/store/CacheStoreLoadDataExample.java | 3 +-- .../datagrid/store/dummy/CacheDummyPersonStore.java | 2 +- .../apache/ignite/examples/events/EventsExample.java | 4 ++-- .../org/apache/ignite/examples/ggfs/GgfsExample.java | 4 ++-- .../apache/ignite/examples/ggfs/GgfsNodeStartup.java | 4 ++-- .../examples/messaging/MessagingPingPongExample.java | 4 ++-- .../examples/misc/deployment/DeploymentExample.java | 4 ++-- .../examples/misc/lifecycle/LifecycleExample.java | 4 ++-- .../examples/streaming/StreamingPriceBarsExample.java | 4 ++-- .../org/apache/ignite/examples/ComputeExample.java | 2 +- .../org/apache/ignite/examples/MessagingExample.java | 6 +++--- .../examples/ScalarCachePopularNumbersExample.scala | 6 +++--- .../ignite/examples/ProjectionExampleSelfTest.java | 2 +- 34 files changed, 64 insertions(+), 84 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/config/filesystem/example-ggfs.xml ---------------------------------------------------------------------- diff --git a/examples/config/filesystem/example-ggfs.xml b/examples/config/filesystem/example-ggfs.xml index eb15969..08f18a1 100644 --- a/examples/config/filesystem/example-ggfs.xml +++ b/examples/config/filesystem/example-ggfs.xml @@ -53,7 +53,7 @@ Configuration below demonstrates how to setup a GGFS node with file data. --> <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> - <!-- Set to true to enable ignite-aware class loading for examples, default is false. --> + <!-- Set to true to enable cluster-aware class loading for examples, default is false. --> <property name="peerClassLoadingEnabled" value="true"/> <property name="marshaller"> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeBroadcastExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeBroadcastExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeBroadcastExample.java index beb322e..397f8cd 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeBroadcastExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeBroadcastExample.java @@ -57,9 +57,9 @@ public class ComputeBroadcastExample { * Print 'Hello' message on all nodes. * * @param ignite Ignite instance. - * @throws IgniteCheckedException If failed. + * @throws IgniteException If failed. */ - private static void hello(Ignite ignite) throws IgniteCheckedException { + private static void hello(Ignite ignite) throws IgniteException { // Print out hello message on all nodes. ignite.compute().broadcast( new IgniteRunnable() { @@ -78,9 +78,9 @@ public class ComputeBroadcastExample { * Gather system info from all nodes and print it out. * * @param ignite Ignite instance. - * @throws IgniteCheckedException if failed. + * @throws IgniteException if failed. */ - private static void gatherSystemInfo(Ignite ignite) throws IgniteCheckedException { + private static void gatherSystemInfo(Ignite ignite) throws IgniteException { // Gather system info from all nodes. Collection<String> res = ignite.compute().broadcast( new IgniteCallable<String>() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeCallableExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeCallableExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeCallableExample.java index ffb2fad..505da45 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeCallableExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeCallableExample.java @@ -41,9 +41,9 @@ public class ComputeCallableExample { * Executes example. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws Exception If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start("examples/config/example-compute.xml")) { System.out.println(); System.out.println(">>> Compute callable example started."); @@ -55,7 +55,7 @@ public class ComputeCallableExample { calls.add(new IgniteCallable<Integer>() { @Override public Integer call() throws Exception { System.out.println(); - System.out.println(">>> Printing '" + word + "' on this node from igntie job."); + System.out.println(">>> Printing '" + word + "' on this node from ignite job."); return word.length(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeClosureExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeClosureExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeClosureExample.java index 26d959e..b2126b9 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeClosureExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeClosureExample.java @@ -40,9 +40,9 @@ public class ComputeClosureExample { * Executes example. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws Exception If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start("examples/config/example-compute.xml")) { System.out.println(); System.out.println(">>> Compute closure example started."); @@ -52,7 +52,7 @@ public class ComputeClosureExample { new IgniteClosure<String, Integer>() { @Override public Integer apply(String word) { System.out.println(); - System.out.println(">>> Printing '" + word + "' on this node from igntie job."); + System.out.println(">>> Printing '" + word + "' on this node from ignite job."); // Return number of letters in the word. return word.length(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeContinuousMapperExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeContinuousMapperExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeContinuousMapperExample.java index b449c9a..3f9704f 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeContinuousMapperExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeContinuousMapperExample.java @@ -33,7 +33,7 @@ import java.util.concurrent.atomic.*; * initial {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} method completes. * <p> * String "Hello Continuous Mapper" is passed as an argument for execution - * of {@link org.apache.ignite.examples.compute.ComputeContinuousMapperExample.ContinuousMapperTask}. As an outcome, participating + * of {@link ContinuousMapperTask}. As an outcome, participating * nodes will print out a single word from the passed in string and return * number of characters in that word. However, to demonstrate continuous * mapping, next word will be mapped to a node only after the result from @@ -136,7 +136,7 @@ public class ComputeContinuousMapperExample { String word = argument(0); System.out.println(); - System.out.println(">>> Printing '" + word + "' from igntie job at time: " + new Date()); + System.out.println(">>> Printing '" + word + "' from ignite job at time: " + new Date()); int cnt = word.length(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeExecutorServiceExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeExecutorServiceExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeExecutorServiceExample.java index 1957eca..a7e180f 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeExecutorServiceExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeExecutorServiceExample.java @@ -24,7 +24,7 @@ import org.apache.ignite.lang.*; import java.util.concurrent.*; /** - * Simple example to demonstrate usage of ignite-enabled executor service provided by Ignite. + * 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-compute.xml'}. @@ -54,7 +54,7 @@ public final class ComputeExecutorServiceExample { exec.submit(new IgniteRunnable() { @Override public void run() { System.out.println(); - System.out.println(">>> Printing '" + word + "' on this node from igntie job."); + System.out.println(">>> Printing '" + word + "' on this node from ignite job."); } }); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeProjectionExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeProjectionExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeProjectionExample.java index 9f54d6d..18cf485 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeProjectionExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeProjectionExample.java @@ -76,16 +76,16 @@ public class ComputeProjectionExample { * Print 'Hello' message on remote nodes. * * @param ignite Ignite. - * @param prj Projection. - * @throws IgniteCheckedException If failed. + * @param grp Cluster group. + * @throws IgniteException If failed. */ - private static void sayHello(Ignite ignite, final ClusterGroup prj) throws IgniteCheckedException { + private static void sayHello(Ignite ignite, final ClusterGroup grp) throws IgniteException { // Print out hello message on all projection nodes. - ignite.compute(prj).broadcast( + ignite.compute(grp).broadcast( new IgniteRunnable() { @Override public void run() { // Print ID of remote node on remote node. - System.out.println(">>> Hello Node: " + prj.ignite().cluster().localNode().id()); + System.out.println(">>> Hello Node: " + grp.ignite().cluster().localNode().id()); } } ); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeReducerExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeReducerExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeReducerExample.java index 19a4034..a77d915 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeReducerExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeReducerExample.java @@ -52,7 +52,7 @@ public class ComputeReducerExample { new IgniteClosure<String, Integer>() { @Override public Integer apply(String word) { System.out.println(); - System.out.println(">>> Printing '" + word + "' on this node from igntie job."); + System.out.println(">>> Printing '" + word + "' on this node from ignite job."); // Return number of letters in the word. return word.length(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeRunnableExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeRunnableExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeRunnableExample.java index b63c603..4af838b 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeRunnableExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeRunnableExample.java @@ -19,7 +19,6 @@ package org.apache.ignite.examples.compute; import org.apache.ignite.*; import org.apache.ignite.examples.*; -import org.apache.ignite.internal.*; import org.apache.ignite.lang.*; import java.util.*; @@ -56,7 +55,7 @@ public class ComputeRunnableExample { compute.run(new IgniteRunnable() { @Override public void run() { System.out.println(); - System.out.println(">>> Printing '" + word + "' on this node from igntie job."); + System.out.println(">>> Printing '" + word + "' on this node from ignite job."); } }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskMapExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskMapExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskMapExample.java index d0ed141..a290c31 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskMapExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskMapExample.java @@ -89,7 +89,7 @@ public class ComputeTaskMapExample { map.put(new ComputeJobAdapter() { @Nullable @Override public Object execute() { System.out.println(); - System.out.println(">>> Printing '" + word + "' on this node from igntie job."); + System.out.println(">>> Printing '" + word + "' on this node from ignite job."); // Return number of letters in the word. return word.length(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskSplitExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskSplitExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskSplitExample.java index 614c4e6..ad76892 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskSplitExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeTaskSplitExample.java @@ -78,7 +78,7 @@ public class ComputeTaskSplitExample { jobs.add(new ComputeJobAdapter() { @Nullable @Override public Object execute() { System.out.println(); - System.out.println(">>> Printing '" + word + "' on this node from igntie job."); + System.out.println(">>> Printing '" + word + "' on this node from ignite job."); // Return number of letters in the word. return word.length(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/failover/ComputeFailoverExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/failover/ComputeFailoverExample.java b/examples/src/main/java/org/apache/ignite/examples/compute/failover/ComputeFailoverExample.java index 2d74856..bd3b18b 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/failover/ComputeFailoverExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/failover/ComputeFailoverExample.java @@ -22,7 +22,6 @@ import org.apache.ignite.compute.*; import org.apache.ignite.examples.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; -import org.apache.ignite.internal.util.lang.*; import java.util.*; @@ -39,9 +38,9 @@ public class ComputeFailoverExample { * Executes example. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws Exception If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start(ComputeFailoverNodeStartup.configuration())) { if (!ExamplesUtils.checkMinTopologySize(ignite.cluster(), 2)) return; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/compute/montecarlo/CreditRiskManager.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/compute/montecarlo/CreditRiskManager.java b/examples/src/main/java/org/apache/ignite/examples/compute/montecarlo/CreditRiskManager.java index b0900f0..b257966 100644 --- a/examples/src/main/java/org/apache/ignite/examples/compute/montecarlo/CreditRiskManager.java +++ b/examples/src/main/java/org/apache/ignite/examples/compute/montecarlo/CreditRiskManager.java @@ -39,16 +39,6 @@ public class CreditRiskManager { /** * Calculates credit risk for a given credit portfolio. This calculation uses * Monte-Carlo Simulation to produce risk value. - * <p> - * Note that this class generally represents a business logic and the entire - * grid enabling occurs in one line of annotation added to this method: - * <pre name="code" class="java"> - * ... - * @Gridify(taskClass = GridCreditRiskGridTask.class) - * ... - * </pre> - * Note also that this annotation could have been added externally via XML - * file leaving this file completely untouched - yet still fully grid enabled. * * @param portfolio Credit portfolio. * @param horizon Forecast horizon (in days). http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java index 8edb950..d917624 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java @@ -18,7 +18,6 @@ package org.apache.ignite.examples.datagrid; import org.apache.ignite.*; -import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.lang.*; @@ -118,8 +117,7 @@ public final class CacheAffinityExample { if (node != null) { // Bring computations to the nodes where the data resides (i.e. collocation). ignite.compute(ignite.cluster().forNode(node)).run(new IgniteRunnable() { - @Override - public void run() { + @Override public void run() { IgniteCache<Integer, String> cache = ignite.jcache(CACHE_NAME); // Peek is a local memory lookup, however, value should never be 'null' http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java index 0666fbb..68c4333 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheApiExample.java @@ -18,8 +18,6 @@ package org.apache.ignite.examples.datagrid; import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.lang.*; import javax.cache.processor.*; import java.util.concurrent.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java index 52e585e..c9d1883 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheEventsExample.java @@ -18,7 +18,6 @@ package org.apache.ignite.examples.datagrid; import org.apache.ignite.*; -import org.apache.ignite.cache.*; import org.apache.ignite.events.*; import org.apache.ignite.lang.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java index e1604f4..32b8535 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java @@ -67,10 +67,10 @@ public class CachePopularNumbersExample { // Clean up caches on all nodes before run. ignite.jcache(CACHE_NAME).clear(); - ClusterGroup prj = ignite.cluster().forCache(CACHE_NAME); + ClusterGroup grp = ignite.cluster().forCache(CACHE_NAME); - if (prj.nodes().isEmpty()) { - System.out.println("Grid does not have cache configured: " + CACHE_NAME); + if (grp.nodes().isEmpty()) { + System.out.println("Ignite does not have cache configured: " + CACHE_NAME); return; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java index 540543d..6df8e50 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheTransactionExample.java @@ -90,9 +90,11 @@ public class CacheTransactionExample { IgniteCache<Integer, Account> cache = Ignition.ignite().jcache(CACHE_NAME); try (IgniteTx tx = Ignition.ignite().transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - assert cache.get(acctId) != null; + Account acct0 = cache.get(acctId); - Account acct = new Account(cache.get(acctId).id, cache.get(acctId).balance); + assert acct0 != null; + + Account acct = new Account(acct0.id, acct0.balance); // Deposit into account. acct.update(amount); @@ -110,7 +112,7 @@ public class CacheTransactionExample { /** * Account. */ - private static class Account implements Serializable, Cloneable { + private static class Account implements Serializable { /** Account ID. */ private int id; @@ -136,11 +138,6 @@ public class CacheTransactionExample { } /** {@inheritDoc} */ - @Override protected Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - /** {@inheritDoc} */ @Override public String toString() { return "Account [id=" + id + ", balance=$" + balance + ']'; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java index 53274da..a2a0b1e 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java @@ -63,8 +63,7 @@ public final class CacheAtomicLongExample { // Try increment atomic long from all cluster nodes. // Note that this node is also part of the cluster. ignite.compute(ignite.cluster().forCache(CACHE_NAME)).call(new IgniteCallable<Object>() { - @Override - public Object call() throws Exception { + @Override public Object call() throws Exception { for (int i = 0; i < RETRIES; i++) System.out.println("AtomicLong value has been incremented: " + atomicLong.incrementAndGet()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java index 8def696..4ce2e7a 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java @@ -63,7 +63,7 @@ public final class CacheAtomicReferenceExample { // Make closure for checking atomic reference value on cluster. Runnable c = new ReferenceClosure(CACHE_NAME, refName); - // Check atomic reference on all clsuter nodes. + // Check atomic reference on all cluster nodes. ignite.compute().run(c); // Make new value of atomic reference. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java index e27f4b8..65c4190 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreExample.java @@ -59,7 +59,9 @@ public class CacheStoreExample { System.out.println("Read value: " + val); - cache.put(id, person(id, "Isaac", "Newton")); + val = cache.getAndPut(id, person(id, "Isaac", "Newton")); + + System.out.println("Overwrote old value: " + val); val = cache.get(id); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java index 0c9b1ef..4ff8691 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheStoreLoadDataExample.java @@ -60,8 +60,7 @@ public class CacheStoreLoadDataExample { // Start loading cache on all caching nodes. ignite.compute(ignite.cluster().forCache(null)).broadcast(new IgniteCallable<Object>() { - @Override - public Object call() throws Exception { + @Override public Object call() throws Exception { // Load cache from persistent store. cache.loadCache(null, 0, ENTRY_COUNT); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java index 6379140..9a3f7e2 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java @@ -32,7 +32,7 @@ import java.util.concurrent.*; * Dummy cache store implementation. */ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> { - /** Auto-inject igntie instance. */ + /** Auto-inject ignite instance. */ @IgniteInstanceResource private Ignite ignite; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/events/EventsExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/events/EventsExample.java b/examples/src/main/java/org/apache/ignite/examples/events/EventsExample.java index 6b5a163..75e2907 100644 --- a/examples/src/main/java/org/apache/ignite/examples/events/EventsExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/events/EventsExample.java @@ -97,9 +97,9 @@ public class EventsExample { /** * Listen to events coming from all cluster nodes. * - * @throws IgniteCheckedException If failed. + * @throws IgniteException If failed. */ - private static void remoteListen() throws IgniteCheckedException { + private static void remoteListen() throws IgniteException { System.out.println(); System.out.println(">>> Remote event listener example."); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsExample.java b/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsExample.java index 23c2507..266d1c1 100644 --- a/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsExample.java @@ -105,9 +105,9 @@ public final class GgfsExample { * * @param fs GGFS. * @param path File or directory path. - * @throws IgniteCheckedException In case of error. + * @throws IgniteException In case of error. */ - private static void delete(IgniteFs fs, IgniteFsPath path) throws IgniteCheckedException { + private static void delete(IgniteFs fs, IgniteFsPath path) throws IgniteException { assert fs != null; assert path != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsNodeStartup.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsNodeStartup.java b/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsNodeStartup.java index 605eb81..66e89a9 100644 --- a/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsNodeStartup.java +++ b/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsNodeStartup.java @@ -33,9 +33,9 @@ public class GgfsNodeStartup { * Start up an empty node with specified cache configuration. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws IgniteException If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws IgniteException { Ignition.start("examples/config/filesystem/example-ggfs.xml"); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingPingPongExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingPingPongExample.java b/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingPingPongExample.java index f333b0b..4324fbc 100644 --- a/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingPingPongExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingPingPongExample.java @@ -43,9 +43,9 @@ public class MessagingPingPongExample { * Executes example. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws Exception If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws Exception { // Game is played over the default ignite. try (Ignite ignite = Ignition.start("examples/config/example-compute.xml")) { if (!ExamplesUtils.checkMinTopologySize(ignite.cluster(), 2)) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/misc/deployment/DeploymentExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/misc/deployment/DeploymentExample.java b/examples/src/main/java/org/apache/ignite/examples/misc/deployment/DeploymentExample.java index f2bc56a..b9084f2 100644 --- a/examples/src/main/java/org/apache/ignite/examples/misc/deployment/DeploymentExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/misc/deployment/DeploymentExample.java @@ -53,9 +53,9 @@ public final class DeploymentExample { * Executes example. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws Exception If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start("examples/config/example-compute.xml")) { System.out.println(); System.out.println(">>> Deployment example started."); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/misc/lifecycle/LifecycleExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/misc/lifecycle/LifecycleExample.java b/examples/src/main/java/org/apache/ignite/examples/misc/lifecycle/LifecycleExample.java index a25937f..cc775f5 100644 --- a/examples/src/main/java/org/apache/ignite/examples/misc/lifecycle/LifecycleExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/misc/lifecycle/LifecycleExample.java @@ -73,8 +73,8 @@ public final class LifecycleExample { /** {@inheritDoc} */ @Override public void onLifecycleEvent(LifecycleEventType evt) { System.out.println(); - System.out.println(">>> Grid lifecycle event occurred: " + evt); - System.out.println(">>> Grid name: " + ignite.name()); + System.out.println(">>> Lifecycle event occurred: " + evt); + System.out.println(">>> Ignite name: " + ignite.name()); if (evt == AFTER_GRID_START) isStarted = true; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java/org/apache/ignite/examples/streaming/StreamingPriceBarsExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamingPriceBarsExample.java b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamingPriceBarsExample.java index 35ff57a..a01e5d4 100644 --- a/examples/src/main/java/org/apache/ignite/examples/streaming/StreamingPriceBarsExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/streaming/StreamingPriceBarsExample.java @@ -180,9 +180,9 @@ public class StreamingPriceBarsExample { * Streams random prices into the system. * * @param ignite Ignite. - * @throws IgniteCheckedException If failed. + * @throws IgniteException If failed. */ - private static void streamData(final Ignite ignite) throws IgniteCheckedException { + private static void streamData(final Ignite ignite) throws IgniteException { IgniteStreamer streamer = ignite.streamer("priceBars"); for (int i = 0; i < CNT; i++) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java8/org/apache/ignite/examples/ComputeExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java8/org/apache/ignite/examples/ComputeExample.java b/examples/src/main/java8/org/apache/ignite/examples/ComputeExample.java index 46bafef..82dfdce 100644 --- a/examples/src/main/java8/org/apache/ignite/examples/ComputeExample.java +++ b/examples/src/main/java8/org/apache/ignite/examples/ComputeExample.java @@ -22,7 +22,7 @@ import org.apache.ignite.lang.*; import org.apache.ignite.lang.IgniteCallable; /** - * Demonstrates broadcasting and unicasting computations within cluster projection. + * Demonstrates broadcasting and unicasting 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-compute.xml'}. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/java8/org/apache/ignite/examples/MessagingExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java8/org/apache/ignite/examples/MessagingExample.java b/examples/src/main/java8/org/apache/ignite/examples/MessagingExample.java index dfe0481..edf1190 100644 --- a/examples/src/main/java8/org/apache/ignite/examples/MessagingExample.java +++ b/examples/src/main/java8/org/apache/ignite/examples/MessagingExample.java @@ -140,7 +140,7 @@ public final class MessagingExample { /** * Listen for messages from remote nodes. * - * @param prj Projection. + * @param grp Cluster group. * @param orderedLatch Latch for ordered messages acks. * @param unorderedLatch Latch for unordered messages acks. */ @@ -149,14 +149,14 @@ public final class MessagingExample { final CountDownLatch orderedLatch, final CountDownLatch unorderedLatch ) { - prj.message().localListen(TOPIC.ORDERED, (nodeId, msg) -> { + grp.message().localListen(TOPIC.ORDERED, (nodeId, msg) -> { orderedLatch.countDown(); // Return true to continue listening, false to stop. return orderedLatch.getCount() > 0; }); - prj.message().localListen(TOPIC.UNORDERED, (nodeId, msg) -> { + grp.message().localListen(TOPIC.UNORDERED, (nodeId, msg) -> { unorderedLatch.countDown(); // Return true to continue listening, false to stop. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala ---------------------------------------------------------------------- diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala index ad6c671..04658bd 100644 --- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala +++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala @@ -58,10 +58,10 @@ object ScalarCachePopularNumbersExample extends App { println() println(">>> Cache popular numbers example started.") - val prj = ignite.cluster().forCache(CACHE_NAME) + val grp = ignite.cluster().forCache(CACHE_NAME) - if (prj.nodes().isEmpty) - println("Grid does not have cache configured: " + CACHE_NAME); + if (grp.nodes().isEmpty) + println("Ignite does not have cache configured: " + CACHE_NAME); else { val popularNumbersQryTimer = new Timer("numbers-query-worker") http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4a2f59/examples/src/test/java/org/apache/ignite/examples/ProjectionExampleSelfTest.java ---------------------------------------------------------------------- diff --git a/examples/src/test/java/org/apache/ignite/examples/ProjectionExampleSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/ProjectionExampleSelfTest.java index cddc750..45f4fbf 100644 --- a/examples/src/test/java/org/apache/ignite/examples/ProjectionExampleSelfTest.java +++ b/examples/src/test/java/org/apache/ignite/examples/ProjectionExampleSelfTest.java @@ -26,7 +26,7 @@ import org.apache.ignite.testframework.junits.common.*; public class ProjectionExampleSelfTest extends GridAbstractExamplesTest { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - // Start up a cluster node. + // Start up a node. startGrid("grid-projection-example", DFLT_CFG); }