A and B should be the same. But, B is recommended (to avoid unnecessary calls of the compute() method).
Please use the TRUNK. There's a bug - https://issues.apache.org/jira/browse/HAMA-771 - in the latest release. Thanks. A: if (minDist < this.getValue().get()) { this.setValue(new IntWritable(minDist)); for (Edge<Text, IntWritable> e : this.getEdges()) { sendMessage(e, new IntWritable(minDist + e.getValue().get())); } } else { voteToHalt(); } B: if (minDist < this.getValue().get()) { this.setValue(new IntWritable(minDist)); for (Edge<Text, IntWritable> e : this.getEdges()) { sendMessage(e, new IntWritable(minDist + e.getValue().get())); } } voteToHalt(); On Sat, Jun 29, 2013 at 5:04 AM, Chui-Hui Chiu <[email protected]> wrote: > Hello, all, > > Here's the "compute" function is the SSSP sample. > > @Override > public void compute(Iterable<IntWritable> messages) throws IOException { > int minDist = isStartVertex() ? 0 : Integer.MAX_VALUE; > > for (IntWritable msg : messages) { > if (msg.get() < minDist) { > minDist = msg.get(); > } > } > > if (minDist < this.getValue().get()) { > this.setValue(new IntWritable(minDist)); > for (Edge<Text, IntWritable> e : this.getEdges()) { > sendMessage(e, new IntWritable(minDist + e.getValue().get())); > } > } else { > voteToHalt(); > } > } > > Why does it fall through the end of the compute() without explicitly > calling the voteToHalt() after sending out all messages? Does reaching the > end of the compute() imply calling the voteToHalt()? > > > Thanks, > Chui-hui -- Best Regards, Edward J. Yoon @eddieyoon
