incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1202085 - in /incubator/hama/trunk: core/src/main/java/org/apache/hama/bsp/BSP.java examples/src/main/java/org/apache/hama/examples/PiEstimator.java
Date Tue, 15 Nov 2011 08:05:09 GMT
Author: edwardyoon
Date: Tue Nov 15 08:05:08 2011
New Revision: 1202085

URL: http://svn.apache.org/viewvc?rev=1202085&view=rev
Log:
Fix javadocs and minor refactor

Modified:
    incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java
    incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/PiEstimator.java

Modified: incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java?rev=1202085&r1=1202084&r2=1202085&view=diff
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java (original)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java Tue Nov 15 08:05:08
2011
@@ -35,6 +35,7 @@ public abstract class BSP<K1, V1, K2, V2
    * done here.
    * 
    * @param peer Your BSPPeer instance.
+   * @throws IOException 
    */
   public abstract void bsp(BSPPeer<K1, V1, K2, V2> peer) throws IOException,
       KeeperException, InterruptedException;
@@ -44,6 +45,7 @@ public abstract class BSP<K1, V1, K2, V2
    * purposes.
    * 
    * @param peer Your BSPPeer instance.
+   * @throws IOException 
    */
   public void setup(BSPPeer<K1, V1, K2, V2> peer) throws IOException,
       KeeperException, InterruptedException {
@@ -56,8 +58,9 @@ public abstract class BSP<K1, V1, K2, V2
    * case of exceptions.
    * 
    * @param peer Your BSPPeer instance.
+   * @throws IOException 
    */
-  public void cleanup(BSPPeer<K1, V1, K2, V2> peer) {
+  public void cleanup(BSPPeer<K1, V1, K2, V2> peer) throws IOException {
 
   }
 

Modified: incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/PiEstimator.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/PiEstimator.java?rev=1202085&r1=1202084&r2=1202085&view=diff
==============================================================================
--- incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/PiEstimator.java
(original)
+++ incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/PiEstimator.java
Tue Nov 15 08:05:08 2011
@@ -70,7 +70,19 @@ public class PiEstimator {
 
       peer.send(masterTask, estimate);
       peer.sync();
+    }
+
+    @Override
+    public void setup(
+        BSPPeer<NullWritable, NullWritable, Text, DoubleWritable> peer)
+        throws IOException {
+      // Choose one as a master
+      this.masterTask = peer.getPeerName(peer.getNumPeers() / 2);
+    }
 
+    public void cleanup(
+        BSPPeer<NullWritable, NullWritable, Text, DoubleWritable> peer)
+        throws IOException {
       if (peer.getPeerName().equals(masterTask)) {
         double pi = 0.0;
         int numPeers = peer.getNumCurrentMessages();
@@ -80,19 +92,13 @@ public class PiEstimator {
         }
 
         pi = pi / numPeers;
-        peer.write(new Text("Estimated value of PI is"), new DoubleWritable(pi));
+        peer
+            .write(new Text("Estimated value of PI is"), new DoubleWritable(pi));
       }
     }
-
-    @Override
-    public void setup(
-        BSPPeer<NullWritable, NullWritable, Text, DoubleWritable> peer) {
-      // Choose one as a master
-      this.masterTask = peer.getPeerName(peer.getNumPeers() / 2);
-    }
   }
 
-  private static void printOutput(HamaConfiguration conf) throws IOException {
+  static void printOutput(HamaConfiguration conf) throws IOException {
     FileSystem fs = FileSystem.get(conf);
     FileStatus[] files = fs.listStatus(TMP_OUTPUT);
     for (int i = 0; i < files.length; i++) {



Mime
View raw message