refactoring
diff --git a/pregelix/pregelix-runtime/src/main/java/edu/uci/ics/pregelix/runtime/function/ComputeUpdateFunctionFactory.java b/pregelix/pregelix-runtime/src/main/java/edu/uci/ics/pregelix/runtime/function/ComputeUpdateFunctionFactory.java
index 656adc6..d46457c 100644
--- a/pregelix/pregelix-runtime/src/main/java/edu/uci/ics/pregelix/runtime/function/ComputeUpdateFunctionFactory.java
+++ b/pregelix/pregelix-runtime/src/main/java/edu/uci/ics/pregelix/runtime/function/ComputeUpdateFunctionFactory.java
@@ -168,43 +168,43 @@
tbAlive.reset();
vertex = (Vertex) tuple[3];
- if (!vertex.isPartitionTerminated()) {
- vertex.setOutputWriters(writers);
- vertex.setOutputAppenders(appenders);
- vertex.setOutputTupleBuilders(tbs);
- MsgList msgContentList = (MsgList) tuple[1];
- msgContentList.reset(msgIterator);
-
- if (!msgIterator.hasNext() && vertex.isHalted()) {
- return;
- }
- if (vertex.isHalted()) {
- vertex.activate();
- }
-
- try {
- if (msgContentList.segmentStart()) {
- vertex.open();
- }
- vertex.compute(msgIterator);
- if (msgContentList.segmentEnd()) {
- vertex.close();
- }
- vertex.finishCompute();
- } catch (Exception e) {
- throw new HyracksDataException(e);
- }
-
- /**
- * this partition should not terminate
- */
- if (terminate && (!vertex.isHalted() || vertex.hasMessage() || vertex.createdNewLiveVertex()))
- terminate = false;
- } else {
+ if (vertex.isPartitionTerminated()) {
vertex.voteToHalt();
+ return;
+ }
+ vertex.setOutputWriters(writers);
+ vertex.setOutputAppenders(appenders);
+ vertex.setOutputTupleBuilders(tbs);
+
+ MsgList msgContentList = (MsgList) tuple[1];
+ msgContentList.reset(msgIterator);
+
+ if (!msgIterator.hasNext() && vertex.isHalted()) {
+ return;
+ }
+ if (vertex.isHalted()) {
+ vertex.activate();
}
+ try {
+ if (msgContentList.segmentStart()) {
+ vertex.open();
+ }
+ vertex.compute(msgIterator);
+ if (msgContentList.segmentEnd()) {
+ vertex.close();
+ }
+ vertex.finishCompute();
+ } catch (Exception e) {
+ throw new HyracksDataException(e);
+ }
+
+ /**
+ * this partition should not terminate
+ */
+ if (terminate && (!vertex.isHalted() || vertex.hasMessage() || vertex.createdNewLiveVertex()))
+ terminate = false;
aggregator.step(vertex);
}
diff --git a/pregelix/pregelix-runtime/src/main/java/edu/uci/ics/pregelix/runtime/function/StartComputeUpdateFunctionFactory.java b/pregelix/pregelix-runtime/src/main/java/edu/uci/ics/pregelix/runtime/function/StartComputeUpdateFunctionFactory.java
index ed4c522..eba75c9 100644
--- a/pregelix/pregelix-runtime/src/main/java/edu/uci/ics/pregelix/runtime/function/StartComputeUpdateFunctionFactory.java
+++ b/pregelix/pregelix-runtime/src/main/java/edu/uci/ics/pregelix/runtime/function/StartComputeUpdateFunctionFactory.java
@@ -172,30 +172,29 @@
tbAlive.reset();
vertex = (Vertex) tuple[1];
- if (!vertex.isPartitionTerminated()) {
- vertex.setOutputWriters(writers);
- vertex.setOutputAppenders(appenders);
- vertex.setOutputTupleBuilders(tbs);
-
- if (!msgIterator.hasNext() && vertex.isHalted()) {
- return;
- }
- if (vertex.isHalted()) {
- vertex.activate();
- }
-
- try {
- vertex.open();
- vertex.compute(msgIterator);
- vertex.close();
- vertex.finishCompute();
- } catch (Exception e) {
- throw new HyracksDataException(e);
- }
- } else {
+ if (vertex.isPartitionTerminated()) {
vertex.voteToHalt();
+ return;
+ }
+ vertex.setOutputWriters(writers);
+ vertex.setOutputAppenders(appenders);
+ vertex.setOutputTupleBuilders(tbs);
+
+ if (!msgIterator.hasNext() && vertex.isHalted()) {
+ return;
+ }
+ if (vertex.isHalted()) {
+ vertex.activate();
}
+ try {
+ vertex.open();
+ vertex.compute(msgIterator);
+ vertex.close();
+ vertex.finishCompute();
+ } catch (Exception e) {
+ throw new HyracksDataException(e);
+ }
/**
* this partition should not terminate
*/
@@ -206,6 +205,7 @@
* call the global aggregator
*/
aggregator.step(vertex);
+
}
@Override