You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by to...@apache.org on 2012/08/09 14:11:35 UTC

svn commit: r1371178 - in /hama/trunk/core/src/main/java/org/apache/hama/bsp: BSP.java BSPInterface.java BSPPeer.java

Author: tommaso
Date: Thu Aug  9 12:11:34 2012
New Revision: 1371178

URL: http://svn.apache.org/viewvc?rev=1371178&view=rev
Log:
[HAMA-603] - minor foundation API refactoring

Modified:
    hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java
    hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java
    hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeer.java

Modified: hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java
URL: http://svn.apache.org/viewvc/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java?rev=1371178&r1=1371177&r2=1371178&view=diff
==============================================================================
--- hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java (original)
+++ hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java Thu Aug  9 12:11:34 2012
@@ -23,44 +23,29 @@ import org.apache.hadoop.io.Writable;
 import org.apache.hama.bsp.sync.SyncException;
 
 /**
- * This class provides an abstract implementation of the BSP interface.
+ * This class provides an abstract implementation of the {@link BSPInterface}.
  */
 public abstract class BSP<K1, V1, K2, V2, M extends Writable> implements
     BSPInterface<K1, V1, K2, V2, M> {
 
-  /**
-   * This method is your computation method, the main work of your BSP should be
-   * done here.
-   * 
-   * @param peer Your BSPPeer instance.
-   * @throws IOException
-   * @throws SyncException
-   * @throws InterruptedException
-   */
-  public abstract void bsp(BSPPeer<K1, V1, K2, V2, M> peer) throws IOException,
+    /**
+     * {@inheritDoc}
+     */
+    public abstract void bsp(BSPPeer<K1, V1, K2, V2, M> peer) throws IOException,
       SyncException, InterruptedException;
 
-  /**
-   * This method is called before the BSP method. It can be used for setup
-   * purposes.
-   * 
-   * @param peer Your BSPPeer instance.
-   * @throws IOException
-   */
-  public void setup(BSPPeer<K1, V1, K2, V2, M> peer) throws IOException,
+    /**
+     * {@inheritDoc}
+     */
+    public void setup(BSPPeer<K1, V1, K2, V2, M> peer) throws IOException,
       SyncException, InterruptedException {
 
   }
 
-  /**
-   * This method is called after the BSP method. It can be used for cleanup
-   * purposes. Cleanup is guranteed to be called after the BSP runs, even in
-   * case of exceptions.
-   * 
-   * @param peer Your BSPPeer instance.
-   * @throws IOException
-   */
-  public void cleanup(BSPPeer<K1, V1, K2, V2, M> peer) throws IOException {
+    /**
+     * {@inheritDoc}
+     */
+    public void cleanup(BSPPeer<K1, V1, K2, V2, M> peer) throws IOException {
 
   }
 

Modified: hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java
URL: http://svn.apache.org/viewvc/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java?rev=1371178&r1=1371177&r2=1371178&view=diff
==============================================================================
--- hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java (original)
+++ hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java Thu Aug  9 12:11:34 2012
@@ -17,10 +17,48 @@
  */
 package org.apache.hama.bsp;
 
+import java.io.IOException;
+
+import org.apache.hadoop.io.Writable;
+import org.apache.hama.bsp.sync.SyncException;
+
 /**
- * Interface BSP defines the basic operations needed to implement the BSP
- * algorithm.
+ * The {@link BSPInterface} defines the basic operations needed to implement a BSP
+ * based algorithm.
+ * The implementing algorithm takes {@link BSPPeer}s as parameters which are
+ * responsible for communication, reading K1-V1 inputs, collecting k2-V2 outputs
+ * and exchanging messages of type M.
  */
-public interface BSPInterface<K1, V1, K2, V2, M> {
+public interface BSPInterface<K1, V1, K2, V2, M extends Writable> {
+
+    /**
+     * This method is your computation method, the main work of your BSP should be
+     * done here.
+     *
+     * @param peer Your BSPPeer instance.
+     * @throws java.io.IOException
+     * @throws org.apache.hama.bsp.sync.SyncException
+     * @throws InterruptedException
+     */
+    public void bsp(BSPPeer<K1, V1, K2, V2, M> peer) throws IOException, SyncException, InterruptedException;
+
+    /**
+     * This method is called before the BSP method. It can be used for setup
+     * purposes.
+     *
+     * @param peer Your BSPPeer instance.
+     * @throws IOException
+     */
+    public void setup(BSPPeer<K1, V1, K2, V2, M> peer) throws IOException,
+            SyncException, InterruptedException;
 
+    /**
+     * This method is called after the BSP method. It can be used for cleanup
+     * purposes. Cleanup is guranteed to be called after the BSP runs, even in
+     * case of exceptions.
+     *
+     * @param peer Your BSPPeer instance.
+     * @throws IOException
+     */
+    public void cleanup(BSPPeer<K1, V1, K2, V2, M> peer) throws IOException;
 }

Modified: hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeer.java
URL: http://svn.apache.org/viewvc/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeer.java?rev=1371178&r1=1371177&r2=1371178&view=diff
==============================================================================
--- hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeer.java (original)
+++ hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeer.java Thu Aug  9 12:11:34 2012
@@ -28,6 +28,9 @@ import org.apache.hama.util.KeyValuePair
 
 /**
  * BSP communication interface.
+ * Reads key-value inputs, with K1 typed keys and V1 typed values.
+ * Collects key-value outputs, with k2 typed keys and V2 typed values.
+ * Exchange messages with other {@link BSPPeer}s via messages of type M.
  */
 public interface BSPPeer<K1, V1, K2, V2, M extends Writable> extends Constants {