...
- See the BSP programming model of HAMA if you didn't read yet.
No Format |
---|
public class ClassSerializePrinting extends BSP<NullWritable, NullWritable, IntWritable, Text> { public static final int NUM_SUPERSTEPS = 15; @Override public void bsp(BSPPeerProtocolBSPPeer<NullWritable, NullWritable, IntWritable, Text> bspPeer) throws IOException, throws IOException, KeeperExceptionSyncException, InterruptedException { for (int i = 0; i < NUM_SUPERSTEPS; i++) { for (String otherPeer : bspPeer.getAllPeerNames()) { String peerName = bspPeer.send(otherPeer, new IntegerMessage(bspPeer.getPeerName(), i)); } if (peerName.equals(otherPeer)) { bspPeer.sync(); IntegerMessage msg writeLogToFile(peerName, i)= null; while } Thread.sleep(PRINT_INTERVAL); ((msg = (IntegerMessage) bspPeer.getCurrentMessage()) != null) { bspPeer.write(new IntWritable(msg.getData()), new bspPeerText(msg.syncgetTag())); i++;} } } } |