Repository: reef
Updated Branches:
  refs/heads/master e7d54850e -> 51220770e


[REEF-1310] The Java Driver should ACK the Java Evaluator's DONE heartbeat

This addressed the issue by
  * Reflect the changes made in REEF-976 on the Java side.
  * For more details, see 
[REEF-976](https://issues.apache.org/jira/browse/REEF-976).

JIRA:
  [REEF-1310](https://issues.apache.org/jira/browse/REEF-1310)

Pull Request:
  This closes #947


Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/51220770
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/51220770
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/51220770

Branch: refs/heads/master
Commit: 51220770e8882a12f1f9f1b13b42411f97a70af0
Parents: e7d5485
Author: Andrew Chung <[email protected]>
Authored: Tue Apr 12 12:25:13 2016 -0700
Committer: Markus Weimer <[email protected]>
Committed: Thu Apr 14 14:27:35 2016 -0700

----------------------------------------------------------------------
 .../reef/runtime/common/evaluator/EvaluatorRuntime.java     | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/reef/blob/51220770/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/EvaluatorRuntime.java
----------------------------------------------------------------------
diff --git 
a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/EvaluatorRuntime.java
 
b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/EvaluatorRuntime.java
index 729c2e2..1384556 100644
--- 
a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/EvaluatorRuntime.java
+++ 
b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/EvaluatorRuntime.java
@@ -96,6 +96,14 @@ final class EvaluatorRuntime implements 
EventHandler<EvaluatorControlProto> {
             "Identifier mismatch: message for evaluator id[" + 
message.getIdentifier()
                 + "] sent to evaluator id[" + this.evaluatorIdentifier + "]"
         ));
+      } else if (ReefServiceProtos.State.DONE == this.state) {
+        if (message.getDoneEvaluator() != null) {
+          LOG.log(Level.INFO, "Received ACK from Driver, shutting down 
Evaluator.");
+          this.clock.close();
+          return;
+        } else {
+          this.onException(new RuntimeException("Received a control message 
from Driver after Evaluator is done."));
+        }
       } else if (ReefServiceProtos.State.RUNNING != this.state) {
         this.onException(new RuntimeException(
             "Evaluator sent a control message but its state is not "
@@ -112,7 +120,6 @@ final class EvaluatorRuntime implements 
EventHandler<EvaluatorControlProto> {
             if (this.contextManager.contextStackIsEmpty() && this.state == 
ReefServiceProtos.State.RUNNING) {
               this.state = ReefServiceProtos.State.DONE;
               
this.heartBeatManager.sendEvaluatorStatus(this.getEvaluatorStatus());
-              this.clock.close();
             }
           } catch (final Throwable e) {
             this.onException(e);

Reply via email to