Serialize Printing of "Hello BSP"

Each BSP task of the HAMA cluster, will print the string "Hello BSP" in serial order. This example will help you to understand the concepts of the BSP computing model.

BSP implementation of Serialize Printing of "Hello BSP"

  public class ClassSerializePrinting extends
    BSP<NullWritable, NullWritable, IntWritable, Text> {

  public static final int NUM_SUPERSTEPS = 15;

  public void bsp(BSPPeer<NullWritable, NullWritable, IntWritable, Text> bspPeer)
      throws IOException, SyncException, InterruptedException {

    for (int i = 0; i < NUM_SUPERSTEPS; i++) {
      for (String otherPeer : bspPeer.getAllPeerNames()) {
        bspPeer.send(otherPeer, new IntegerMessage(bspPeer.getPeerName(), i));
      IntegerMessage msg = null;
      while ((msg = (IntegerMessage) bspPeer.getCurrentMessage()) != null) {
        bspPeer.write(new IntWritable(msg.getData()), new Text(msg.getTag()));

SerializePrinting (last edited 2012-01-31 08:33:50 by dslb-092-078-190-255)