ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [18/43] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/sprint-1' into ignite-106
Date Wed, 04 Feb 2015 09:36:04 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/compute/ComputeContinuousMapperExample.java
----------------------------------------------------------------------
diff --cc examples/src/main/java/org/apache/ignite/examples/compute/ComputeContinuousMapperExample.java
index dbbd41b,5878ca0..b449c9a
--- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeContinuousMapperExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeContinuousMapperExample.java
@@@ -87,10 -87,9 +87,9 @@@ public class ComputeContinuousMapperExa
          private final AtomicInteger totalChrCnt = new AtomicInteger(0);
  
          /** {@inheritDoc} */
-         @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode>
nodes, String phrase)
-             throws IgniteCheckedException {
 -        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode>
grid, String phrase) {
++        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode>
nodes, String phrase) {
              if (phrase == null || phrase.isEmpty())
-                 throw new IgniteCheckedException("Phrase is empty.");
+                 throw new IgniteException("Phrase is empty.");
  
              // Populate word queue.
              Collections.addAll(words, phrase.split(" "));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/compute/ComputeFibonacciContinuationExample.java
----------------------------------------------------------------------
diff --cc examples/src/main/java/org/apache/ignite/examples/compute/ComputeFibonacciContinuationExample.java
index c58ff82,718bd57..024f565
--- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeFibonacciContinuationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeFibonacciContinuationExample.java
@@@ -112,78 -112,73 +112,73 @@@ public final class ComputeFibonacciCont
  
          /** {@inheritDoc} */
          @Nullable @Override public BigInteger apply(Long n) {
-             try {
-                 if (fut1 == null || fut2 == null) {
-                     System.out.println();
-                     System.out.println(">>> Starting fibonacci execution for number:
" + n);
- 
-                     // Make sure n is not negative.
-                     n = Math.abs(n);
- 
-                     if (n <= 2)
-                         return n == 0 ? BigInteger.ZERO : BigInteger.ONE;
- 
-                     // Node-local storage.
-                     ClusterNodeLocalMap<Long, IgniteInternalFuture<BigInteger>>
locMap = ignite.cluster().nodeLocalMap();
- 
-                     // Check if value is cached in node-local-map first.
-                     fut1 = locMap.get(n - 1);
-                     fut2 = locMap.get(n - 2);
- 
-                     ClusterGroup p = ignite.cluster().forPredicate(nodeFilter);
- 
-                     IgniteCompute compute = ignite.compute(p).withAsync();
- 
-                     // If future is not cached in node-local-map, cache it.
-                     if (fut1 == null) {
-                         compute.apply(new FibonacciClosure(nodeFilter), n - 1);
- 
-                         fut1 = locMap.addIfAbsent(n - 1, compute.<BigInteger>future());
-                     }
- 
-                     // If future is not cached in node-local-map, cache it.
-                     if (fut2 == null) {
-                         compute.apply(new FibonacciClosure(nodeFilter), n - 2);
- 
-                         fut2 = locMap.addIfAbsent(n - 2, compute.<BigInteger>future());
-                     }
- 
-                     // If futures are not done, then wait asynchronously for the result
-                     if (!fut1.isDone() || !fut2.isDone()) {
-                         IgniteInClosure<IgniteInternalFuture<BigInteger>> lsnr
= new IgniteInClosure<IgniteInternalFuture<BigInteger>>() {
-                             @Override public void apply(IgniteInternalFuture<BigInteger>
f) {
-                                 // If both futures are done, resume the continuation.
-                                 if (fut1.isDone() && fut2.isDone())
-                                     // CONTINUATION:
-                                     // =============
-                                     // Resume suspended job execution.
-                                     jobCtx.callcc();
-                             }
-                         };
- 
-                         // CONTINUATION:
-                         // =============
-                         // Hold (suspend) job execution.
-                         // It will be resumed in listener above via 'callcc()' call
-                         // once both futures are done.
-                         jobCtx.holdcc();
- 
-                         // Attach the same listener to both futures.
-                         fut1.listenAsync(lsnr);
-                         fut2.listenAsync(lsnr);
- 
-                         return null;
-                     }
+             if (fut1 == null || fut2 == null) {
+                 System.out.println();
+                 System.out.println(">>> Starting fibonacci execution for number:
" + n);
+ 
+                 // Make sure n is not negative.
+                 n = Math.abs(n);
+ 
+                 if (n <= 2)
+                     return n == 0 ? BigInteger.ZERO : BigInteger.ONE;
+ 
+                 // Node-local storage.
 -                ClusterNodeLocalMap<Long, IgniteFuture<BigInteger>> locMap =
g.cluster().nodeLocalMap();
++                ClusterNodeLocalMap<Long, IgniteFuture<BigInteger>> locMap =
ignite.cluster().nodeLocalMap();
+ 
+                 // Check if value is cached in node-local-map first.
+                 fut1 = locMap.get(n - 1);
+                 fut2 = locMap.get(n - 2);
+ 
 -                ClusterGroup p = g.cluster().forPredicate(nodeFilter);
++                ClusterGroup p = ignite.cluster().forPredicate(nodeFilter);
+ 
 -                IgniteCompute compute = g.compute(p).withAsync();
++                IgniteCompute compute = ignite.compute(p).withAsync();
+ 
+                 // If future is not cached in node-local-map, cache it.
+                 if (fut1 == null) {
+                     compute.apply(new FibonacciClosure(nodeFilter), n - 1);
+ 
+                     fut1 = locMap.addIfAbsent(n - 1, compute.<BigInteger>future());
                  }
  
-                 assert fut1.isDone() && fut2.isDone();
+                 // If future is not cached in node-local-map, cache it.
+                 if (fut2 == null) {
+                     compute.apply(new FibonacciClosure(nodeFilter), n - 2);
  
-                 // Return cached results.
-                 return fut1.get().add(fut2.get());
-             }
-             catch (IgniteCheckedException e) {
-                 throw new IgniteException(e);
+                     fut2 = locMap.addIfAbsent(n - 2, compute.<BigInteger>future());
+                 }
+ 
+                 // If futures are not done, then wait asynchronously for the result
+                 if (!fut1.isDone() || !fut2.isDone()) {
+                     IgniteInClosure<IgniteFuture<BigInteger>> lsnr = new IgniteInClosure<IgniteFuture<BigInteger>>()
{
+                         @Override public void apply(IgniteFuture<BigInteger> f) {
+                             // If both futures are done, resume the continuation.
+                             if (fut1.isDone() && fut2.isDone())
+                                 // CONTINUATION:
+                                 // =============
+                                 // Resume suspended job execution.
+                                 jobCtx.callcc();
+                         }
+                     };
+ 
+                     // CONTINUATION:
+                     // =============
+                     // Hold (suspend) job execution.
+                     // It will be resumed in listener above via 'callcc()' call
+                     // once both futures are done.
+                     jobCtx.holdcc();
+ 
+                     // Attach the same listener to both futures.
+                     fut1.listenAsync(lsnr);
+                     fut2.listenAsync(lsnr);
+ 
+                     return null;
+                 }
              }
+ 
+             assert fut1.isDone() && fut2.isDone();
+ 
+             // Return cached results.
+             return fut1.get().add(fut2.get());
          }
      }
  }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/compute/ComputeRunnableExample.java
----------------------------------------------------------------------
diff --cc examples/src/main/java/org/apache/ignite/examples/compute/ComputeRunnableExample.java
index 9465779,faa6ca1..b63c603
--- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeRunnableExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeRunnableExample.java
@@@ -45,10 -45,10 +45,10 @@@ public class ComputeRunnableExample 
              System.out.println();
              System.out.println("Compute runnable example started.");
  
-             Collection<IgniteInternalFuture> futs = new ArrayList<>();
+             Collection<IgniteFuture> futs = new ArrayList<>();
  
              // Enable asynchronous mode.
 -            IgniteCompute compute = g.compute().withAsync();
 +            IgniteCompute compute = ignite.compute().withAsync();
  
              // Iterate through all words in the sentence and create callable jobs.
              for (final String word : "Print words using runnable".split(" ")) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/compute/ComputeScheduleExample.java
----------------------------------------------------------------------
diff --cc examples/src/main/java/org/apache/ignite/examples/compute/ComputeScheduleExample.java
index fb1dca1,34ad9c9..0f7a34e
--- a/examples/src/main/java/org/apache/ignite/examples/compute/ComputeScheduleExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/compute/ComputeScheduleExample.java
@@@ -55,19 -55,14 +55,14 @@@ public class ComputeScheduleExample 
                      @Override public Integer call() {
                          invocations++;
  
-                         try {
-                             ignite.compute().broadcast(
-                                 new IgniteRunnable() {
-                                     @Override public void run() {
-                                         System.out.println();
-                                         System.out.println("Howdy! :) ");
-                                     }
 -                        g.compute().broadcast(
++                        ignite.compute().broadcast(
+                             new IgniteRunnable() {
+                                 @Override public void run() {
+                                     System.out.println();
+                                     System.out.println("Howdy! :) ");
                                  }
-                             );
-                         }
-                         catch (IgniteCheckedException e) {
-                             throw new IgniteException(e);
-                         }
+                             }
+                         );
  
                          return invocations;
                      }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/compute/failover/ComputeFailoverExample.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java
----------------------------------------------------------------------
diff --cc examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java
index 5c7f246,8786222..8edb950
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheAffinityExample.java
@@@ -70,15 -70,13 +70,13 @@@ public final class CacheAffinityExampl
      }
  
      /**
-      * Collocates jobs with keys they need to work on using {@link org.apache.ignite.IgniteCompute#affinityRun(String,
Object, Runnable)}
+      * Collocates jobs with keys they need to work on using {@link IgniteCompute#affinityRun(String,
Object, Runnable)}
       * method.
-      *
-      * @throws IgniteCheckedException If failed.
       */
-     private static void visitUsingAffinityRun() throws IgniteCheckedException {
+     private static void visitUsingAffinityRun() {
 -        Ignite g = Ignition.ignite();
 +        Ignite ignite = Ignition.ignite();
  
 -        final GridCache<Integer, String> cache = g.cache(CACHE_NAME);
 +        final IgniteCache<Integer, String> cache = ignite.jcache(CACHE_NAME);
  
          for (int i = 0; i < KEY_CNT; i++) {
              final int key = i;
@@@ -97,14 -95,12 +95,12 @@@
      }
  
      /**
-      * Collocates jobs with keys they need to work on using {@link org.apache.ignite.IgniteCluster#mapKeysToNodes(String,
Collection)}
+      * Collocates jobs with keys they need to work on using {@link IgniteCluster#mapKeysToNodes(String,
Collection)}
       * method. The difference from {@code affinityRun(...)} method is that here we process
multiple keys
       * in a single job.
-      *
-      * @throws IgniteCheckedException If failed.
       */
-     private static void visitUsingMapKeysToNodes() throws IgniteCheckedException {
+     private static void visitUsingMapKeysToNodes() {
 -        final Ignite g = Ignition.ignite();
 +        final Ignite ignite = Ignition.ignite();
  
          Collection<Integer> keys = new ArrayList<>(KEY_CNT);
  

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java
----------------------------------------------------------------------
diff --cc examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java
index 1e86ca7,df8a6dd..e1604f4
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java
@@@ -89,11 -89,11 +89,11 @@@ public class CachePopularNumbersExampl
      /**
       * Populates cache in real time with numbers and keeps count for every number.
       *
 -     * @param g Grid.
 +     * @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 g) throws IgniteException {
 -        try (IgniteDataLoader<Integer, Long> ldr = g.dataLoader(CACHE_NAME)) {
++    private static void streamData(final Ignite ignite) throws IgniteException {
 +        try (IgniteDataLoader<Integer, Long> ldr = ignite.dataLoader(CACHE_NAME))
{
              // Set larger per-node buffer size since our state is relatively small.
              ldr.perNodeBufferSize(2048);
  

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/ggfs/GgfsMapReduceExample.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java
----------------------------------------------------------------------
diff --cc examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java
index c8d6341,3fde291..3eb2222
--- a/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java
@@@ -96,12 -96,11 +96,11 @@@ public final class MessagingExample 
      }
  
      /**
 -     * Start listening to messages on all grid nodes within passed in projection.
 +     * Start listening to messages on all cluster nodes within passed in projection.
       *
       * @param msg Grid messaging.
-      * @throws IgniteCheckedException If failed.
       */
-     private static void startListening(IgniteMessaging msg) throws IgniteCheckedException
{
+     private static void startListening(IgniteMessaging msg) {
          // Add ordered message listener.
          msg.remoteListen(TOPIC.ORDERED, new IgniteBiPredicate<UUID, String>() {
              @IgniteInstanceResource
@@@ -111,9 -110,9 +110,9 @@@
                  System.out.println("Received ordered message [msg=" + msg + ", fromNodeId="
+ nodeId + ']');
  
                  try {
 -                    g.message(g.cluster().forNodeId(nodeId)).send(TOPIC.ORDERED, msg);
 +                    ignite.message(ignite.cluster().forNodeId(nodeId)).send(TOPIC.ORDERED,
msg);
                  }
-                 catch (IgniteCheckedException e) {
+                 catch (IgniteException e) {
                      e.printStackTrace();
                  }
  
@@@ -130,9 -129,9 +129,9 @@@
                  System.out.println("Received unordered message [msg=" + msg + ", fromNodeId="
+ nodeId + ']');
  
                  try {
 -                    g.message(g.cluster().forNodeId(nodeId)).send(TOPIC.UNORDERED, msg);
 +                    ignite.message(ignite.cluster().forNodeId(nodeId)).send(TOPIC.UNORDERED,
msg);
                  }
-                 catch (IgniteCheckedException e) {
+                 catch (IgniteException e) {
                      e.printStackTrace();
                  }
  

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingPingPongExample.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/misc/deployment/DeploymentExample.java
----------------------------------------------------------------------
diff --cc examples/src/main/java/org/apache/ignite/examples/misc/deployment/DeploymentExample.java
index afd6072,1c217eb..f2bc56a
--- 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
@@@ -104,10 -104,10 +104,10 @@@ public final class DeploymentExample 
      @ComputeTaskName(TASK_NAME)
      public static class ExampleTask extends ComputeTaskSplitAdapter<String, Object>
{
          /** {@inheritDoc} */
-         @Override protected Collection<? extends ComputeJob> split(int clusterSize,
String arg) throws IgniteCheckedException {
 -        @Override protected Collection<? extends ComputeJob> split(int gridSize, String
arg) {
 -            Collection<ComputeJob> jobs = new ArrayList<>(gridSize);
++        @Override protected Collection<? extends ComputeJob> split(int clusterSize,
String arg) {
 +            Collection<ComputeJob> jobs = new ArrayList<>(clusterSize);
  
 -            for (int i = 0; i < gridSize; i++) {
 +            for (int i = 0; i < clusterSize; i++) {
                  jobs.add(new ComputeJobAdapter() {
                      @Nullable @Override public Serializable execute() {
                          System.out.println(">>> Executing deployment example job
on this node.");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/streaming/StreamingCheckInExample.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/streaming/StreamingPopularNumbersExample.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/streaming/StreamingPriceBarsExample.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/java/org/apache/ignite/examples/streaming/StreamingRunningAverageExample.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarContinuationExample.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7b1239/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------


Mime
View raw message